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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
For type safety.
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.
@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)) ) |
There was a problem hiding this comment.
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
feerrenrut
force-pushed
the
i6102-MSWordCrossRefLinks
branch
from
August 8, 2016 07:41
44d4fe7
to
25043b5
Compare
All looks good to me. |
feerrenrut
added a commit
that referenced
this pull request
Aug 10, 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)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 likeu' 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.