Update of /cvsroot/boost/boost/tools/boostbook/xsl
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1375
Modified Files:
docbook.xsl html.xsl lookup.xsl type.xsl
Log Message:
make boostbook at least marginally better at handling template specializations
Index: docbook.xsl
===================================================================
RCS file: /cvsroot/boost/boost/tools/boostbook/xsl/docbook.xsl,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- docbook.xsl 13 Nov 2006 16:24:15 -0000 1.22
+++ docbook.xsl 3 May 2007 16:45:24 -0000 1.23
@@ -7,6 +7,7 @@
http://www.boost.org/LICENSE_1_0.txt)
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
version="1.0">
<xsl:include href="reference.xsl"/>
Index: html.xsl
===================================================================
RCS file: /cvsroot/boost/boost/tools/boostbook/xsl/html.xsl,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- html.xsl 21 Feb 2007 01:08:26 -0000 1.29
+++ html.xsl 3 May 2007 16:45:24 -0000 1.30
@@ -13,6 +13,8 @@
<!-- Import the HTML chunking stylesheet -->
<xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/>
+ <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"/>
Index: lookup.xsl
===================================================================
RCS file: /cvsroot/boost/boost/tools/boostbook/xsl/lookup.xsl,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- lookup.xsl 13 Nov 2006 16:24:15 -0000 1.9
+++ lookup.xsl 3 May 2007 16:45:24 -0000 1.10
@@ -14,7 +14,15 @@
<!-- Generate an ID for the entity referenced -->
<xsl:template name="generate.id">
<xsl:param name="node" select="."/>
- <xsl:apply-templates select="$node" mode="generate.id"/>
+ <xsl:choose>
+ <xsl:when
test="ancestor::class-specialization|ancestor::struct-specialization|ancestor::union-specialization">
+ <xsl:value-of select="generate-id(.)"/>
+ <xsl:text>-bb</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$node" mode="generate.id"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<xsl:template match="*" mode="generate.id">
@@ -22,19 +30,102 @@
<xsl:text>-bb</xsl:text>
</xsl:template>
+ <xsl:template name="strip-qualifiers-non-template">
+ <xsl:param name="name"/>
+ <xsl:choose>
+ <xsl:when test="contains($name, '>')">
+ <xsl:call-template name="strip-qualifiers-non-template">
+ <xsl:with-param name="name" select="substring-after($name, '>')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains($name, '::')">
+ <xsl:call-template name="strip-qualifiers-non-template">
+ <xsl:with-param name="name" select="substring-after($name, '::')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="strip-balanced">
+ <xsl:param name="name"/>
+ <xsl:param name="open" select="'<'"/>
+ <xsl:param name="close" select="'>'"/>
+ <xsl:param name="depth" select="0"/>
+ <xsl:choose>
+ <xsl:when test="contains($name, $open)
+ and not(contains(substring-before($name, $open), $close))">
+ <xsl:call-template name="strip-balanced">
+ <xsl:with-param name="name" select="substring-after($name, $open)"/>
+ <xsl:with-param name="open" select="$open"/>
+ <xsl:with-param name="close" select="$close"/>
+ <xsl:with-param name="depth" select="$depth + 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains($name, $close) and ($depth > 1)">
+ <xsl:call-template name="strip-balanced">
+ <xsl:with-param name="name" select="substring-after($name, $close)"/>
+ <xsl:with-param name="open" select="$open"/>
+ <xsl:with-param name="close" select="$close"/>
+ <xsl:with-param name="depth" select="$depth - 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($name, $close)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="strip-qualifiers-template">
+ <xsl:param name="name"/>
+ <xsl:choose>
+ <xsl:when test="contains($name, '::')
+ and not(contains(substring-before($name, '::'), '<'))">
+ <xsl:call-template name="strip-qualifiers-template">
+ <xsl:with-param name="name" select="substring-after($name, '::')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="rest">
+ <xsl:call-template name="strip-balanced">
+ <xsl:with-param name="name" select="$name"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$rest != ''">
+ <xsl:call-template name="strip-qualifiers-template">
+ <xsl:with-param name="name" select="$rest"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
<!-- Strip the qualifiers off a qualified name and return the unqualified
name. For instance, "boost::python::function" would become just
- "function". -->
+ "function".
+ Must handle ns::foo -> foo
+ Must handle ns::foo<bar::baz> -> foo<bar::baz>
+ Must handle ns::foo<bar::baz>::nested -> nested
+ Must handle ns::foo<x>::bar<y> -> bar<y> -->
<xsl:template name="strip-qualifiers">
<xsl:param name="name"/>
<xsl:choose>
- <xsl:when test="contains($name, '::') and
not(contains(substring-before($name, '::'), '<'))">
- <xsl:call-template name="strip-qualifiers">
- <xsl:with-param name="name" select="substring-after($name, '::')"/>
+ <xsl:when test="substring($name, string-length($name)) = '>'">
+ <xsl:call-template name="strip-qualifiers-template">
+ <xsl:with-param name="name" select="$name"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of select="$name"/>
+ <xsl:call-template name="strip-qualifiers-non-template">
+ <xsl:with-param name="name" select="$name"/>
+ </xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@@ -67,7 +158,9 @@
<!-- Determine the set of ancestor namespaces -->
<xsl:variable name="ancestors"
-
select="ancestor::namespace|ancestor::class|ancestor::struct|ancestor::union"/>
+ select="ancestor::namespace|
+ ancestor::class|ancestor::struct|ancestor::union|
+
ancestor::class-specialization|ancestor::struct-specialization|ancestor::union-specialization"/>
<xsl:choose>
<xsl:when test="$depth > count($ancestors)">
@@ -92,6 +185,29 @@
<xsl:value-of select="@name"/>
</xsl:template>
+ <xsl:template name="print-specialization-name">
+ <xsl:value-of select="@name"/>
+ <xsl:text><</xsl:text>
+ <xsl:value-of select="specialization/template-arg[position() = 1]/text()"/>
+ <xsl:for-each select="specialization/template-arg[position() > 1]">
+ <xsl:text>,</xsl:text>
+ <xsl:value-of select="text()"/>
+ </xsl:for-each>
+ <xsl:text>></xsl:text>
+ </xsl:template>
+
+ <xsl:template match="struct-specialization" mode="print-name">
+ <xsl:call-template name="print-specialization-name"/>
+ </xsl:template>
+
+ <xsl:template match="class-specialization" mode="print-name">
+ <xsl:call-template name="print-specialization-name"/>
+ </xsl:template>
+
+ <xsl:template match="union-specialization" mode="print-name">
+ <xsl:call-template name="print-specialization-name"/>
+ </xsl:template>
+
<xsl:template name="name-matches-node">
<!-- The name we are looking for -->
<xsl:param name="name"/>
Index: type.xsl
===================================================================
RCS file: /cvsroot/boost/boost/tools/boostbook/xsl/type.xsl,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- type.xsl 4 Apr 2007 22:52:17 -0000 1.18
+++ type.xsl 3 May 2007 16:45:24 -0000 1.19
@@ -869,7 +869,6 @@
<xsl:call-template name="fully-qualified-name">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
- <xsl:apply-templates select="specialization"/>
</xsl:with-param>
<xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
<xsl:with-param name="anchor">
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs