Skip to content

Commit

Permalink
Fixed exporting PDF bookmarks with missing TOC levels
Browse files Browse the repository at this point in the history
  • Loading branch information
philipru committed Feb 28, 2020
1 parent 89f454b commit e1c27e8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@
</fo:layout-master-set>

<!-- create PDF bookmarks -->
<xsl:if test="//toc[1]/toc-tree/toc-part[@idref]">
<xsl:if test="//toc[1]/toc-tree//toc-part[@idref]">
<fo:bookmark-tree>
<xsl:apply-templates select="//toc[1]/toc-tree/toc-part[@idref]" mode="bookmark" />
<xsl:apply-templates select="//toc[1]/toc-tree/toc-part" mode="bookmark" />
</fo:bookmark-tree>
</xsl:if>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1104,10 +1104,15 @@
<xsl:if test="@prefix != ''"><xsl:text> </xsl:text></xsl:if>
<xsl:value-of select="@title"/>
</fo:bookmark-title>
<xsl:apply-templates select="toc-part[@idref]" mode="bookmark"/>
<xsl:apply-templates select="toc-part" mode="bookmark"/>
</fo:bookmark>
</xsl:template>


<!-- In case there are missing levels -->
<xsl:template match="toc-part[not(@idref)]" mode="bookmark">
<xsl:apply-templates select="toc-part" mode="bookmark"/>
</xsl:template>

<!-- Ignore metadata elements in PageSeeder document -->
<xsl:template match="documentinfo | fragmentinfo | locator | metadata"/>

Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.8
0.4.9

0 comments on commit e1c27e8

Please sign in to comment.