|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63678 - in branches/release/tools/boostbook: . xsl
From: daniel_james_at_[hidden]
Date: 2010-07-05 20:12:04
Author: danieljames
Date: 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
New Revision: 63678
URL: http://svn.boost.org/trac/boost/changeset/63678
Log:
Merge boostbook (mostly by Steven Watanabe).
* New faster highlighter.
* Optimized namelookup.
* Separate out some of the common html xsl (supports Boost.Test docs).
* Tweaks to optimize boostbook to html conversion.
* Bug in cxx-name-lookup.
* Use images under doc/src.
Added:
branches/release/tools/boostbook/xsl/html-base.xsl
- copied, changed from r62079, /trunk/tools/boostbook/xsl/html-base.xsl
Properties modified:
branches/release/tools/boostbook/ (props changed)
Text files modified:
branches/release/tools/boostbook/xsl/admon.xsl | 4
branches/release/tools/boostbook/xsl/annotation.xsl | 8
branches/release/tools/boostbook/xsl/callout.xsl | 4
branches/release/tools/boostbook/xsl/chunk-common.xsl | 11
branches/release/tools/boostbook/xsl/docbook.xsl | 18 -
branches/release/tools/boostbook/xsl/fo.xsl | 45 +++
branches/release/tools/boostbook/xsl/function.xsl | 145 ++++++++---
branches/release/tools/boostbook/xsl/global.xsl | 8
branches/release/tools/boostbook/xsl/html-base.xsl | 19 +
branches/release/tools/boostbook/xsl/html-single.xsl | 1
branches/release/tools/boostbook/xsl/html.xsl | 320 +--------------------------
branches/release/tools/boostbook/xsl/lookup.xsl | 328 +++++++++++-----------------
branches/release/tools/boostbook/xsl/navbar.xsl | 7
branches/release/tools/boostbook/xsl/reference.xsl | 86 +++++++
branches/release/tools/boostbook/xsl/source-highlight.xsl | 461 ++++++++++++++++++++++++++++++++-------
branches/release/tools/boostbook/xsl/template.xsl | 161 ++++++++++++-
branches/release/tools/boostbook/xsl/type.xsl | 151 ++++++++----
branches/release/tools/boostbook/xsl/xhtml.xsl | 319 +--------------------------
18 files changed, 1055 insertions(+), 1041 deletions(-)
Modified: branches/release/tools/boostbook/xsl/admon.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/admon.xsl (original)
+++ branches/release/tools/boostbook/xsl/admon.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -10,7 +10,9 @@
version="1.0">
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/admon.xsl"/>
-<xsl:import href="relative-href.xsl"/>
+
+<!-- Already included in the main style sheet -->
+<!-- <xsl:import href="relative-href.xsl"/> -->
<xsl:template name="admon.graphic">
<xsl:param name="node" select="."/>
Modified: branches/release/tools/boostbook/xsl/annotation.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/annotation.xsl (original)
+++ branches/release/tools/boostbook/xsl/annotation.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -374,6 +374,14 @@
</xsl:choose>
</xsl:template>
+ <xsl:template match="programlisting" mode="annotation">
+ <programlisting>
+ <xsl:apply-templates mode="annotation">
+ <xsl:with-param name="highlight" select="true()"/>
+ </xsl:apply-templates>
+ </programlisting>
+ </xsl:template>
+
<xsl:template match="code" mode="annotation">
<computeroutput>
<xsl:apply-templates mode="annotation"/>
Modified: branches/release/tools/boostbook/xsl/callout.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/callout.xsl (original)
+++ branches/release/tools/boostbook/xsl/callout.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -10,7 +10,9 @@
version="1.0">
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/callout.xsl"/>
-<xsl:import href="relative-href.xsl"/>
+
+<!-- Already included in the main style sheet -->
+<!-- <xsl:import href="relative-href.xsl"/> -->
<xsl:template name="callout-bug">
<xsl:param name="conum" select='1'/>
Modified: branches/release/tools/boostbook/xsl/chunk-common.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/chunk-common.xsl (original)
+++ branches/release/tools/boostbook/xsl/chunk-common.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -10,10 +10,14 @@
version="1.0">
<!-- Import the HTML chunking stylesheet -->
+
+<!-- Watch out that we don't override chunk.xsl -->
+<!--
<xsl:import
- href="http://docbook.sourceforge.net/release/xsl/current/html/chunk-common.xsl"/>
+ href="http://docbook.sourceforge.net/release/xsl/current/html/chunk-common.xsl"/> -->
-<xsl:import href="relative-href.xsl"/>
+<!-- Already included in the main stylesheet -->
+<!-- <xsl:import href="relative-href.xsl"/> -->
<!-- ==================================================================== -->
@@ -64,6 +68,9 @@
</xsl:variable>
<xsl:choose>
+ <xsl:when test="$navtext = 'xxx'">
+ <xsl:value-of select="$direction"/>
+ </xsl:when>
<xsl:when test="$navig.graphics != 0">
<img>
<xsl:attribute name="src">
Modified: branches/release/tools/boostbook/xsl/docbook.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/docbook.xsl (original)
+++ branches/release/tools/boostbook/xsl/docbook.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -180,24 +180,6 @@
<xsl:copy-of select="."/>
</xsl:template>
- <!-- Syntax highlighting -->
- <xsl:template name="highlight-keyword">
- <xsl:param name="keyword"/>
- <xsl:choose>
- <xsl:when test="$boost.syntax.highlight='1'">
- <emphasis role="bold"><xsl:value-of select="$keyword"/></emphasis>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$keyword"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="highlight-comment">
- <xsl:param name="text"/>
- <emphasis><xsl:copy-of select="$text"/></emphasis>
- </xsl:template>
-
<xsl:template name="monospaced">
<xsl:param name="text"/>
<computeroutput><xsl:value-of select="$text"/></computeroutput>
Modified: branches/release/tools/boostbook/xsl/fo.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/fo.xsl (original)
+++ branches/release/tools/boostbook/xsl/fo.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -129,31 +129,58 @@
-->
-<xsl:template match="//programlisting/phrase[@role='keyword']">
+<xsl:template match="//phrase[@role='keyword' and
+ (ancestor::programlisting or
+ ancestor::synopsis or
+ ancestor::literallayout)]">
<fo:inline color="#0000AA"><xsl:apply-templates/></fo:inline>
</xsl:template>
-<xsl:template match="//programlisting/phrase[@role='special']">
+<xsl:template match="//phrase[@role='special' and
+ (ancestor::programlisting or
+ ancestor::synopsis or
+ ancestor::literallayout)]">
<fo:inline color="#707070"><xsl:apply-templates/></fo:inline>
</xsl:template>
-<xsl:template match="//programlisting/phrase[@role='preprocessor']">
+<xsl:template match="//phrase[@role='preprocessor' and
+ (ancestor::programlisting or
+ ancestor::synopsis or
+ ancestor::literallayout)]">
<fo:inline color="#402080"><xsl:apply-templates/></fo:inline>
</xsl:template>
-<xsl:template match="//programlisting/phrase[@role='char']">
+<xsl:template match="//phrase[@role='char' and
+ (ancestor::programlisting or
+ ancestor::synopsis or
+ ancestor::literallayout)]">
<fo:inline color="teal"><xsl:apply-templates/></fo:inline>
</xsl:template>
-<xsl:template match="//programlisting/phrase[@role='comment']">
+<xsl:template match="//phrase[@role='comment' and
+ (ancestor::programlisting or
+ ancestor::synopsis or
+ ancestor::literallayout)]">
<fo:inline color="#800000"><xsl:apply-templates/></fo:inline>
</xsl:template>
-<xsl:template match="//programlisting/phrase[@role='string']">
+<xsl:template match="//phrase[@role='string' and
+ (ancestor::programlisting or
+ ancestor::synopsis or
+ ancestor::literallayout)]">
<fo:inline color="teal"><xsl:apply-templates/></fo:inline>
</xsl:template>
-<xsl:template match="//programlisting/phrase[@role='number']">
+<xsl:template match="//phrase[@role='number' and
+ (ancestor::programlisting or
+ ancestor::synopsis or
+ ancestor::literallayout)]">
<fo:inline color="teal"><xsl:apply-templates/></fo:inline>
</xsl:template>
-<xsl:template match="//programlisting/phrase[@role='white_bkd']">
+<xsl:template match="//phrase[@role='white_bkd' and
+ (ancestor::programlisting or
+ ancestor::synopsis or
+ ancestor::literallayout)]">
<fo:inline color="#FFFFFF"><xsl:apply-templates/></fo:inline>
</xsl:template>
-<xsl:template match="//programlisting/phrase[@role='dk_grey_bkd']">
+<xsl:template match="//phrase[@role='dk_grey_bkd' and
+ (ancestor::programlisting or
+ ancestor::synopsis or
+ ancestor::literallayout)]">
<fo:inline color="#999999"><xsl:apply-templates/></fo:inline>
</xsl:template>
Modified: branches/release/tools/boostbook/xsl/function.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/function.xsl (original)
+++ branches/release/tools/boostbook/xsl/function.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -161,7 +161,7 @@
<!-- Build the text that follows the declarator-->
<xsl:variable name="postdeclarator">
- <xsl:if test="@cv">
+ <xsl:if test="@cv and @cv != ''">
<xsl:text> </xsl:text>
<xsl:value-of select="@cv"/>
</xsl:if>
@@ -246,7 +246,9 @@
<xsl:with-param name="highlight" select="true()"/>
</xsl:call-template>
- <xsl:text>(</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="'('"/>
+ </xsl:call-template>
<xsl:call-template name="function-parameters">
<xsl:with-param name="include-names" select="$include-names"/>
<xsl:with-param name="indentation"
@@ -254,12 +256,16 @@
+ string-length($function-name) + 1"/>
<xsl:with-param name="final" select="true()"/>
</xsl:call-template>
- <xsl:text>)</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="')'"/>
+ </xsl:call-template>
<xsl:call-template name="source-highlight">
<xsl:with-param name="text" select="$postdeclarator"/>
</xsl:call-template>
- <xsl:text>;</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="';'"/>
+ </xsl:call-template>
</xsl:when>
<!-- This declaration will take multiple lines -->
@@ -317,7 +323,9 @@
<xsl:with-param name="link-type" select="$link-type"/>
<xsl:with-param name="highlight" select="true()"/>
</xsl:call-template>
- <xsl:text>(</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="'('"/>
+ </xsl:call-template>
<xsl:call-template name="function-parameters">
<xsl:with-param name="include-names" select="$include-names"/>
<xsl:with-param name="indentation"
@@ -325,11 +333,15 @@
+ string-length($function-name) + 1"/>
<xsl:with-param name="final" select="true()"/>
</xsl:call-template>
- <xsl:text>)</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="')'"/>
+ </xsl:call-template>
<xsl:call-template name="source-highlight">
<xsl:with-param name="text" select="$postdeclarator"/>
</xsl:call-template>
- <xsl:text>;</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="';'"/>
+ </xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@@ -364,7 +376,18 @@
<!-- Information for this parameter -->
<xsl:variable name="parameter" select="$parameters[position()=1]"/>
<xsl:variable name="pack">
- <xsl:if test="$parameter/@pack=1"><xsl:text>...</xsl:text></xsl:if>
+ <xsl:if test="$parameter/@pack=1">
+ <xsl:choose>
+ <xsl:when test="$final">
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="'...'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>...</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
</xsl:variable>
<xsl:variable name="name">
<xsl:if test="$include-names and $parameter/@name != ''">
@@ -377,18 +400,32 @@
<xsl:variable name="default">
<xsl:choose>
<xsl:when test="$parameter/@default">
- <xsl:text> = </xsl:text>
- <xsl:value-of select="$parameter/@default"/>
+ <xsl:choose>
+ <xsl:when test="$final">
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="concat(' = ', $parameter/@default)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> = </xsl:text>
+ <xsl:value-of select="$parameter/@default"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:when>
<xsl:when test="$parameter/default">
- <xsl:text> = </xsl:text>
<xsl:choose>
<xsl:when test="$final">
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="' = '"/>
+ </xsl:call-template>
<xsl:apply-templates
select="$parameter/default/*|$parameter/default/text()"
- mode="annotation"/>
+ mode="annotation">
+ <xsl:with-param name="highlight" select="true()"/>
+ </xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
+ <xsl:text> = </xsl:text>
<xsl:value-of select="string($parameter/default)"/>
</xsl:otherwise>
</xsl:choose>
@@ -407,13 +444,15 @@
or not($wrap)">
<xsl:choose>
<xsl:when test="$final">
- <xsl:value-of select="$prefix"/>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="$prefix"/>
+ </xsl:call-template>
<xsl:apply-templates
select="$parameter/paramtype/*|$parameter/paramtype/text()"
mode="annotation">
<xsl:with-param name="highlight" select="true()"/>
</xsl:apply-templates>
- <xsl:value-of select="$pack"/>
+ <xsl:copy-of select="$pack"/>
<xsl:value-of select="$name"/>
<xsl:copy-of select="$default"/>
</xsl:when>
@@ -437,7 +476,17 @@
<!-- Parameter goes on next line -->
<xsl:otherwise>
<!-- The comma goes on this line -->
- <xsl:value-of select="$prefix"/><xsl:text> </xsl:text>
+ <xsl:choose>
+ <xsl:when test="$final">
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="$prefix"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$prefix"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text> </xsl:text>
<!-- Indent and print the parameter -->
<xsl:call-template name="indent">
@@ -450,9 +499,9 @@
mode="annotation">
<xsl:with-param name="highlight" select="true()"/>
</xsl:apply-templates>
- <xsl:value-of select="$pack"/>
+ <xsl:copy-of select="$pack"/>
<xsl:value-of select="$name"/>
- <xsl:value-of select="$default"/>
+ <xsl:copy-of select="$default"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($prefix, $text)"/>
@@ -605,16 +654,18 @@
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
- <emphasis>
- <xsl:text>// </xsl:text>
- <xsl:call-template name="internal-link">
- <xsl:with-param name="to">
- <xsl:call-template name="generate.id"/>
- <xsl:text>construct-copy-destruct</xsl:text>
- </xsl:with-param>
- <xsl:with-param name="text" select="'construct/copy/destruct'"/>
- </xsl:call-template>
- </emphasis>
+ <xsl:call-template name="highlight-comment">
+ <xsl:with-param name="text">
+ <xsl:text>// </xsl:text>
+ <xsl:call-template name="internal-link">
+ <xsl:with-param name="to">
+ <xsl:call-template name="generate.id"/>
+ <xsl:text>construct-copy-destruct</xsl:text>
+ </xsl:with-param>
+ <xsl:with-param name="text" select="'construct/copy/destruct'"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
<xsl:apply-templates select="constructor" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
@@ -1034,15 +1085,17 @@
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
- <emphasis>
- <xsl:text>// </xsl:text>
- <xsl:call-template name="internal-link">
- <xsl:with-param name="to">
- <xsl:call-template name="generate.id"/>
- </xsl:with-param>
- <xsl:with-param name="text" select="string(@name)"/>
- </xsl:call-template>
- </emphasis>
+ <xsl:call-template name="highlight-comment">
+ <xsl:with-param name="text">
+ <xsl:text>// </xsl:text>
+ <xsl:call-template name="internal-link">
+ <xsl:with-param name="to">
+ <xsl:call-template name="generate.id"/>
+ </xsl:with-param>
+ <xsl:with-param name="text" select="string(@name)"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
<xsl:apply-templates select="method|overloaded-method"
mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
@@ -1088,15 +1141,17 @@
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
- <emphasis>
- <xsl:text>// </xsl:text>
- <xsl:call-template name="internal-link">
- <xsl:with-param name="to">
- <xsl:call-template name="generate.id"/>
- </xsl:with-param>
- <xsl:with-param name="text" select="string(@name)"/>
- </xsl:call-template>
- </emphasis>
+ <xsl:call-template name="highlight-comment">
+ <xsl:with-param name="text">
+ <xsl:text>// </xsl:text>
+ <xsl:call-template name="internal-link">
+ <xsl:with-param name="to">
+ <xsl:call-template name="generate.id"/>
+ </xsl:with-param>
+ <xsl:with-param name="text" select="string(@name)"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
<xsl:apply-templates select="function|overloaded-function" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
Modified: branches/release/tools/boostbook/xsl/global.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/global.xsl (original)
+++ branches/release/tools/boostbook/xsl/global.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -57,7 +57,9 @@
</xsl:call-template>
<xsl:text> </xsl:text>
</xsl:if>
- <xsl:apply-templates select="type/*|type/text()" mode="annotation" />
+ <xsl:apply-templates select="type/*|type/text()" mode="annotation">
+ <xsl:with-param name="highlight" select="true()"/>
+ </xsl:apply-templates>
<xsl:text> </xsl:text>
<xsl:call-template name="link-or-anchor">
<xsl:with-param name="to">
@@ -66,7 +68,9 @@
<xsl:with-param name="text" select="@name" />
<xsl:with-param name="link-type" select="$link-type" />
</xsl:call-template>
- <xsl:text>;</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="';'"/>
+ </xsl:call-template>
</xsl:template>
<xsl:template match="data-member" mode="generate.id">
<xsl:call-template name="fully-qualified-id">
Copied: branches/release/tools/boostbook/xsl/html-base.xsl (from r62079, /trunk/tools/boostbook/xsl/html-base.xsl)
==============================================================================
--- /trunk/tools/boostbook/xsl/html-base.xsl (original)
+++ branches/release/tools/boostbook/xsl/html-base.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -21,6 +21,17 @@
</xsl:choose>
</xsl:param>
+ <xsl:param name="boost.graphics.root">
+ <xsl:choose>
+ <xsl:when test = "$boost.defaults = 'Boost'">
+ <xsl:value-of select = "concat($boost.root, '/doc/src/images/')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select = "'images/'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+
<xsl:param name="admon.style"/>
<xsl:param name="admon.graphics">1</xsl:param>
<xsl:param name="boostbook.verbose" select="0"/>
@@ -39,12 +50,10 @@
<xsl:param name="chunk.quietly" select="not(number($boostbook.verbose))"/>
<xsl:param name="toc.max.depth">2</xsl:param>
<xsl:param name="callout.graphics.number.limit">15</xsl:param>
- <xsl:param name = "admon.graphics.path"
- select = "concat($boost.root, '/doc/html/images/')"/>
- <xsl:param name = "navig.graphics.path"
- select = "concat($boost.root, '/doc/html/images/')"/>
+ <xsl:param name = "admon.graphics.path" select="$boost.graphics.root" />
+ <xsl:param name = "navig.graphics.path" select="$boost.graphics.root" />
<xsl:param name = "callout.graphics.path"
- select = "concat($boost.root, '/doc/src/images/callouts/')"/>
+ select = "concat($boost.graphics.root, 'callouts/')"/>
<xsl:param name="admon.style">
Modified: branches/release/tools/boostbook/xsl/html-single.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/html-single.xsl (original)
+++ branches/release/tools/boostbook/xsl/html-single.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -14,6 +14,7 @@
<xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
<xsl:import href="admon.xsl"/>
+ <xsl:import href="relative-href.xsl"/>
<xsl:param name="admon.style"/>
<xsl:param name="admon.graphics">1</xsl:param>
Modified: branches/release/tools/boostbook/xsl/html.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/html.xsl (original)
+++ branches/release/tools/boostbook/xsl/html.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -16,308 +16,22 @@
<xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/html/math.xsl"/>
- <xsl:import href="chunk-common.xsl"/>
- <xsl:import href="docbook-layout.xsl"/>
- <xsl:import href="navbar.xsl"/>
- <xsl:import href="admon.xsl"/>
- <xsl:import href="xref.xsl"/>
- <xsl:import href="relative-href.xsl"/>
- <xsl:import href="callout.xsl"/>
-
- <xsl:param name="html.stylesheet">
- <xsl:choose>
- <xsl:when test = "$boost.defaults = 'Boost'">
- <xsl:value-of select = "concat($boost.root, '/doc/src/boostbook.css')"/>
- </xsl:when>
- <xsl:otherwise>
- boostbook.css
- </xsl:otherwise>
- </xsl:choose>
- </xsl:param>
-
- <xsl:param name="admon.style"/>
- <xsl:param name="admon.graphics">1</xsl:param>
- <xsl:param name="boostbook.verbose" select="0"/>
- <xsl:param name="navig.graphics" select="1"/>
- <xsl:param name="navig.graphics.extension" select="'.png'"/>
- <xsl:param name="chapter.autolabel" select="1"/>
- <xsl:param name="use.id.as.filename" select="1"/>
- <xsl:param name="refentry.generate.name" select="0"/>
- <xsl:param name="refentry.generate.title" select="1"/>
- <xsl:param name="make.year.ranges" select="1"/>
- <xsl:param name="generate.manifest" select="1"/>
- <xsl:param name="generate.section.toc.level" select="3"/>
- <xsl:param name="doc.standalone">false</xsl:param>
- <xsl:param name="chunker.output.indent">yes</xsl:param>
- <xsl:param name="chunker.output.encoding">US-ASCII</xsl:param>
- <xsl:param name="chunk.quietly" select="not(number($boostbook.verbose))"/>
- <xsl:param name="toc.max.depth">2</xsl:param>
- <xsl:param name="callout.graphics.number.limit">15</xsl:param>
- <xsl:param name = "admon.graphics.path"
- select = "concat($boost.root, '/doc/html/images/')"/>
- <xsl:param name = "navig.graphics.path"
- select = "concat($boost.root, '/doc/html/images/')"/>
- <xsl:param name = "callout.graphics.path"
- select = "concat($boost.root, '/doc/src/images/callouts/')"/>
-
-
- <xsl:param name="admon.style">
- <!-- Remove the style. Let the CSS do the styling -->
-</xsl:param>
-
-<!-- Always have graphics -->
-<xsl:param name="admon.graphics" select="1"/>
-
- <xsl:param name="generate.toc">
-appendix toc,title
-article/appendix nop
-article toc,title
-book toc,title
-chapter toc,title
-part toc,title
-preface toc,title
-qandadiv toc
-qandaset toc
-reference toc,title
-sect1 toc
-sect2 toc
-sect3 toc
-sect4 toc
-sect5 toc
-section toc
-set toc,title
- </xsl:param>
-
-
- <xsl:template name="format.cvs.revision">
- <xsl:param name="text"/>
-
- <!-- Remove the "$Date: " -->
- <xsl:variable name="text.noprefix"
- select="substring-after($text, '$Date: ')"/>
-
- <!-- Grab the year -->
- <xsl:variable name="year" select="substring-before($text.noprefix, '/')"/>
- <xsl:variable name="text.noyear"
- select="substring-after($text.noprefix, '/')"/>
-
- <!-- Grab the month -->
- <xsl:variable name="month" select="substring-before($text.noyear, '/')"/>
- <xsl:variable name="text.nomonth"
- select="substring-after($text.noyear, '/')"/>
-
- <!-- Grab the year -->
- <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
- <xsl:variable name="text.noday"
- select="substring-after($text.nomonth, ' ')"/>
-
- <!-- Get the time -->
- <xsl:variable name="time" select="substring-before($text.noday, ' ')"/>
-
- <xsl:variable name="month.name">
- <xsl:choose>
- <xsl:when test="$month=1">January</xsl:when>
- <xsl:when test="$month=2">February</xsl:when>
- <xsl:when test="$month=3">March</xsl:when>
- <xsl:when test="$month=4">April</xsl:when>
- <xsl:when test="$month=5">May</xsl:when>
- <xsl:when test="$month=6">June</xsl:when>
- <xsl:when test="$month=7">July</xsl:when>
- <xsl:when test="$month=8">August</xsl:when>
- <xsl:when test="$month=9">September</xsl:when>
- <xsl:when test="$month=10">October</xsl:when>
- <xsl:when test="$month=11">November</xsl:when>
- <xsl:when test="$month=12">December</xsl:when>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
- $time, ' GMT')"/>
- </xsl:template>
-
-
- <xsl:template name="format.svn.revision">
- <xsl:param name="text"/>
-
- <!-- Remove the "$Date: " -->
- <xsl:variable name="text.noprefix"
- select="substring-after($text, '$Date: ')"/>
-
- <!-- Grab the year -->
- <xsl:variable name="year" select="substring-before($text.noprefix, '-')"/>
- <xsl:variable name="text.noyear"
- select="substring-after($text.noprefix, '-')"/>
-
- <!-- Grab the month -->
- <xsl:variable name="month" select="substring-before($text.noyear, '-')"/>
- <xsl:variable name="text.nomonth"
- select="substring-after($text.noyear, '-')"/>
-
- <!-- Grab the year -->
- <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
- <xsl:variable name="text.noday"
- select="substring-after($text.nomonth, ' ')"/>
-
- <!-- Get the time -->
- <xsl:variable name="time" select="substring-before($text.noday, ' ')"/>
- <xsl:variable name="text.notime"
- select="substring-after($text.noday, ' ')"/>
-
- <!-- Get the timezone -->
- <xsl:variable name="timezone" select="substring-before($text.notime, ' ')"/>
-
- <xsl:variable name="month.name">
- <xsl:choose>
- <xsl:when test="$month=1">January</xsl:when>
- <xsl:when test="$month=2">February</xsl:when>
- <xsl:when test="$month=3">March</xsl:when>
- <xsl:when test="$month=4">April</xsl:when>
- <xsl:when test="$month=5">May</xsl:when>
- <xsl:when test="$month=6">June</xsl:when>
- <xsl:when test="$month=7">July</xsl:when>
- <xsl:when test="$month=8">August</xsl:when>
- <xsl:when test="$month=9">September</xsl:when>
- <xsl:when test="$month=10">October</xsl:when>
- <xsl:when test="$month=11">November</xsl:when>
- <xsl:when test="$month=12">December</xsl:when>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
- $time, ' ', $timezone)"/>
- </xsl:template>
-
- <!-- Footer Copyright -->
- <xsl:template match="copyright" mode="boost.footer">
- <xsl:if test="position() > 1">
- <br/>
- </xsl:if>
- <xsl:call-template name="gentext">
- <xsl:with-param name="key" select="'Copyright'"/>
- </xsl:call-template>
- <xsl:call-template name="gentext.space"/>
- <xsl:call-template name="dingbat">
- <xsl:with-param name="dingbat">copyright</xsl:with-param>
- </xsl:call-template>
- <xsl:call-template name="gentext.space"/>
- <xsl:call-template name="copyright.years">
- <xsl:with-param name="years" select="year"/>
- <xsl:with-param name="print.ranges" select="$make.year.ranges"/>
- <xsl:with-param name="single.year.ranges"
- select="$make.single.year.ranges"/>
- </xsl:call-template>
- <xsl:call-template name="gentext.space"/>
- <xsl:apply-templates select="holder" mode="titlepage.mode"/>
- </xsl:template>
-
- <!-- Footer License -->
- <xsl:template match="legalnotice" mode="boost.footer">
- <xsl:apply-templates select="para" mode="titlepage.mode" />
- </xsl:template>
-
- <xsl:template name="user.footer.content">
- <table width="100%">
- <tr>
- <td align="left">
- <xsl:variable name="revision-nodes"
- select="ancestor-or-self::*
- [not (attribute::rev:last-revision='')]"/>
- <xsl:if test="count($revision-nodes) > 0">
- <xsl:variable name="revision-node"
- select="$revision-nodes[last()]"/>
- <xsl:variable name="revision-text">
- <xsl:value-of
- select="normalize-space($revision-node/attribute::rev:last-revision)"/>
- </xsl:variable>
- <xsl:if test="string-length($revision-text) > 0">
- <p>
- <small>
- <xsl:text>Last revised: </xsl:text>
- <xsl:choose>
- <xsl:when test="contains($revision-text, '/')">
- <xsl:call-template name="format.cvs.revision">
- <xsl:with-param name="text" select="$revision-text"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="format.svn.revision">
- <xsl:with-param name="text" select="$revision-text"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </small>
- </p>
- </xsl:if>
- </xsl:if>
- </td>
- <td align="right">
- <div class = "copyright-footer">
- <xsl:apply-templates select="ancestor::*/*/copyright"
- mode="boost.footer"/>
- <xsl:apply-templates select="ancestor::*/*/legalnotice"
- mode="boost.footer"/>
- </div>
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <!-- We don't want refentry's to show up in the TOC because they
- will merely be redundant with the synopsis. -->
- <xsl:template match="refentry" mode="toc"/>
-
- <!-- override the behaviour of some DocBook elements for better
- rendering facilities -->
-
- <xsl:template match = "programlisting[ancestor::informaltable]">
- <pre class = "table-{name(.)}"><xsl:apply-templates/></pre>
- </xsl:template>
-
- <xsl:template match = "refsynopsisdiv">
- <h2 class = "{name(.)}-title">Synopsis</h2>
- <div class = "{name(.)}">
- <xsl:apply-templates/>
- </div>
- </xsl:template>
-
-<!-- ============================================================ -->
-
-<xsl:template name="output.html.stylesheets">
- <xsl:param name="stylesheets" select="''"/>
-
- <xsl:choose>
- <xsl:when test="contains($stylesheets, ' ')">
- <link rel="stylesheet">
- <xsl:attribute name="href">
- <xsl:call-template name="href.target.relative">
- <xsl:with-param name="target" select="substring-before($stylesheets, ' ')"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:if test="$html.stylesheet.type != ''">
- <xsl:attribute name="type">
- <xsl:value-of select="$html.stylesheet.type"/>
- </xsl:attribute>
- </xsl:if>
- </link>
- <xsl:call-template name="output.html.stylesheets">
- <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$stylesheets != ''">
- <link rel="stylesheet">
- <xsl:attribute name="href">
- <xsl:call-template name="href.target.relative">
- <xsl:with-param name="target" select="$stylesheets"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:if test="$html.stylesheet.type != ''">
- <xsl:attribute name="type">
- <xsl:value-of select="$html.stylesheet.type"/>
- </xsl:attribute>
- </xsl:if>
- </link>
- </xsl:when>
- </xsl:choose>
-</xsl:template>
+ <!-- Bring in the fast chunking overrides. There's nothing
+ that we need to override, so include instead of importing it. -->
+ <xsl:include
+ href="http://docbook.sourceforge.net/release/xsl/current/html/chunkfast.xsl"/>
+
+ <!-- We have to make sure that our templates override all
+ docbook templates. Therefore, we include our own templates
+ instead of importing them. In order for this to work,
+ the stylesheets included here cannot also include each other -->
+ <xsl:include href="chunk-common.xsl"/>
+ <xsl:include href="docbook-layout.xsl"/>
+ <xsl:include href="navbar.xsl"/>
+ <xsl:include href="admon.xsl"/>
+ <xsl:include href="xref.xsl"/>
+ <xsl:include href="relative-href.xsl"/>
+ <xsl:include href="callout.xsl"/>
+ <xsl:include href="html-base.xsl"/>
</xsl:stylesheet>
Modified: branches/release/tools/boostbook/xsl/lookup.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/lookup.xsl (original)
+++ branches/release/tools/boostbook/xsl/lookup.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -7,6 +7,7 @@
http://www.boost.org/LICENSE_1_0.txt)
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
version="1.0">
<!-- Maximum length of directory and file names is 31 characters.
@@ -154,40 +155,65 @@
<xsl:template name="build-fully-qualified-name">
<xsl:param name="is.id" select="false()" />
- <!-- The depth of qualified name element that we will print now-->
- <xsl:param name="depth" select="1"/>
-
<!-- Determine the set of ancestor namespaces -->
<xsl:variable name="ancestors"
select="ancestor::namespace|
ancestor::class|ancestor::struct|ancestor::union|
ancestor::class-specialization|ancestor::struct-specialization|ancestor::union-specialization"/>
+ <xsl:for-each select="$ancestors">
+ <xsl:apply-templates select="." mode="fast-print-id-part">
+ <xsl:with-param name="is.id" select="$is.id"/>
+ </xsl:apply-templates>
+ <xsl:choose>
+ <xsl:when test="$is.id"><xsl:text>.</xsl:text></xsl:when>
+ <xsl:otherwise><xsl:text>::</xsl:text></xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:apply-templates select="." mode="fast-print-id-part">
+ <xsl:with-param name="is.id" select="$is.id"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:variable name="elements-with-ids">
+ <xsl:apply-templates select="namespace|class|struct|union|class-specialization|struct-specialization|union-specialization"
+ mode="preprocess-ids"/>
+ </xsl:variable>
+
+ <xsl:variable name="fast-elements" select="exsl:node-set($elements-with-ids)"/>
+
+ <xsl:template match="*" mode="preprocess-ids">
+ <element>
+ <xsl:attribute name="id">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:attribute>
+ <xsl:attribute name="part-id">
+ <xsl:call-template name="print-id-part"/>
+ </xsl:attribute>
+ </element>
+ </xsl:template>
+
+ <xsl:template name="print-id-part">
+ <xsl:apply-templates select="." mode="print-id-part"/>
+ </xsl:template>
+
+ <xsl:template match="*" mode="fast-print-id-part">
+ <xsl:param name="is.id"/>
<xsl:choose>
- <xsl:when test="$depth > count($ancestors)">
- <xsl:apply-templates select="." mode="print-id-part">
- <xsl:with-param name="is.id" select="$is.id"/>
- </xsl:apply-templates>
+ <xsl:when test="not($is.id)">
+ <xsl:apply-templates select="." mode="print-name"/>
+ </xsl:when>
+ <xsl:when test="$fast-elements[@id=generate-id()]">
+ <xsl:value-of select="$fast-elements[@id=generate-id()]/@part-id"/>
</xsl:when>
<xsl:otherwise>
- <xsl:if test="name($ancestors[$depth])='namespace' or
- count(ancestor::free-function-group)=0">
- <xsl:apply-templates select="$ancestors[$depth]" mode="print-id-part">
- <xsl:with-param name="is.id" select="$is.id"/>
- </xsl:apply-templates>
- <xsl:choose>
- <xsl:when test="$is.id"><xsl:text>.</xsl:text></xsl:when>
- <xsl:otherwise><xsl:text>::</xsl:text></xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- <xsl:call-template name="build-fully-qualified-name">
+ <xsl:apply-templates select="." mode="print-id-part">
<xsl:with-param name="is.id" select="$is.id"/>
- <xsl:with-param name="depth" select="$depth + 1"/>
- </xsl:call-template>
+ </xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
-
+
<!-- Print the part of a fully qualified name for a single element -->
<xsl:template match="*" mode="print-id-part">
<xsl:param name="is.id"/>
@@ -252,167 +278,81 @@
<xsl:apply-templates select="specialization/template-arg" mode="print-name"/>
<xsl:text>></xsl:text>
</xsl:template>
+
+ <xsl:template name="concat-directives">
+ <xsl:param name="directives"/>
+ <xsl:for-each select="$directives">
+ <xsl:apply-templates select="." mode="print-name"/>
+ <xsl:text>::</xsl:text>
+ </xsl:for-each>
+ </xsl:template>
- <xsl:template name="name-matches-node">
+ <xsl:template name="find-nodes-matching-name">
<!-- The name we are looking for -->
<xsl:param name="name"/>
- <!-- The name to display -->
- <xsl:param name="display-name" select="$name"/>
-
<!-- The context in which this name occurs -->
<xsl:param name="context"/>
<!-- The node that we are checking against -->
- <xsl:param name="node"/>
-
- <!-- The mode we are in. Can be one of:
- matches: emits the matches as they are found (for debugging)
- link: link to the node that was found
- -->
- <xsl:param name="mode" select="'matches'"/>
-
- <!-- The index into the list of using directives for the context node -->
- <xsl:param name="index" select="1"/>
-
- <!-- The prefix we should append to the name when checking this node -->
- <xsl:param name="prefix" select="''"/>
-
- <xsl:choose>
- <xsl:when test="count($node) > 1">
- <xsl:variable name="matches">
- <xsl:call-template name="count-matches">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="context" select="$context"/>
- <xsl:with-param name="nodes" select="$node[position() = 1]"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="$matches = 0">
- <xsl:call-template name="name-matches-node">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="display-name" select="$display-name"/>
- <xsl:with-param name="context" select="$context"/>
- <xsl:with-param name="node" select="$node[position() > 1]"/>
- <xsl:with-param name="mode" select="$mode"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="name-matches-node">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="display-name" select="$display-name"/>
- <xsl:with-param name="context" select="$context"/>
- <xsl:with-param name="node" select="$node[position() = 1]"/>
- <xsl:with-param name="mode" select="$mode"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="count($node) = 1">
- <!-- The fully-qualified name of the node we are checking against -->
- <xsl:variable name="fully-qualified-name">
- <xsl:call-template name="fully-qualified-name">
- <xsl:with-param name="node" select="$node"/>
- </xsl:call-template>
- </xsl:variable>
+ <xsl:param name="nodes"/>
- <!-- The set of using directives for this context node -->
- <xsl:variable name="directives"
- select="$context/ancestor::*/using-namespace |
+ <!-- The set of using directives for this context node -->
+ <xsl:variable name="directives"
+ select="$context/ancestor::*/using-namespace |
$context/ancestor::namespace |
$context/ancestor::*/using-class |
$context/ancestor::class |
$context/ancestor::struct"/>
- <!-- The name of the current directive -->
- <xsl:variable name="this-context">
- <xsl:apply-templates select="$directives[$index]" mode="print-name"/>
- </xsl:variable>
-
- <!-- Check if we have a match -->
- <xsl:variable name="have-match"
- select="$fully-qualified-name = concat($prefix, $name)"/>
-
- <xsl:if test="$have-match">
- <xsl:choose>
- <xsl:when test="$mode='matches'">
- Match in namespace ::<xsl:value-of select="$prefix"/>
- </xsl:when>
- <xsl:when test="$mode='link'">
- <xsl:call-template name="internal-link">
- <xsl:with-param name="to">
- <xsl:call-template name="generate.id">
- <xsl:with-param name="node" select="$node"/>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="text" select="$display-name"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:if>
+ <xsl:variable name="directives-str">
+ <xsl:call-template name="concat-directives">
+ <xsl:with-param name="directives" select="$directives"/>
+ </xsl:call-template>
+ </xsl:variable>
- <xsl:if test="(not($index > count($directives))) and
- (not($have-match) or ($mode = 'matches'))">
- <xsl:variable name="first-branch">
- <xsl:if test="not ($prefix = '')">
- <!-- Recurse and append the current context node to the prefix -->
- <xsl:call-template name="name-matches-node">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="display-name" select="$display-name"/>
- <xsl:with-param name="context" select="$context"/>
- <xsl:with-param name="node" select="$node"/>
- <xsl:with-param name="mode" select="$mode"/>
- <xsl:with-param name="index" select="$index + 1"/>
- <xsl:with-param name="prefix"
- select="concat($prefix, $this-context, '::')"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="string($first-branch) != ''">
- <xsl:copy-of select="$first-branch"/>
- </xsl:when>
- <xsl:otherwise>
- <!-- Recurse with just the current context node -->
- <xsl:call-template name="name-matches-node">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="display-name" select="$display-name"/>
- <xsl:with-param name="context" select="$context"/>
- <xsl:with-param name="node" select="$node"/>
- <xsl:with-param name="mode" select="$mode"/>
- <xsl:with-param name="index" select="$index + 1"/>
- <xsl:with-param name="prefix"
- select="concat($this-context, '::')"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:when>
- </xsl:choose>
+ <xsl:apply-templates select="$nodes" mode="generate-cxx-links">
+ <xsl:with-param name="name" select="$name"/>
+ <xsl:with-param name="directives-str" select="$directives-str"/>
+ </xsl:apply-templates>
</xsl:template>
-
- <!-- Count the number of nodes in the set that match the given name and
- lookup context -->
- <xsl:template name="count-matches">
+
+ <xsl:template match="*" mode="generate-cxx-links">
<xsl:param name="name"/>
- <xsl:param name="context"/>
- <xsl:param name="nodes"/>
+ <xsl:param name="directives-str"/>
- <xsl:variable name="match-string">
- <xsl:for-each select="$nodes">
- <xsl:variable name="does-match">
- <xsl:call-template name="name-matches-node">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="context" select="$context"/>
+ <xsl:variable name="node-name">
+ <xsl:call-template name="fully-qualified-name">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="leading-chars"
+ select="string-length($node-name) - string-length($name)"/>
+
+ <!-- Check if this node matches any visible namespace -->
+ <xsl:if test="string-length($node-name) >= string-length($name) and
+ substring($node-name, $leading-chars + 1,
+ string-length($name)) = $name">
+ <xsl:variable name="qualifiers"
+ select="substring($node-name, 1, $leading-chars)"/>
+ <xsl:if test="contains($directives-str, $qualifiers)">
+ <xsl:variable name="myid">
+ <xsl:call-template name="generate.id">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:variable>
- <xsl:if test="not($does-match='')">X</xsl:if>
- </xsl:for-each>
- </xsl:variable>
- <xsl:value-of select="string-length($match-string)"/>
+ <cxx-link-helper>
+ <xsl:attribute name="id">
+ <xsl:value-of select="$myid"/>
+ </xsl:attribute>
+ <xsl:attribute name="namespace">
+ <xsl:value-of select="$qualifiers"/>
+ </xsl:attribute>
+ <xsl:text>random text</xsl:text>
+ </cxx-link-helper>
+ </xsl:if>
+ </xsl:if>
</xsl:template>
<xsl:template name="cxx-link-name">
@@ -433,18 +373,20 @@
<!-- The list of nodes that match the lookup node in both name and type -->
<xsl:param name="nodes"/>
-
- <!-- Count the number of nodes that match -->
- <xsl:variable name="matches">
- <xsl:call-template name="count-matches">
+
+ <!-- Filter the nodes to leave only the ones that are in scope. -->
+ <xsl:variable name="matches1">
+ <xsl:call-template name="find-nodes-matching-name">
<xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="context" select="$lookup"/>
<xsl:with-param name="nodes" select="$nodes"/>
+ <xsl:with-param name="context" select="$lookup"/>
</xsl:call-template>
</xsl:variable>
+
+ <xsl:variable name="matches" select="exsl:node-set($matches1)//cxx-link-helper"/>
<xsl:choose>
- <xsl:when test="$matches = 0">
+ <xsl:when test="count($matches) = 0">
<xsl:message>
<xsl:text>Cannot find </xsl:text>
<xsl:value-of select="$type"/>
@@ -454,39 +396,27 @@
</xsl:message>
<xsl:value-of select="$display-name"/>
</xsl:when>
- <xsl:when test="$matches = 1">
- <xsl:for-each select="$nodes">
- <xsl:call-template name="name-matches-node">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="display-name" select="$display-name"/>
- <xsl:with-param name="context" select="$lookup"/>
- <xsl:with-param name="node" select="."/>
- <xsl:with-param name="mode" select="'link'"/>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:when>
<xsl:otherwise>
- <xsl:message>
- <xsl:text>Reference to </xsl:text>
- <xsl:value-of select="$type"/>
- <xsl:text> '</xsl:text>
- <xsl:value-of select="$name"/>
- <xsl:text>' is ambiguous. Found:</xsl:text>
- <xsl:for-each select="$nodes">
- <xsl:call-template name="name-matches-node">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="context" select="$lookup"/>
- <xsl:with-param name="node" select="."/>
- <xsl:with-param name="mode" select="'matches'"/>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:message>
- <xsl:call-template name="name-matches-node">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="display-name" select="$display-name"/>
- <xsl:with-param name="context" select="$lookup"/>
- <xsl:with-param name="node" select="$nodes"/>
- <xsl:with-param name="mode" select="'link'"/>
+ <!-- If we found more than one, print a message and take the first -->
+ <xsl:if test="count($matches) > 1">
+ <xsl:message>
+ <xsl:text>Reference to </xsl:text>
+ <xsl:value-of select="$type"/>
+ <xsl:text> '</xsl:text>
+ <xsl:value-of select="$name"/>
+ <xsl:text>' is ambiguous. Found:</xsl:text>
+ <xsl:for-each select="$matches">
+ <xsl:text>
+ Match in namespace ::</xsl:text>
+ <xsl:value-of select="@namespace"/>
+ </xsl:for-each>
+ </xsl:message>
+ </xsl:if>
+ <xsl:call-template name="internal-link">
+ <xsl:with-param name="to">
+ <xsl:value-of select="$matches[position() = 1]/@id"/>
+ </xsl:with-param>
+ <xsl:with-param name="text" select="$display-name"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
Modified: branches/release/tools/boostbook/xsl/navbar.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/navbar.xsl (original)
+++ branches/release/tools/boostbook/xsl/navbar.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -9,8 +9,9 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
-<xsl:import href="relative-href.xsl"/>
-
+<!-- Already included in the main style sheet -->
+<!-- <xsl:import href="relative-href.xsl"/> -->
+
<!--
boost.defaults:
*custom - only use explicitly set parameters
@@ -369,7 +370,7 @@
</xsl:call-template>
</a></xsl:if>
<!-- home -->
- <xsl:if test = "$home != . or $nav.context = 'toc'">
+ <xsl:if test = "generate-id($home) != generate-id(.) or $nav.context = 'toc'">
<a accesskey = "h">
<xsl:attribute name = "href"><xsl:call-template name = "href.target">
<xsl:with-param name = "object" select = "$home"/>
Modified: branches/release/tools/boostbook/xsl/reference.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/reference.xsl (original)
+++ branches/release/tools/boostbook/xsl/reference.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -29,9 +29,8 @@
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="source-highlight">
- <xsl:with-param name="text" select="concat('namespace ',@name)"/>
+ <xsl:with-param name="text" select="concat('namespace ',@name, ' {')"/>
</xsl:call-template>
- <xsl:text> {</xsl:text>
<!-- Emit namespace types -->
<xsl:apply-templates select="class|class-specialization|
@@ -58,7 +57,9 @@
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
- <xsl:text>}</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="'}'"/>
+ </xsl:call-template>
</xsl:template>
<!-- Emit namespace synopsis -->
@@ -97,9 +98,71 @@
<xsl:template match="para|section" mode="synopsis"/>
<xsl:template match="para|section" mode="reference"/>
+ <xsl:template name="find-wrap-point">
+ <xsl:param name="text"/>
+ <xsl:param name="prefix"/>
+ <xsl:param name="result" select="0"/>
+ <xsl:param name="default" select="$max-columns - string-length($prefix)"/>
+ <xsl:variable name="s" select="substring($text, 2)"/>
+ <xsl:variable name="candidate">
+ <xsl:choose>
+ <xsl:when test="contains($s, ' ')">
+ <xsl:value-of select="string-length(substring-before($s, ' ')) + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="string-length($text)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($prefix) + $result + $candidate <= $max-columns">
+ <xsl:call-template name="find-wrap-point">
+ <xsl:with-param name="text" select="substring($text, $candidate + 1)"/>
+ <xsl:with-param name="prefix" select="$prefix"/>
+ <xsl:with-param name="result" select="$result + $candidate"/>
+ <xsl:with-param name="default" select="$result + $candidate"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="wrap-comment">
+ <xsl:param name="prefix"/>
+ <xsl:param name="text"/>
+ <xsl:choose>
+ <xsl:when test="string-length($prefix) + string-length($text) <= $max-columns">
+ <xsl:value-of select="$text"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="size">
+ <xsl:call-template name="find-wrap-point">
+ <xsl:with-param name="prefix" select="$prefix"/>
+ <xsl:with-param name="text" select="$text"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring($text, 1, $size)"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$prefix"/>
+ <xsl:call-template name="wrap-comment">
+ <xsl:with-param name="prefix" select="$prefix"/>
+ <xsl:with-param name="text" select="normalize-space(substring($text, $size + 1))"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
<!-- Comment mode tries to wipe out any extra spacing in the output -->
<xsl:template match="purpose" mode="comment">
- <xsl:apply-templates mode="comment"/>
+ <xsl:param name="wrap" select="false()"/>
+ <xsl:param name="prefix"/>
+ <xsl:apply-templates mode="comment">
+ <xsl:with-param name="wrap"
+ select="$wrap and count(*) = 0 and count(text()) = 1"/>
+ <xsl:with-param name="prefix" select="$prefix"/>
+ </xsl:apply-templates>
</xsl:template>
<xsl:template match="simpara|para" mode="comment">
@@ -107,7 +170,20 @@
</xsl:template>
<xsl:template match="text()" mode="comment">
- <xsl:value-of select="."/>
+ <xsl:param name="wrap" select="false()"/>
+ <xsl:param name="prefix"/>
+ <xsl:variable name="stripped" select="normalize-space(.)"/>
+ <xsl:choose>
+ <xsl:when test="$wrap">
+ <xsl:call-template name="wrap-comment">
+ <xsl:with-param name="prefix" select="$prefix"/>
+ <xsl:with-param name="text" select="$stripped"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<xsl:template match="*" mode="comment">
Modified: branches/release/tools/boostbook/xsl/source-highlight.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/source-highlight.xsl (original)
+++ branches/release/tools/boostbook/xsl/source-highlight.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -24,110 +24,405 @@
</xsl:choose>
</xsl:template>
- <!-- Perform C++ keyword highlighting on the given text -->
- <xsl:template name="highlight-text">
- <xsl:param name="text" select="."/>
- <xsl:param name="keywords"
- select="'asm auto bool break case catch char class const const_cast continue default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int long mutable namespace new operator private protected public register reinterpret_cast return short signed sizeof static static_cast struct switch template this throw true try typedef typeid typename union unsigned using virtual void volatile wchar_t while'"/>
- <xsl:param name="best-match" select="''"/>
-
- <!-- Determine the current keyword -->
- <xsl:variable name="keyword">
- <xsl:choose>
- <xsl:when test="contains($keywords, ' ')">
- <xsl:value-of select="substring-before($keywords, ' ')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$keywords"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <!-- Determine the set of keywords that are left -->
- <xsl:variable name="keywords-left">
- <xsl:if test="contains($keywords, ' ')">
- <xsl:value-of select="substring-after($keywords, ' ')"/>
- </xsl:if>
- </xsl:variable>
-
- <!-- The set of characters that can be identifiers -->
- <xsl:variable name="id-chars" select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'"/>
-
- <xsl:variable name="X" select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'"/>
-
- <xsl:choose>
- <!-- Have we exhausted all keywords without finding any to highlight? -->
- <xsl:when test="$keyword='' and $best-match=''">
- <!-- Just copy the text -->
+ <xsl:variable name="id-start-chars" select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_'"/>
+ <xsl:variable name="id-chars" select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_'"/>
+ <xsl:variable name="digits" select="'1234567890'"/>
+ <xsl:variable name="number-chars" select="'1234567890abcdefABCDEFxX.'"/>
+ <xsl:variable name="keywords"
+ select="' asm auto bool break case catch char class const const_cast continue default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int long mutable namespace new operator private protected public register reinterpret_cast return short signed sizeof static static_cast struct switch template this throw true try typedef typeid typename union unsigned using virtual void volatile wchar_t while '"/>
+ <xsl:variable name="operators4" select="'%:%:'"/>
+ <xsl:variable name="operators3" select="'>>= <<= ->* ...'"/>
+ <xsl:variable name="operators2" select="'.* :: ## <: :> <% %> %: += -= *= /= %= ^= &= |= << >> == != <= >= && || ++ -- ->'"/>
+ <xsl:variable name="operators1" select="'. ? { } [ ] # ( ) ; : + - * / % ^ & | ~ ! = < > ,'"/>
+ <xsl:variable name="single-quote">'</xsl:variable>
+
+ <!-- Syntax highlighting -->
+ <xsl:template name="highlight-keyword">
+ <xsl:param name="keyword"/>
+ <xsl:choose>
+ <xsl:when test="$boost.syntax.highlight='1'">
+ <phrase role="keyword">
+ <xsl:value-of select="$keyword"/>
+ </phrase>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$keyword"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="highlight-identifier">
+ <xsl:param name="identifier"/>
+ <xsl:choose>
+ <xsl:when test="contains($keywords, concat(' ', $identifier, ' '))">
+ <xsl:call-template name="highlight-keyword">
+ <xsl:with-param name="keyword" select="$identifier"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$boost.syntax.highlight='1'">
+ <phrase role="identifier">
+ <xsl:value-of select="$identifier"/>
+ </phrase>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$identifier"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="highlight-comment">
+ <xsl:param name="text"/>
+ <xsl:choose>
+ <xsl:when test="$boost.syntax.highlight='1'">
+ <phrase role="comment">
+ <xsl:copy-of select="$text"/>
+ </phrase>
+ </xsl:when>
+ <xsl:otherwise>
<xsl:copy-of select="$text"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="highlight-special">
+ <xsl:param name="text"/>
+ <xsl:choose>
+ <xsl:when test="$boost.syntax.highlight='1'">
+ <phrase role="special">
+ <xsl:value-of select="$text"/>
+ </phrase>
</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
- <!-- Have we exhausted all keywords, but have one to highlight? If so,
- make sure we didn't just find part of an identifier. -->
- <xsl:when
- test="$keyword='' and
- not (starts-with(translate(substring-after($text, $best-match),
- $id-chars, $X), 'X')) and
- not (substring(translate(substring-before($text, $best-match),
- $id-chars, $X),
- string-length(substring-before($text,
- $best-match)),
- 1) = 'X')">
- <!-- Copy text before this keyword -->
- <xsl:value-of select="substring-before($text, $best-match)"/>
+ <xsl:template name="highlight-number">
+ <xsl:param name="text"/>
+ <xsl:choose>
+ <xsl:when test="$boost.syntax.highlight='1'">
+ <phrase role="number">
+ <xsl:value-of select="$text"/>
+ </phrase>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
- <!-- Highlight the keyword -->
- <xsl:call-template name="highlight-keyword">
- <xsl:with-param name="keyword" select="$best-match"/>
+ <xsl:template name="highlight-string">
+ <xsl:param name="text"/>
+ <xsl:choose>
+ <xsl:when test="$boost.syntax.highlight='1'">
+ <phrase role="string">
+ <xsl:value-of select="$text"/>
+ </phrase>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="highlight-char">
+ <xsl:param name="text"/>
+ <xsl:choose>
+ <xsl:when test="$boost.syntax.highlight='1'">
+ <phrase role="char">
+ <xsl:value-of select="$text"/>
+ </phrase>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="highlight-pp-directive">
+ <xsl:param name="text"/>
+ <xsl:choose>
+ <xsl:when test="$boost.syntax.highlight='1'">
+ <phrase role="preprocessor">
+ <xsl:value-of select="$text"/>
+ </phrase>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="highlight-text-ident-length">
+ <xsl:param name="text"/>
+ <xsl:param name="pos" select="1"/>
+ <xsl:choose>
+ <xsl:when test="string-length($text) + 1 = $pos">
+ <xsl:value-of select="$pos - 1"/>
+ </xsl:when>
+ <xsl:when test="contains($id-chars, substring($text, $pos, 1))">
+ <xsl:call-template name ="highlight-text-ident-length">
+ <xsl:with-param name="text" select="$text"/>
+ <xsl:with-param name="pos" select="$pos + 1"/>
</xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$pos - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="highlight-text-number-length">
+ <xsl:param name="text"/>
+ <xsl:param name="pos" select="1"/>
+ <xsl:choose>
+ <xsl:when test="string-length($text) + 1 = $pos">
+ <xsl:value-of select="$pos - 1"/>
+ </xsl:when>
+ <xsl:when test="contains($number-chars, substring($text, $pos, 1))">
+ <xsl:call-template name ="highlight-text-ident-length">
+ <xsl:with-param name="text" select="$text"/>
+ <xsl:with-param name="pos" select="$pos + 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$pos - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
- <!-- Recurse on the rest of the text -->
- <xsl:call-template name="highlight-text">
- <xsl:with-param name="text"
- select="substring-after($text, $best-match)"/>
+ <xsl:template name="highlight-text-string-length">
+ <xsl:param name="text"/>
+ <xsl:param name="terminator"/>
+ <xsl:param name="pos" select="2"/>
+ <xsl:choose>
+ <xsl:when test="string-length($text) + 1 = $pos">
+ <xsl:value-of select="$pos - 1"/>
+ </xsl:when>
+ <xsl:when test="substring($text, $pos, 1) = $terminator">
+ <xsl:value-of select="$pos"/>
+ </xsl:when>
+ <xsl:when test="substring($text, $pos, 1) = '\' and
+ string-length($text) != $pos">
+ <xsl:call-template name="highlight-text-string-length">
+ <xsl:with-param name="text" select="$text"/>
+ <xsl:with-param name="terminator" select="$terminator"/>
+ <xsl:with-param name="pos" select="$pos + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="highlight-text-string-length">
+ <xsl:with-param name="text" select="$text"/>
+ <xsl:with-param name="terminator" select="$terminator"/>
+ <xsl:with-param name="pos" select="$pos + 1"/>
</xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="highlight-text-operator-length">
+ <xsl:param name="text"/>
+ <xsl:choose>
+ <xsl:when test="string-length($text) >= 4 and
+ not(contains(substring($text, 1, 4), ' ')) and
+ contains($operators4, substring($text, 1, 4))">
+ <xsl:value-of select="4"/>
+ </xsl:when>
+ <xsl:when test="string-length($text) >= 3 and
+ not(contains(substring($text, 1, 3), ' ')) and
+ contains($operators3, substring($text, 1, 3))">
+ <xsl:value-of select="3"/>
+ </xsl:when>
+ <xsl:when test="string-length($text) >= 2 and
+ not(contains(substring($text, 1, 2), ' ')) and
+ contains($operators2, substring($text, 1, 2))">
+ <xsl:value-of select="2"/>
+ </xsl:when>
+ <xsl:when test="string-length($text) >= 1 and
+ not(contains(substring($text, 1, 1), ' ')) and
+ contains($operators1, substring($text, 1, 1))">
+ <xsl:value-of select="1"/>
</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
- <!-- We thought we had a keyword to highlight, but it was part of an
- identifier. So output all of the text up to (but not including!)
- the last letter of the identifier, and try again to
- highlight. -->
- <xsl:when test="$keyword=''">
- <xsl:value-of select="substring-before($text, $best-match)"/>
- <xsl:value-of
- select="substring($best-match, 1, string-length($best-match)-1)"/>
- <xsl:call-template name="highlight-text">
- <xsl:with-param name="text"
- select="concat(substring($best-match, string-length($best-match),
- 1), substring-after($text, $best-match))"/>
+ <xsl:template name="highlight-text-pp-directive-length">
+ <xsl:param name="text"/>
+ <!-- Assume that the first character is a # -->
+ <xsl:param name="pos" select="2"/>
+ <xsl:choose>
+ <xsl:when test="contains($id-chars, substring($text, $pos, 1))">
+ <xsl:call-template name="highlight-text-ident-length">
+ <xsl:with-param name="text" select="$text"/>
+ <xsl:with-param name="pos" select="$pos + 1"/>
</xsl:call-template>
</xsl:when>
-
- <!-- Does the text contain this keyword with a better match than we
- previously had? -->
- <xsl:when
- test="contains($text, $keyword) and
- (($best-match = '') or
- (string-length(substring-before($text, $keyword)) <
- string-length(substring-before($text, $best-match))))">
- <!-- Recurse with the current keyword as the new best match -->
- <xsl:call-template name="highlight-text">
+ <xsl:when test="contains(' 	', substring($text, $pos, 1))">
+ <xsl:call-template name="highlight-text-pp-directive-length">
<xsl:with-param name="text" select="$text"/>
- <xsl:with-param name="keywords" select="$keywords-left"/>
- <xsl:with-param name="best-match" select="$keyword"/>
+ <xsl:with-param name="pos" select="$pos + 1"/>
</xsl:call-template>
</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$pos - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
- <!-- Text does not contain this keyword. Just recurse normally -->
+ <xsl:template name="highlight-text-impl-leading-whitespace">
+ <xsl:param name="text"/>
+ <xsl:choose>
+ <xsl:when test="string-length($text) = 0"/>
+ <xsl:when test="contains(' 

	', substring($text, 1, 1))">
