Imported Upstream version 1.57.0
[platform/upstream/boost.git] / tools / boostbook / xsl / html-base.xsl
index 30442b1..022a224 100644 (file)
@@ -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>
@@ -138,9 +140,9 @@ set       toc,title
   <xsl:template name="format.svn.revision">
     <xsl:param name="text"/>
 
-    <!-- Remove the "$Date: " -->
+    <!-- Remove the "$Date: " or "$Date:: " -->
     <xsl:variable name="text.noprefix"
-      select="substring-after($text, '$Date: ')"/>
+      select="substring-after($text, ': ')"/>
 
     <!-- Grab the year -->
     <xsl:variable name="year" select="substring-before($text.noprefix, '-')"/>
@@ -182,8 +184,10 @@ set       toc,title
       </xsl:choose>
     </xsl:variable>
 
-    <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
-                                 $time, ' ', $timezone)"/>
+    <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year)"/>
+    <xsl:if test="$time != ''">
+      <xsl:value-of select="concat(' at ', $time, ' ', $timezone)"/>
+    </xsl:if>
   </xsl:template>
 
   <!-- Footer Copyright -->
@@ -228,11 +232,14 @@ set       toc,title
               <xsl:value-of
                 select="normalize-space($revision-node/attribute::rev:last-revision)"/>
             </xsl:variable>
-            <xsl:if test="string-length($revision-text) &gt; 0">
+            <xsl:if test="string-length($revision-text) &gt; 0 and not($revision-text = '$Date$')">
               <p>
                 <small>
                   <xsl:text>Last revised: </xsl:text>
                   <xsl:choose>
+                    <xsl:when test="not(contains($revision-text, '$Date: ')) and not(contains($revision-text, '$Date:: '))">
+                      <xsl:value-of select="$revision-text"/>
+                    </xsl:when>
                     <xsl:when test="contains($revision-text, '/')">
                       <xsl:call-template name="format.cvs.revision">
                         <xsl:with-param name="text" select="$revision-text"/>
@@ -380,4 +387,33 @@ set       toc,title
    <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>
+
+