Better aligned ToC

This commit is contained in:
skyanth 2017-03-14 11:37:50 +01:00
parent 06b8268b78
commit 1476f81cb8
2 changed files with 37 additions and 27 deletions

View File

@ -86,8 +86,6 @@
</xsl:attribute-set>
<xsl:attribute-set name="title-toc" use-attribute-sets="title-1">
<xsl:attribute name="margin-bottom">0cm</xsl:attribute>
<xsl:attribute name="padding-right">3pt</xsl:attribute>
<!-- this is cheating, need to check if toc page numbers can be rendered in a better way -->
</xsl:attribute-set>
<xsl:attribute-set name="img-title">
<xsl:attribute name="font-style">italic</xsl:attribute>
@ -252,11 +250,6 @@
<xsl:attribute name="break-after">page</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="toc-block">
<xsl:attribute name="text-align-last">justify</xsl:attribute>
<xsl:attribute name="padding-right">3pt</xsl:attribute>
</xsl:attribute-set>
<!-- Contact -->
<xsl:attribute-set name="Contact">
<xsl:attribute name="keep-together.within-page">always</xsl:attribute>

View File

@ -6,17 +6,26 @@
<xsl:template match="generate_index">
<fo:block xsl:use-attribute-sets="title-toc">Table of Contents</fo:block>
<fo:block xsl:use-attribute-sets="index">
<xsl:apply-templates select="/" mode="toc"/>
<fo:block>
<fo:table width="100%" xsl:use-attribute-sets="toc-block">
<fo:table-column/>
<fo:table-column column-width="7mm"/>
<fo:table-body>
<xsl:apply-templates select="/" mode="toc"/>
</fo:table-body>
</fo:table>
</fo:block>
</fo:block>
</xsl:template>
<xsl:template match="meta | *[ancestor-or-self::*/@visibility = 'hidden']" mode="toc"/>
<!-- meta, hidden things and children of hidden things not indexed -->
<xsl:template
match="section[not(@visibility = 'hidden')] | finding | appendix[not(@visibility = 'hidden')] | non-finding"
mode="toc">
<xsl:choose>
<xsl:when test="$EXEC_SUMMARY = true()">
<xsl:if test="ancestor-or-self::*/@inexecsummary = 'yes'">
@ -27,27 +36,35 @@
<xsl:call-template name="ToC"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="ToC">
<fo:block xsl:use-attribute-sets="toc-block">
<fo:basic-link>
<xsl:attribute name="internal-destination">
<xsl:value-of select="@id"/>
</xsl:attribute>
<xsl:call-template name="tocContent"/>
</fo:basic-link>
<xsl:text> </xsl:text>
<fo:leader leader-pattern="dots" leader-alignment="reference-area"
leader-length.maximum="21cm"/>
<xsl:text>&#160;</xsl:text>
<fo:basic-link>
<xsl:attribute name="internal-destination">
<xsl:value-of select="@id"/>
</xsl:attribute>
<fo:page-number-citation ref-id="{@id}"/>
</fo:basic-link>
</fo:block>
<fo:table-row>
<fo:table-cell text-align-last="justify">
<fo:block>
<fo:basic-link>
<xsl:attribute name="internal-destination">
<xsl:value-of select="@id"/>
</xsl:attribute>
<xsl:call-template name="tocContent"/>
</fo:basic-link>
<xsl:text>&#xA0;</xsl:text>
<fo:leader leader-pattern="dots" leader-alignment="reference-area"
leader-length.maximum="21cm"/>
</fo:block>
</fo:table-cell>
<fo:table-cell padding-right="3pt" display-align="after">
<fo:block text-align="right">
<fo:basic-link>
<xsl:attribute name="internal-destination">
<xsl:value-of select="@id"/>
</xsl:attribute>
<fo:page-number-citation ref-id="{@id}"/>
</fo:basic-link>
</fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:choose>
<xsl:when test="$EXEC_SUMMARY = true()">
<xsl:apply-templates