+ <xsl:value-of select="substring($text, 1, 1)"/>
+ <xsl:call-template name="highlight-text-impl-leading-whitespace">
+ <xsl:with-param name="text" select="substring($text, 2)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="'#' = substring($text, 1, 1)">
+ <xsl:variable name="pp-length">
+ <xsl:call-template name="highlight-text-pp-directive-length">
+ <xsl:with-param name="text" select="$text"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="highlight-pp-directive">
+ <xsl:with-param name="text" select="substring($text, 1, $pp-length)"/>
+ </xsl:call-template>
+ <xsl:call-template name="highlight-text-impl-root">
+ <xsl:with-param name="text" select="substring($text, $pp-length + 1)"/>
+ </xsl:call-template>
+ </xsl:when>
<xsl:otherwise>
- <xsl:call-template name="highlight-text">
+ <xsl:call-template name="highlight-text-impl-root">
<xsl:with-param name="text" select="$text"/>
- <xsl:with-param name="keywords" select="$keywords-left"/>
- <xsl:with-param name="best-match" select="$best-match"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+
+ <xsl:template name="highlight-text-impl-root">
+ <xsl:param name="text"/>
+ <xsl:choose>
+ <xsl:when test="string-length($text) = 0"/>
+ <xsl:when test="contains($id-start-chars, substring($text, 1, 1))">
+ <xsl:variable name="ident-length">
+ <xsl:call-template name="highlight-text-ident-length">
+ <xsl:with-param name="text" select="$text"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="highlight-identifier">
+ <xsl:with-param name="identifier" select="substring($text, 1, $ident-length)"/>
+ </xsl:call-template>
+ <xsl:call-template name="highlight-text-impl-root">
+ <xsl:with-param name="text" select="substring($text, $ident-length + 1)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains($digits, substring($text, 1, 1))">
+ <xsl:variable name="number-length">
+ <xsl:call-template name="highlight-text-number-length">
+ <xsl:with-param name="text" select="$text"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="highlight-number">
+ <xsl:with-param name="text" select="substring($text, 1, $number-length)"/>
+ </xsl:call-template>
+ <xsl:call-template name="highlight-text-impl-root">
+ <xsl:with-param name="text" select="substring($text, $number-length + 1)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="substring($text, 1, 1) = '"'">
+ <xsl:variable name="string-length">
+ <xsl:call-template name="highlight-text-string-length">
+ <xsl:with-param name="text" select="$text"/>
+ <xsl:with-param name="terminator" select="'"'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="highlight-string">
+ <xsl:with-param name="text" select="substring($text, 1, $string-length)"/>
+ </xsl:call-template>
+ <xsl:call-template name="highlight-text-impl-root">
+ <xsl:with-param name="text" select="substring($text, $string-length + 1)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="substring($text, 1, 1) = $single-quote">
+ <xsl:variable name="char-length">
+ <xsl:call-template name="highlight-text-string-length">
+ <xsl:with-param name="text" select="$text"/>
+ <xsl:with-param name="terminator" select="$single-quote"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="highlight-char">
+ <xsl:with-param name="text" select="substring($text, 1, $char-length)"/>
+ </xsl:call-template>
+ <xsl:call-template name="highlight-text-impl-root">
+ <xsl:with-param name="text" select="substring($text, $char-length + 1)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="substring($text, 1, 2) = '//'">
+ <xsl:call-template name="highlight-comment">
+ <xsl:with-param name="text" select="substring-before($text, '
')"/>
+ </xsl:call-template>
+ <xsl:call-template name="highlight-text-impl-root">
+ <xsl:with-param name="text" select="concat('
', substring-after($text, '
'))"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="substring($text, 1, 2) = '/*'">
+ <xsl:call-template name="highlight-comment">
+ <xsl:with-param name="text" select="concat(substring-before($text, '*/'), '*/')"/>
+ </xsl:call-template>
+ <xsl:call-template name="highlight-text-impl-root">
+ <xsl:with-param name="text" select="substring-after($text, '*/')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains('

