Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84270 - trunk/tools/boostbook/xsl
From: john_at_[hidden]
Date: 2013-05-13 12:51:41


Author: johnmaddock
Date: 2013-05-13 12:51:41 EDT (Mon, 13 May 2013)
New Revision: 84270
URL: http://svn.boost.org/trac/boost/changeset/84270

Log:
Add option to permit single depth TOC at chapter level, while maintaining multi-depth TOC at subsequent levels.
This is primarily for the Math lib docs.
Text files modified:
   trunk/tools/boostbook/xsl/html-base.xsl | 31 +++++++++++++++++++++++++++++++
   1 files changed, 31 insertions(+), 0 deletions(-)

Modified: trunk/tools/boostbook/xsl/html-base.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/html-base.xsl (original)
+++ trunk/tools/boostbook/xsl/html-base.xsl 2013-05-13 12:51:41 EDT (Mon, 13 May 2013)
@@ -35,6 +35,8 @@
   <xsl:param name="boost.mathjax" select="0"/>
   <xsl:param name="boost.mathjax.script"
              select="'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'"/>
+ <!--See usage below for explanation of this param-->
+ <xsl:param name="boost.noexpand.chapter.toc" select="0"/>
 
   <xsl:param name="admon.style"/>
   <xsl:param name="admon.graphics">1</xsl:param>
@@ -380,4 +382,33 @@
    <xsl:value-of select="'index'"/>
 </xsl:template>
 
+<xsl:template match="preface|chapter|appendix|article" mode="toc">
+ <xsl:param name="toc-context" select="."/>
+
+ <!--
+ When boost.noexpand.chapter.toc is set to 1, then the TOC for
+ chapters is only one level deep (ie toc.max.depth has no effect)
+ and nested sections within chapters are not shown. TOC's and LOC's
+ at other levels are not effected and respond to toc.max.depth as normal.
+ -->
+ <xsl:choose>
+ <xsl:when test="local-name($toc-context) = 'book' and $boost.noexpand.chapter.toc = 1">
+ <xsl:call-template name="subtoc">
+ <xsl:with-param name="toc-context" select="$toc-context"/>
+ <xsl:with-param name="nodes" select="foo"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="subtoc">
+ <xsl:with-param name="toc-context" select="$toc-context"/>
+ <xsl:with-param name="nodes"
+ select="section|sect1|glossary|bibliography|index
+ |bridgehead[$bridgehead.in.toc != 0]"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
 </xsl:stylesheet>
+
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk