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

Support root level grouping topicrefs #2092 #2648 #2614 #2683

Merged
merged 1 commit into from May 14, 2017

Conversation

robander
Copy link
Member

@robander robander commented May 10, 2017

The current PDF2 process assumes that if a root branch of a map has any real content, the root topicref of the branch will have either a title or reference a topic (or both). When that is not the case, the PDF is broken. If there is only the one root branch, FOP will crash (as reported in #2648). If there are "valid" root branches, the branch with a root grouping element will appear in the TOC + contents but not in the actual content.

Related, the much older issue #2092 has the same root cause -- it assumes that in a bookmap, any chapter, appendix, appendices, preface, or topicref (as child of front/back matter container) will either have a title or reference a topic. When that is not the case, results are the same as above.

In all of these cases, the code assumes that the container elements will reference a topic, and try to process the topic with <xsl:for-each select="key('topic-id', @id)"> (note that when there is only a title in the topicref / chapter / etc, the merge process generates a topic with that title, so the key-lookup still works). When the topic-id lookup fails, no page sequence is generated, and children are not processed.

The fix here checks to see if the topic-id returns anything. If the result is empty, it continues to any topicref children with the same mode. Additional grouping topicref elements do the same. If a topic is eventually found, a valid page sequence is generated, and normal processing continues at that point.

Just realized that this also addresses #2614.

Signed-off-by: Robert D Anderson robander@us.ibm.com

@robander robander added bug priority/medium Medium (or unknown) priority issue plugin/pdf Issue related to PDF plug-in labels May 10, 2017
@robander robander added this to the 2.5 milestone May 10, 2017
@robander robander requested a review from jelovirt May 10, 2017 03:08
@@ -240,6 +238,19 @@ See the accompanying LICENSE file for applicable license.
<xsl:call-template name="createBackCover"/>
</xsl:template>

<xsl:template match="*[contains(@class,' map/topicref ')]" mode="generatePageSequenceFromTopicref">
<xsl:choose>
<xsl:when test="empty(key('topic-id', @id))">
Copy link
Member

Choose a reason for hiding this comment

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

Save key('topic-id', @id) into a variable since it's used twice in this template.

<xsl:call-template name="processTopicChapter"/>
</xsl:for-each>
<xsl:choose>
<xsl:when test="empty(key('topic-id', @id))">
Copy link
Member

Choose a reason for hiding this comment

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

Same as previous comment, save key('topic-id', @id) into e.g. $topic variable. Applies to all cases below.

@robander robander force-pushed the hotfix/2092 branch 2 times, most recently from 574120b to 2b10b12 Compare May 10, 2017 20:00
Signed-off-by: Robert D Anderson <robander@us.ibm.com>
@robander
Copy link
Member Author

Now updated based on review comments from @jelovirt

@robander robander changed the title Support root level grouping topicrefs #2092 #2648 Support root level grouping topicrefs #2092 #2648 #2614 May 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug plugin/pdf Issue related to PDF plug-in priority/medium Medium (or unknown) priority issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants