-
Notifications
You must be signed in to change notification settings - Fork 4
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
Line-breaks in topic titles causing builds to fail #47
Conversation
wrap previous xpath in a normalize-space() function to prevent trailing or leading line breaks from causing issues with generating search previews
…-breaks Update title attr in extract-data.xsl
@super-structure Thanks for reporting this and proposing the fix. I can't seem to reproduce the issue. I tested with a long topic title that contained multiple line breaks and everything still worked fine: Can you provide more details on the circumstances that cause the problem? |
@infotexture Sure! And I should have specified line feeds instead of line breaks. I narrowed down the issue to the following topic title element:
I just noticed that there is a line feed, tab, and trailing space in that title. I had suspected it was the line feed, though it could be any combination of those I suppose. |
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.
LGTM.
I couldn't reproduce the error at first, but that is because I was editing the DITA Bootstrap sample like @infotexture which includes an
Now when I deliberately remove that and deliberate change the title I can reproduce the error, and
Which will remove any |
@jason-fox Thanks for reviewing and merging. It's easy to forget that |
This seems related to issue #47 , but it's showing up in a different place. Here, it seems that the line breaks are not being escaped in the resulting lunr.json file for the search functionality. ## Suggested resolution As the whitespace in a title (whether intentional or not) isn't really relevant to the search functionality, simply using the same replace function in xpath as is used elsewhere in the `data-to-json.xsl` file seems a simple and consistent fix for this issue.
Trailing line breaks within topic
<title>
elements of cause builds to fail when the search result previews are generated (at taskname gen-preview-json). This appears to be when converting the title contents from text node to attribute value in merge-data.xsl.Simply wrapping the existing xpath in a normalize-space() function resolves the issue; at least for leading or trailing line breaks.