Skip to content

Commit

Permalink
Fix toc styling
Browse files Browse the repository at this point in the history
  • Loading branch information
jelovirt committed Oct 30, 2024
1 parent 7160f07 commit 9ec24e3
Showing 1 changed file with 49 additions and 31 deletions.
80 changes: 49 additions & 31 deletions src/generator/com/elovirta/pdf/toc.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -466,20 +466,59 @@
</axsl:attribute>
</axsl:attribute-set>

<axsl:attribute-set name="__toc__part__content" use-attribute-sets="__toc__topic__content">
<xsl:call-template name="generate-attribute-set">
<xsl:with-param name="prefix" select="'style-toc-part'"/>
<xsl:with-param name="properties" select="$allProperties[. ne 'start-indent']"/>
</xsl:call-template>
<axsl:attribute-set name="__toc__part__content">
<xsl:choose>
<xsl:when test="some $key in map:keys($root) satisfies starts-with($key, 'style-toc-part')">
<xsl:call-template name="generate-attribute-set">
<xsl:with-param name="prefix" select="'style-toc-part'"/>
<xsl:with-param name="properties" select="$allProperties[. ne 'start-indent']"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="generate-attribute-set">
<xsl:with-param name="prefix" select="'style-toc-1'"/>
<xsl:with-param name="properties" select="$allProperties[. ne 'start-indent']"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<!-- Override PDF2 default -->
<axsl:attribute name="padding-top">inherit</axsl:attribute>
</axsl:attribute-set>

<axsl:attribute-set name="__toc__chapter__content" use-attribute-sets="__toc__topic__content">
<xsl:call-template name="generate-attribute-set">
<xsl:with-param name="prefix" select="'style-toc-chapter'"/>
<xsl:with-param name="properties" select="$allProperties[. ne 'start-indent']"/>
</xsl:call-template>
<axsl:attribute-set name="__toc__chapter__content">
<xsl:choose>
<xsl:when test="some $key in map:keys($root) satisfies starts-with($key, 'style-toc-chapter')">
<xsl:call-template name="generate-attribute-set">
<xsl:with-param name="prefix" select="'style-toc-chapter'"/>
<xsl:with-param name="properties" select="$allProperties[. ne 'start-indent']"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="generate-attribute-set">
<xsl:with-param name="prefix" select="'style-toc-1'"/>
<xsl:with-param name="properties" select="$allProperties[. ne 'start-indent']"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<!-- Override PDF2 default -->
<axsl:attribute name="padding-top">inherit</axsl:attribute>
</axsl:attribute-set>

<axsl:attribute-set name="__toc__appendix__content">
<xsl:choose>
<xsl:when test="some $key in map:keys($root) satisfies starts-with($key, 'style-toc-appendix')">
<xsl:call-template name="generate-attribute-set">
<xsl:with-param name="prefix" select="'style-toc-appendix'"/>
<xsl:with-param name="properties" select="$allProperties[. ne 'start-indent']"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="generate-attribute-set">
<xsl:with-param name="prefix" select="'style-toc-1'"/>
<xsl:with-param name="properties" select="$allProperties[. ne 'start-indent']"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<!-- Override PDF2 default -->
<axsl:attribute name="padding-top">inherit</axsl:attribute>
</axsl:attribute-set>
Expand Down Expand Up @@ -513,27 +552,6 @@
</axsl:attribute-set>

<xsl:if test="some $key in map:keys($root) satisfies starts-with($key, 'style-toc-1')">
<axsl:attribute-set name="__toc__chapter__content">
<xsl:call-template name="generate-attribute-set">
<xsl:with-param name="prefix" select="'style-toc-1'"/>
<xsl:with-param name="properties" select="$allProperties[. ne 'start-indent']"/>
</xsl:call-template>
</axsl:attribute-set>

<axsl:attribute-set name="__toc__appendix__content">
<xsl:call-template name="generate-attribute-set">
<xsl:with-param name="prefix" select="'style-toc-1'"/>
<xsl:with-param name="properties" select="$allProperties[. ne 'start-indent']"/>
</xsl:call-template>
</axsl:attribute-set>

<axsl:attribute-set name="__toc__part__content">
<xsl:call-template name="generate-attribute-set">
<xsl:with-param name="prefix" select="'style-toc-1'"/>
<xsl:with-param name="properties" select="$allProperties[. ne 'start-indent']"/>
</xsl:call-template>
</axsl:attribute-set>

<axsl:attribute-set name="__toc__preface__content">
<xsl:call-template name="generate-attribute-set">
<xsl:with-param name="prefix" select="'style-toc-1'"/>
Expand Down

0 comments on commit 9ec24e3

Please sign in to comment.