', substring($text, 1, 1))">
+ <xsl:value-of select="substring($text, 1, 1)"/>
+ <xsl:call-template name="highlight-text-impl-leading-whitespace">
+ <xsl:with-param name="text" select="substring($text, 2)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains(' 	', substring($text, 1, 1))">
+ <xsl:value-of select="substring($text, 1, 1)"/>
+ <xsl:call-template name="highlight-text-impl-root">
+ <xsl:with-param name="text" select="substring($text, 2)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="operator-length">
+ <xsl:call-template name="highlight-text-operator-length">
+ <xsl:with-param name="text" select="$text"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$operator-length = 0">
+ <xsl:value-of select="substring($text, 1, 1)"/>
+ <xsl:call-template name="highlight-text-impl-root">
+ <xsl:with-param name="text" select="substring($text, 2)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="highlight-special">
+ <xsl:with-param name="text" select="substring($text, 1, $operator-length)"/>
+ </xsl:call-template>
+ <xsl:call-template name="highlight-text-impl-root">
+ <xsl:with-param name="text" select="substring($text, $operator-length + 1)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Perform C++ syntax highlighting on the given text -->
+ <xsl:template name="highlight-text">
+ <xsl:param name="text" select="."/>
+ <xsl:call-template name="highlight-text-impl-leading-whitespace">
+ <xsl:with-param name="text" select="$text"/>
+ </xsl:call-template>
+ </xsl:template>
<xsl:template match="*" mode="highlight">
<xsl:element name="{name(.)}">
Modified: branches/release/tools/boostbook/xsl/template.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/template.xsl (original)
+++ branches/release/tools/boostbook/xsl/template.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -72,18 +72,31 @@
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="'template'"/>
</xsl:call-template>
+ <xsl:call-template name="highlight-special">
+ <xsl:with-param name="text" select="'<'"/>
+ </xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text>template</xsl:text>
+ <xsl:text><</xsl:text>
</xsl:otherwise>
</xsl:choose>
- <xsl:text><</xsl:text>
<xsl:call-template name="template.synopsis.parameters">
<xsl:with-param name="indentation" select="$indentation + 9"/>
<xsl:with-param name="wrap" select="$wrap"/>
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:call-template>
- <xsl:text>> </xsl:text>
+ <xsl:choose>
+ <xsl:when test="$highlight">
+ <xsl:call-template name="highlight-special">
+ <xsl:with-param name="text" select="'>'"/>
+ </xsl:call-template>
+ <xsl:text> </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<!-- Display a list of template parameters for a synopsis (no comments) -->
@@ -100,7 +113,16 @@
<xsl:if test="$parameters">
<!-- Emit the prefix (either a comma-space, or empty if this is
the first parameter) -->
- <xsl:value-of select="$prefix"/>
+ <xsl:choose>
+ <xsl:when test="$highlight">
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="$prefix"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$prefix"/>
+ </xsl:otherwise>
+ </xsl:choose>
<!-- Get the actual parameter and its attributes -->
<xsl:variable name="parameter" select="$parameters[position()=1]"/>
@@ -179,17 +201,30 @@
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="'template'"/>
</xsl:call-template>
+ <xsl:call-template name="highlight-special">
+ <xsl:with-param name="text" select="'<'"/>
+ </xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text>template</xsl:text>
+ <xsl:text><</xsl:text>
</xsl:otherwise>
</xsl:choose>
- <xsl:text><</xsl:text>
<xsl:call-template name="template.reference.parameters">
<xsl:with-param name="indentation" select="$indentation + 9"/>
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:call-template>
- <xsl:text>> </xsl:text>
+ <xsl:choose>
+ <xsl:when test="$highlight">
+ <xsl:call-template name="highlight-special">
+ <xsl:with-param name="text" select="'>'"/>
+ </xsl:call-template>
+ <xsl:text> </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:if>
</xsl:template>
@@ -236,7 +271,16 @@
</xsl:call-template>
<xsl:if test="$rest">
- <xsl:text>, </xsl:text>
+ <xsl:choose>
+ <xsl:when test="$highlight">
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="', '"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>, </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:if>
<!-- Display the comment -->
@@ -314,7 +358,18 @@
<xsl:text>typename</xsl:text>
</xsl:otherwise>
</xsl:choose>
- <xsl:if test="$parameter/@pack=1"><xsl:text>...</xsl:text></xsl:if>
+ <xsl:if test="$parameter/@pack=1">
+ <xsl:choose>
+ <xsl:when test="$highlight">
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="'...'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>...</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
<xsl:text> </xsl:text>
<xsl:call-template name="template.parameter.name">
@@ -358,7 +413,16 @@
</xsl:variable>
<xsl:if test="not($def='')">
- <xsl:text> = </xsl:text>
+ <xsl:choose>
+ <xsl:when test="$highlight">
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="' = '"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> = </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
<xsl:copy-of select="$def"/>
@@ -389,7 +453,18 @@
<xsl:value-of select="$parameter/type/*|$parameter/type/text()"/>
</xsl:otherwise>
</xsl:choose>
- <xsl:if test="$parameter/@pack=1"><xsl:text>...</xsl:text></xsl:if>
+ <xsl:if test="$parameter/@pack=1">
+ <xsl:choose>
+ <xsl:when test="$highlight">
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="'...'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>...</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
<xsl:text> </xsl:text>
<xsl:call-template name="template.parameter.name">
@@ -402,7 +477,16 @@
</xsl:variable>
<xsl:if test="not($def='')">
- <xsl:text> = </xsl:text>
+ <xsl:choose>
+ <xsl:when test="$highlight">
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="' = '"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> = </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
<xsl:choose>
<xsl:when test="$highlight">
@@ -423,25 +507,72 @@
</xsl:template>
<xsl:template match="template-varargs" mode="print.parameter">
- <xsl:text>...</xsl:text>
+ <xsl:param name="highlight" select="true()"/>
+ <xsl:choose>
+ <xsl:when test="$highlight">
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="'...'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>...</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<xsl:template match="specialization">
<xsl:param name="highlight" select="true()"/>
- <xsl:text><</xsl:text>
+ <xsl:choose>
+ <xsl:when test="$highlight">
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="'<'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text><</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
<xsl:apply-templates select="template-arg">
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:apply-templates>
- <xsl:text>></xsl:text>
+ <xsl:choose>
+ <xsl:when test="$highlight">
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="'>'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>></xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<xsl:template match="template-arg">
+ <xsl:param name="highlight" select="true()"/>
<xsl:if test="position() > 1">
- <xsl:text>, </xsl:text>
+ <xsl:choose>
+ <xsl:when test="$highlight">
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="', '"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>, </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:if>
<xsl:apply-templates mode="highlight"/>
<xsl:if test="@pack=1">
- <xsl:text>...</xsl:text>
+ <xsl:choose>
+ <xsl:when test="$highlight">
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="'...'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>...</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Modified: branches/release/tools/boostbook/xsl/type.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/type.xsl (original)
+++ branches/release/tools/boostbook/xsl/type.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -134,7 +134,9 @@
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:apply-templates select="specialization"/>
- <xsl:text>;</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="';'"/>
+ </xsl:call-template>
</xsl:variable>
<xsl:choose>
@@ -160,7 +162,9 @@
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="specialization"/>
- <xsl:text>;</xsl:text>
+ <xsl:call-template name="highlight-special">
+ <xsl:with-param name="text" select="';'"/>
+ </xsl:call-template>
</xsl:when>
<xsl:otherwise>
@@ -195,7 +199,9 @@
<xsl:with-param name="text" select="string(@name)"/>
</xsl:call-template>
<xsl:apply-templates select="specialization"/>
- <xsl:text>;</xsl:text>
+ <xsl:call-template name="highlight-special">
+ <xsl:with-param name="text" select="';'"/>
+ </xsl:call-template>
</xsl:otherwise>
</xsl:choose>
@@ -327,8 +333,10 @@
<xsl:with-param name="link-type" select="$link-type"/>
<xsl:with-param name="highlight" select="true()"/>
</xsl:call-template>
- <xsl:value-of select="substring(concat(';', $name-padding),
- 1, $max-name-length - string-length($truncated-typedef-name))"/>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="substring(concat(';', $name-padding),
+ 1, $max-name-length - string-length($truncated-typedef-name))"/>
+ </xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text> </xsl:text>
@@ -338,7 +346,9 @@
<xsl:with-param name="link-type" select="$link-type"/>
<xsl:with-param name="highlight" select="true()"/>
</xsl:call-template>
- <xsl:text>;</xsl:text>
+ <xsl:call-template name="highlight-special">
+ <xsl:with-param name="text" select="';'"/>
+ </xsl:call-template>
</xsl:otherwise>
</xsl:choose>
@@ -461,7 +471,9 @@
<xsl:if test="not(@name = '')">
<xsl:text> </xsl:text>
- <xsl:value-of select="@name"/>
+ <xsl:call-template name="source-highlight">
+ <xsl:with-param name="text" select="@name"/>
+ </xsl:call-template>
</xsl:if>
<xsl:text> = </xsl:text>
@@ -471,7 +483,9 @@
<xsl:apply-templates select="default/*|default/text()"/>
</xsl:with-param>
</xsl:call-template>
- <xsl:text>;</xsl:text>
+ <xsl:call-template name="highlight-special">
+ <xsl:with-param name="text" select="';'"/>
+ </xsl:call-template>
<xsl:if test="purpose">
<xsl:text> </xsl:text>
@@ -523,7 +537,9 @@
<!-- Output the type -->
<xsl:choose>
<xsl:when test="type">
- <xsl:apply-templates select="type/*|type/text()" mode="annotation"/>
+ <xsl:apply-templates select="type/*|type/text()" mode="annotation">
+ <xsl:with-param name="highlight" select="true()"/>
+ </xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:message>
@@ -581,14 +597,20 @@
<xsl:when test="$single-line-candidate and
(string-length($single-line) + $indentation + 3
< $max-columns)">
- <xsl:text> : </xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="' : '"/>
+ </xsl:call-template>
<xsl:call-template name="print.base.classes.single"/>
- <xsl:text> {</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="' {'"/>
+ </xsl:call-template>
</xsl:when>
<xsl:when test="$single-line-candidate and
(string-length($single-line) + $base-indentation + 2
< $max-columns)">
- <xsl:text> : </xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="' : '"/>
+ </xsl:call-template>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$base-indentation + 2"/>
</xsl:call-template>
@@ -597,10 +619,14 @@
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$base-indentation"/>
</xsl:call-template>
- <xsl:text>{</xsl:text>
+ <xsl:call-template name="highlight-special">
+ <xsl:with-param name="text" select="'{'"/>
+ </xsl:call-template>
</xsl:when>
<xsl:otherwise>
- <xsl:text> : </xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="' : '"/>
+ </xsl:call-template>
<xsl:call-template name="print.base.classes.multi">
<xsl:with-param name="indentation" select="$indentation + 3"/>
</xsl:call-template>
@@ -608,7 +634,9 @@
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$base-indentation"/>
</xsl:call-template>
- <xsl:text>{</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="'{'"/>
+ </xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@@ -736,26 +764,28 @@
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation + 2"/>
</xsl:call-template>
- <emphasis>
- <xsl:text>// </xsl:text>
- <!-- True if there are any non-compacted typedefs -->
- <xsl:variable name="have-typedef-references"
- select="typedef and ((typedef/para|typedef/description) or ($boost.compact.typedef='0'))"/>
- <xsl:choose>
- <xsl:when test="$have-typedef-references">
- <xsl:call-template name="internal-link">
- <xsl:with-param name="to">
- <xsl:call-template name="generate.id"/>
- <xsl:text>types</xsl:text>
- </xsl:with-param>
- <xsl:with-param name="text" select="'types'"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>types</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </emphasis>
+ <xsl:call-template name="highlight-comment">
+ <xsl:with-param name="text">
+ <xsl:text>// </xsl:text>
+ <!-- True if there are any non-compacted typedefs -->
+ <xsl:variable name="have-typedef-references"
+ select="typedef and ((typedef/para|typedef/description) or ($boost.compact.typedef='0'))"/>
+ <xsl:choose>
+ <xsl:when test="$have-typedef-references">
+ <xsl:call-template name="internal-link">
+ <xsl:with-param name="to">
+ <xsl:call-template name="generate.id"/>
+ <xsl:text>types</xsl:text>
+ </xsl:with-param>
+ <xsl:with-param name="text" select="'types'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>types</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
<xsl:variable name="max-type-length">
<xsl:call-template name="find-max-type-length"/>
@@ -846,7 +876,9 @@
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="$specification"/>
</xsl:call-template>
- <xsl:text>:</xsl:text>
+ <xsl:call-template name="highlight-special">
+ <xsl:with-param name="text" select="':'"/>
+ </xsl:call-template>
</xsl:template>
<xsl:template match="access" mode="synopsis">
@@ -882,15 +914,22 @@
comment. -->
<xsl:if test="purpose">
<xsl:text> </xsl:text>
- <xsl:call-template name="indent">
- <xsl:with-param name="indentation" select="$indentation"/>
- </xsl:call-template>
+ <xsl:variable name="spaces">
+ <xsl:call-template name="indent">
+ <xsl:with-param name="indentation" select="$indentation"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:copy-of select="$spaces"/>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:text>// </xsl:text>
- <xsl:apply-templates select="purpose" mode="comment"/>
+ <xsl:apply-templates select="purpose" mode="comment">
+ <xsl:with-param name="wrap" select="true()"/>
+ <xsl:with-param name="prefix" select="concat($spaces, '// ')"/>
+ </xsl:apply-templates>
</xsl:with-param>
</xsl:call-template>
+ <xsl:text> </xsl:text>
</xsl:if>
</xsl:if>
@@ -940,7 +979,9 @@
</xsl:when>
<xsl:otherwise>
<!-- Opening brace -->
- <xsl:text> {</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="' {'"/>
+ </xsl:call-template>
</xsl:otherwise>
</xsl:choose>
@@ -973,7 +1014,9 @@
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
- <xsl:text>};</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="'};'"/>
+ </xsl:call-template>
</xsl:template>
<!-- Emit nested class reference documentation -->
@@ -1169,7 +1212,9 @@
<xsl:apply-templates select="type" mode="highlight"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
- <xsl:text>;</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="';'"/>
+ </xsl:call-template>
</xsl:when>
<xsl:otherwise>
@@ -1283,16 +1328,22 @@
<xsl:with-param name="higlhight" select="false()"/>
</xsl:call-template>
- <xsl:text> { </xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="' { '"/>
+ </xsl:call-template>
<xsl:call-template name="type.enum.list.compact">
<xsl:with-param name="indentation"
select="$indentation + string-length(@name) + 8"/>
<xsl:with-param name="compact" select="true()"/>
</xsl:call-template>
- <xsl:text> }</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="' }'"/>
+ </xsl:call-template>
</xsl:otherwise>
</xsl:choose>
- <xsl:text>;</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="';'"/>
+ </xsl:call-template>
</xsl:template>
<!-- Enumeration reference at namespace level -->
@@ -1354,14 +1405,18 @@
<!-- Header -->
<xsl:variable name="header" select="concat(' ', @name, ' { ')"/>
- <xsl:value-of select="$header"/>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="$header"/>
+ </xsl:call-template>
<!-- Print the enumeration values -->
<xsl:call-template name="type.enum.list.compact">
<xsl:with-param name="indentation" select="4 + string-length($header)"/>
</xsl:call-template>
- <xsl:text> };</xsl:text>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="' };'"/>
+ </xsl:call-template>
</xsl:template>
<!-- List enumeration values in a compact form e.g.,
Modified: branches/release/tools/boostbook/xsl/xhtml.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/xhtml.xsl (original)
+++ branches/release/tools/boostbook/xsl/xhtml.xsl 2010-07-05 20:12:00 EDT (Mon, 05 Jul 2010)
@@ -16,307 +16,22 @@
<xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/xhtml/math.xsl"/>
- <xsl:import href="chunk-common.xsl"/>
- <xsl:import href="docbook-layout.xsl"/>
- <xsl:import href="navbar.xsl"/>
- <xsl:import href="admon.xsl"/>
- <xsl:import href="xref.xsl"/>
- <xsl:import href="relative-href.xsl"/>
- <xsl:import href="callout.xsl"/>
-
- <xsl:param name="html.stylesheet">
- <xsl:choose>
- <xsl:when test = "$boost.defaults = 'Boost'">
- <xsl:value-of select = "concat($boost.root, '/doc/src/boostbook.css')"/>
- </xsl:when>
- <xsl:otherwise>
- boostbook.css
- </xsl:otherwise>
- </xsl:choose>
- </xsl:param>
-
- <xsl:param name="admon.style"/>
- <xsl:param name="admon.graphics">1</xsl:param>
- <xsl:param name="boostbook.verbose" select="0"/>
- <xsl:param name="navig.graphics" select="1"/>
- <xsl:param name="navig.graphics.extension" select="'.png'"/>
- <xsl:param name="chapter.autolabel" select="1"/>
- <xsl:param name="use.id.as.filename" select="1"/>
- <xsl:param name="refentry.generate.name" select="0"/>
- <xsl:param name="refentry.generate.title" select="1"/>
- <xsl:param name="make.year.ranges" select="1"/>
- <xsl:param name="generate.manifest" select="1"/>
- <xsl:param name="generate.section.toc.level" select="3"/>
- <xsl:param name="doc.standalone">false</xsl:param>
- <xsl:param name="chunker.output.indent">yes</xsl:param>
- <xsl:param name="chunk.quietly" select="not(number($boostbook.verbose))"/>
- <xsl:param name="toc.max.depth">2</xsl:param>
- <xsl:param name="callout.graphics.number.limit">15</xsl:param>
- <xsl:param name = "admon.graphics.path"
- select = "concat($boost.root, '/doc/xhtml/images/')"/>
- <xsl:param name = "navig.graphics.path"
- select = "concat($boost.root, '/doc/xhtml/images/')"/>
- <xsl:param name = "callout.graphics.path"
- select = "concat($boost.root, '/doc/src/images/callouts/')"/>
-
-
- <xsl:param name="admon.style">
- <!-- Remove the style. Let the CSS do the styling -->
-</xsl:param>
-
-<!-- Always have graphics -->
-<xsl:param name="admon.graphics" select="1"/>
-
- <xsl:param name="generate.toc">
-appendix toc,title
-article/appendix nop
-article toc,title
-book toc,title
-chapter toc,title
-part toc,title
-preface toc,title
-qandadiv toc
-qandaset toc
-reference toc,title
-sect1 toc
-sect2 toc
-sect3 toc
-sect4 toc
-sect5 toc
-section toc
-set toc,title
- </xsl:param>
-
-
- <xsl:template name="format.cvs.revision">
- <xsl:param name="text"/>
-
- <!-- Remove the "$Date: " -->
- <xsl:variable name="text.noprefix"
- select="substring-after($text, '$Date: ')"/>
-
- <!-- Grab the year -->
- <xsl:variable name="year" select="substring-before($text.noprefix, '/')"/>
- <xsl:variable name="text.noyear"
- select="substring-after($text.noprefix, '/')"/>
-
- <!-- Grab the month -->
- <xsl:variable name="month" select="substring-before($text.noyear, '/')"/>
- <xsl:variable name="text.nomonth"
- select="substring-after($text.noyear, '/')"/>
-
- <!-- Grab the year -->
- <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
- <xsl:variable name="text.noday"
- select="substring-after($text.nomonth, ' ')"/>
-
- <!-- Get the time -->
- <xsl:variable name="time" select="substring-before($text.noday, ' ')"/>
-
- <xsl:variable name="month.name">
- <xsl:choose>
- <xsl:when test="$month=1">January</xsl:when>
- <xsl:when test="$month=2">February</xsl:when>
- <xsl:when test="$month=3">March</xsl:when>
- <xsl:when test="$month=4">April</xsl:when>
- <xsl:when test="$month=5">May</xsl:when>
- <xsl:when test="$month=6">June</xsl:when>
- <xsl:when test="$month=7">July</xsl:when>
- <xsl:when test="$month=8">August</xsl:when>
- <xsl:when test="$month=9">September</xsl:when>
- <xsl:when test="$month=10">October</xsl:when>
- <xsl:when test="$month=11">November</xsl:when>
- <xsl:when test="$month=12">December</xsl:when>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
- $time, ' GMT')"/>
- </xsl:template>
-
-
- <xsl:template name="format.svn.revision">
- <xsl:param name="text"/>
-
- <!-- Remove the "$Date: " -->
- <xsl:variable name="text.noprefix"
- select="substring-after($text, '$Date: ')"/>
-
- <!-- Grab the year -->
- <xsl:variable name="year" select="substring-before($text.noprefix, '-')"/>
- <xsl:variable name="text.noyear"
- select="substring-after($text.noprefix, '-')"/>
-
- <!-- Grab the month -->
- <xsl:variable name="month" select="substring-before($text.noyear, '-')"/>
- <xsl:variable name="text.nomonth"
- select="substring-after($text.noyear, '-')"/>
-
- <!-- Grab the year -->
- <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
- <xsl:variable name="text.noday"
- select="substring-after($text.nomonth, ' ')"/>
-
- <!-- Get the time -->
- <xsl:variable name="time" select="substring-before($text.noday, ' ')"/>
- <xsl:variable name="text.notime"
- select="substring-after($text.noday, ' ')"/>
-
- <!-- Get the timezone -->
- <xsl:variable name="timezone" select="substring-before($text.notime, ' ')"/>
-
- <xsl:variable name="month.name">
- <xsl:choose>
- <xsl:when test="$month=1">January</xsl:when>
- <xsl:when test="$month=2">February</xsl:when>
- <xsl:when test="$month=3">March</xsl:when>
- <xsl:when test="$month=4">April</xsl:when>
- <xsl:when test="$month=5">May</xsl:when>
- <xsl:when test="$month=6">June</xsl:when>
- <xsl:when test="$month=7">July</xsl:when>
- <xsl:when test="$month=8">August</xsl:when>
- <xsl:when test="$month=9">September</xsl:when>
- <xsl:when test="$month=10">October</xsl:when>
- <xsl:when test="$month=11">November</xsl:when>
- <xsl:when test="$month=12">December</xsl:when>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
- $time, ' ', $timezone)"/>
- </xsl:template>
-
- <!-- Footer Copyright -->
- <xsl:template match="copyright" mode="boost.footer">
- <xsl:if test="position() > 1">
- <br/>
- </xsl:if>
- <xsl:call-template name="gentext">
- <xsl:with-param name="key" select="'Copyright'"/>
- </xsl:call-template>
- <xsl:call-template name="gentext.space"/>
- <xsl:call-template name="dingbat">
- <xsl:with-param name="dingbat">copyright</xsl:with-param>
- </xsl:call-template>
- <xsl:call-template name="gentext.space"/>
- <xsl:call-template name="copyright.years">
- <xsl:with-param name="years" select="year"/>
- <xsl:with-param name="print.ranges" select="$make.year.ranges"/>
- <xsl:with-param name="single.year.ranges"
- select="$make.single.year.ranges"/>
- </xsl:call-template>
- <xsl:call-template name="gentext.space"/>
- <xsl:apply-templates select="holder" mode="titlepage.mode"/>
- </xsl:template>
-
- <!-- Footer License -->
- <xsl:template match="legalnotice" mode="boost.footer">
- <xsl:apply-templates select="para" mode="titlepage.mode" />
- </xsl:template>
-
- <xsl:template name="user.footer.content">
- <table width="100%">
- <tr>
- <td align="left">
- <xsl:variable name="revision-nodes"
- select="ancestor-or-self::*
- [not (attribute::rev:last-revision='')]"/>
- <xsl:if test="count($revision-nodes) > 0">
- <xsl:variable name="revision-node"
- select="$revision-nodes[last()]"/>
- <xsl:variable name="revision-text">
- <xsl:value-of
- select="normalize-space($revision-node/attribute::rev:last-revision)"/>
- </xsl:variable>
- <xsl:if test="string-length($revision-text) > 0">
- <p>
- <small>
- <xsl:text>Last revised: </xsl:text>
- <xsl:choose>
- <xsl:when test="contains($revision-text, '/')">
- <xsl:call-template name="format.cvs.revision">
- <xsl:with-param name="text" select="$revision-text"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="format.svn.revision">
- <xsl:with-param name="text" select="$revision-text"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </small>
- </p>
- </xsl:if>
- </xsl:if>
- </td>
- <td align="right">
- <div class = "copyright-footer">
- <xsl:apply-templates select="ancestor::*/*/copyright"
- mode="boost.footer"/>
- <xsl:apply-templates select="ancestor::*/*/legalnotice"
- mode="boost.footer"/>
- </div>
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <!-- We don't want refentry's to show up in the TOC because they
- will merely be redundant with the synopsis. -->
- <xsl:template match="refentry" mode="toc"/>
-
- <!-- override the behaviour of some DocBook elements for better
- rendering facilities -->
-
- <xsl:template match = "programlisting[ancestor::informaltable]">
- <pre class = "table-{name(.)}"><xsl:apply-templates/></pre>
- </xsl:template>
-
- <xsl:template match = "refsynopsisdiv">
- <h2 class = "{name(.)}-title">Synopsis</h2>
- <div class = "{name(.)}">
- <xsl:apply-templates/>
- </div>
- </xsl:template>
-
-<!-- ============================================================ -->
-
-<xsl:template name="output.html.stylesheets">
- <xsl:param name="stylesheets" select="''"/>
-
- <xsl:choose>
- <xsl:when test="contains($stylesheets, ' ')">
- <link rel="stylesheet">
- <xsl:attribute name="href">
- <xsl:call-template name="href.target.relative">
- <xsl:with-param name="target" select="substring-before($stylesheets, ' ')"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:if test="$html.stylesheet.type != ''">
- <xsl:attribute name="type">
- <xsl:value-of select="$html.stylesheet.type"/>
- </xsl:attribute>
- </xsl:if>
- </link>
- <xsl:call-template name="output.html.stylesheets">
- <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$stylesheets != ''">
- <link rel="stylesheet">
- <xsl:attribute name="href">
- <xsl:call-template name="href.target.relative">
- <xsl:with-param name="target" select="$stylesheets"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:if test="$html.stylesheet.type != ''">
- <xsl:attribute name="type">
- <xsl:value-of select="$html.stylesheet.type"/>
- </xsl:attribute>
- </xsl:if>
- </link>
- </xsl:when>
- </xsl:choose>
-</xsl:template>
+ <!-- Bring in the fast chunking overrides. There's nothing
+ that we need to override, so include instead of importing it. -->
+ <xsl:include
+ href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunkfast.xsl"/>
+
+ <!-- We have to make sure that our templates override all
+ docbook templates. Therefore, we include our own templates
+ instead of importing them. In order for this to work,
+ the stylesheets included here cannot also include each other -->
+ <xsl:include href="chunk-common.xsl"/>
+ <xsl:include href="docbook-layout.xsl"/>
+ <xsl:include href="navbar.xsl"/>
+ <xsl:include href="admon.xsl"/>
+ <xsl:include href="xref.xsl"/>
+ <xsl:include href="relative-href.xsl"/>
+ <xsl:include href="callout.xsl"/>
+ <xsl:include href="html-base.xsl"/>
</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