Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I6102 ms word cross ref links #6242

Merged
merged 10 commits into from Aug 31, 2016
Merged

I6102 ms word cross ref links #6242

merged 10 commits into from Aug 31, 2016

Conversation

feerrenrut
Copy link
Contributor

@feerrenrut feerrenrut commented Aug 5, 2016

Add support for cross references in word. Fixes #6102

Now able to report cross references as links when reading through text in word. Can browse by link and when in browse mode a Cross ref link can be activated.

Had to expand the range to the paragraph because single words with in a ref dont report as refs. Only the first and the last character.

Refs that are links have the fields.item(1).code.text property set to something like u' REF _Ref457210120 \\h

For performance reasons the links are cached first, then as we traverse over the words in the range we check if the word is in the vector of known links.

now able to report cross references as links when reading through text in word.
Browse mode, navigating by links with 'k' does not work
Activating the links do not work.
Probably need more validation to check that the ref is also a link. This
can be done by checking for the presence of \\h in the
`fields.item(1).code.text` result eg: `u' REF _Ref457210120 \\h `
When in browse mode a Cross ref link can be activated. This currently
has some limitations. If there are multiple words in the field, internal
words can not be used to jump to the bookmark.
cross reference links now report as links on characters / words between
the start and end. The links can be activated with the caret at
(immediately before) the first character.
Other calls to expand only pass in one parameter, also the argument
string passed only declares one parameter.
Since we only ever check if there is more than 0, this allows them to
exit early.
Link locations are cached before entering a loop that steps
through the range word by word.
@feerrenrut
Copy link
Contributor Author

@michaelDCurran would you mind taking a look at this when you have the chance?

if t == FIELD_TYPE_REF:
fieldText = item.code.text.strip().split(' ')
# ensure that the text has a \\h in it
return any( fieldText[i] == '\\h' for i in range(2, len(fieldText)) )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

range should be xrange

feerrenrut added a commit that referenced this pull request Aug 8, 2016
Fix sillyness in the inRange function.
convert range to xrange in python code.
convert format flags to hex
pull out addition of link xml tag from `generateXMLAttribsForFormatting`
fix issue allowing links to be activated one character before they start
Fix sillyness in the inRange function.
convert range to xrange in python code.
convert format flags to hex
pull out addition of link xml tag from `generateXMLAttribsForFormatting`
fix issue allowing links to be activated one character before they start
@michaelDCurran
Copy link
Member

All looks good to me.

feerrenrut added a commit that referenced this pull request Aug 10, 2016
Issue #6102
Merge branch 'i6102-MSWordCrossRefLinks' into next
@feerrenrut feerrenrut merged commit cd74c6e into master Aug 31, 2016
@nvaccessAuto nvaccessAuto added this to the 2016.4 milestone Aug 31, 2016
feerrenrut added a commit that referenced this pull request Aug 31, 2016
Cross Reference fields in Microsoft Word are now treated like hyperlinks. They are reported as links, and can be activated. (#6102)
@feerrenrut feerrenrut deleted the i6102-MSWordCrossRefLinks branch January 17, 2020 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants