|
Boost-Commit : |
From: fmhess_at_[hidden]
Date: 2007-09-12 17:30:18
Author: fmhess
Date: 2007-09-12 17:30:17 EDT (Wed, 12 Sep 2007)
New Revision: 39222
URL: http://svn.boost.org/trac/boost/changeset/39222
Log:
Updated the stylesheets to support new <access> element for
giving access specifiers to class members.
Text files modified:
sandbox/boost_docs/trunk/tools/boostbook/xsl/chunk-common.xsl | 2
sandbox/boost_docs/trunk/tools/boostbook/xsl/function.xsl | 112 +++++++-----
sandbox/boost_docs/trunk/tools/boostbook/xsl/lookup.xsl | 34 ++--
sandbox/boost_docs/trunk/tools/boostbook/xsl/reference.xsl | 18 +-
sandbox/boost_docs/trunk/tools/boostbook/xsl/type.xsl | 337 +++++++++++++++++++++++----------------
sandbox/boost_docs/trunk/tools/boostbook/xsl/utility.xsl | 31 +++
6 files changed, 314 insertions(+), 220 deletions(-)
Modified: sandbox/boost_docs/trunk/tools/boostbook/xsl/chunk-common.xsl
==============================================================================
--- sandbox/boost_docs/trunk/tools/boostbook/xsl/chunk-common.xsl (original)
+++ sandbox/boost_docs/trunk/tools/boostbook/xsl/chunk-common.xsl 2007-09-12 17:30:17 EDT (Wed, 12 Sep 2007)
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
-
+
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
Modified: sandbox/boost_docs/trunk/tools/boostbook/xsl/function.xsl
==============================================================================
--- sandbox/boost_docs/trunk/tools/boostbook/xsl/function.xsl (original)
+++ sandbox/boost_docs/trunk/tools/boostbook/xsl/function.xsl 2007-09-12 17:30:17 EDT (Wed, 12 Sep 2007)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
-
+
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
@@ -9,7 +9,7 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
- <xsl:strip-space elements="requires effects postconditions returns throws
+ <xsl:strip-space elements="requires effects postconditions returns throws
complexity notes rationale purpose"/>
<!-- When true, the stylesheet will emit compact definitions of
@@ -126,7 +126,7 @@
</xsl:choose>
</xsl:variable>
- <xsl:if test="not ($standalone) or
+ <xsl:if test="not ($standalone) or
(local-name(.)='signature' and (position() > 1))
or $suppress-template">
<xsl:text> </xsl:text>
@@ -136,7 +136,7 @@
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
-
+
<!-- Build the template header -->
<xsl:variable name="template-length">
<xsl:choose>
@@ -148,7 +148,7 @@
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
-
+
<!-- Build a full parameter string (without line breaks) -->
<xsl:variable name="param-string">
<xsl:text>(</xsl:text>
@@ -168,21 +168,21 @@
</xsl:variable>
<!-- Build the full declaration text -->
- <xsl:variable name="decl-string"
+ <xsl:variable name="decl-string"
select="concat($type, $function-name, $param-string, $postdeclarator)"/>
- <xsl:variable name="end-column"
+ <xsl:variable name="end-column"
select="$template-length + string-length($decl-string) + $indentation"/>
-
+
<xsl:choose>
<!-- Check if we should put the template header on its own line to
save horizontal space. -->
- <xsl:when test="($template-length > 0) and
+ <xsl:when test="($template-length > 0) and
($end-column > $pre.text.max.columns)">
<!-- Emit template header on its own line -->
<xsl:apply-templates select="template" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
-
+
<!-- Emit the rest of the function declaration (without the
template header) indented two extra spaces. -->
<xsl:call-template name="function">
@@ -249,17 +249,17 @@
<xsl:text>(</xsl:text>
<xsl:call-template name="function-parameters">
<xsl:with-param name="include-names" select="$include-names"/>
- <xsl:with-param name="indentation"
+ <xsl:with-param name="indentation"
select="$indentation + $template-length + string-length($type)
+ string-length($function-name) + 1"/>
<xsl:with-param name="final" select="true()"/>
- </xsl:call-template>
+ </xsl:call-template>
<xsl:text>)</xsl:text>
<xsl:call-template name="source-highlight">
<xsl:with-param name="text" select="$postdeclarator"/>
</xsl:call-template>
- <xsl:text>;</xsl:text>
+ <xsl:text>;</xsl:text>
</xsl:when>
<!-- This declaration will take multiple lines -->
@@ -320,11 +320,11 @@
<xsl:text>(</xsl:text>
<xsl:call-template name="function-parameters">
<xsl:with-param name="include-names" select="$include-names"/>
- <xsl:with-param name="indentation"
- select="$indentation + $type-length
+ <xsl:with-param name="indentation"
+ select="$indentation + $type-length
+ string-length($function-name) + 1"/>
<xsl:with-param name="final" select="true()"/>
- </xsl:call-template>
+ </xsl:call-template>
<xsl:text>)</xsl:text>
<xsl:call-template name="source-highlight">
<xsl:with-param name="text" select="$postdeclarator"/>
@@ -332,7 +332,7 @@
<xsl:text>;</xsl:text>
</xsl:otherwise>
</xsl:choose>
- </xsl:template>
+ </xsl:template>
<!-- Synopsis of function parameters, e.g., "(const T&, int x = 5)" -->
<xsl:template name="function-parameters">
@@ -394,18 +394,18 @@
</xsl:variable>
<xsl:variable name="text" select="concat($type, $name, $default)"/>
-
- <xsl:variable name="end-column"
+
+ <xsl:variable name="end-column"
select="$column + string-length($prefix) + string-length($text)"/>
<xsl:choose>
<!-- Parameter goes on this line -->
- <xsl:when test="$first-on-line or ($end-column < $pre.text.max.columns)
+ <xsl:when test="$first-on-line or ($end-column < $pre.text.max.columns)
or not($wrap)">
<xsl:choose>
<xsl:when test="$final">
<xsl:value-of select="$prefix"/>
- <xsl:apply-templates
+ <xsl:apply-templates
select="$parameter/paramtype/*|$parameter/paramtype/text()"
mode="annotation">
<xsl:with-param name="highlight" select="true()"/>
@@ -423,7 +423,7 @@
<xsl:with-param name="include-names" select="$include-names"/>
<xsl:with-param name="wrap" select="$wrap"/>
<xsl:with-param name="final" select="$final"/>
- <xsl:with-param name="parameters"
+ <xsl:with-param name="parameters"
select="$parameters[position()!=1]"/>
<xsl:with-param name="prefix" select="', '"/>
<xsl:with-param name="column" select="$end-column"/>
@@ -441,7 +441,7 @@
</xsl:call-template>
<xsl:choose>
<xsl:when test="$final">
- <xsl:apply-templates
+ <xsl:apply-templates
select="$parameter/paramtype/*|$parameter/paramtype/text()"
mode="annotation">
<xsl:with-param name="highlight" select="true()"/>
@@ -460,10 +460,10 @@
<xsl:with-param name="include-names" select="$include-names"/>
<xsl:with-param name="wrap" select="$wrap"/>
<xsl:with-param name="final" select="$final"/>
- <xsl:with-param name="parameters"
+ <xsl:with-param name="parameters"
select="$parameters[position()!=1]"/>
<xsl:with-param name="prefix" select="', '"/>
- <xsl:with-param name="column"
+ <xsl:with-param name="column"
select="1 + string-length($text) + $indentation"/>
<xsl:with-param name="first-on-line" select="false()"/>
</xsl:call-template>
@@ -479,7 +479,7 @@
<!-- True if we should compact this function -->
<xsl:variable name="compact"
select="not (para|description|requires|effects|postconditions|returns|
- throws|complexity|notes|rationale) and
+ throws|complexity|notes|rationale) and
($boost.compact.function='1') and
not (local-name(.)='method')"/>
@@ -524,7 +524,7 @@
<!-- True if we should compact this function -->
<xsl:variable name="compact"
select="not (para|description|requires|effects|postconditions|returns|
- throws|complexity|notes|rationale) and
+ throws|complexity|notes|rationale) and
($boost.compact.function='1') and
not (local-name(.)='overloaded-method')"/>
@@ -537,7 +537,7 @@
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
-
+
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:text>// </xsl:text>
@@ -566,7 +566,7 @@
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="link-to" select="$link-to"/>
</xsl:call-template>
- </xsl:for-each>
+ </xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="signature">
@@ -598,7 +598,7 @@
</xsl:if>
<xsl:text> </xsl:text>
<xsl:call-template name="indent">
- <xsl:with-param name="indentation" select="$indentation"/>
+ <xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<emphasis>
<xsl:text>// </xsl:text>
@@ -634,8 +634,12 @@
<xsl:with-param name="text" select="''"/>
</xsl:call-template>
<xsl:call-template name="monospaced">
- <xsl:with-param name="text" select="@name"/>
+ <xsl:with-param name="text">
+ <xsl:call-template name="object-name"/>
+ </xsl:with-param>
</xsl:call-template>
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="access-name"/>
<xsl:text> construct/copy/destruct</xsl:text>
</xsl:with-param>
<xsl:with-param name="text">
@@ -658,7 +662,9 @@
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="0"/>
<xsl:with-param name="is-reference" select="true()"/>
- <xsl:with-param name="constructor-for" select="../@name"/>
+ <xsl:with-param name="constructor-for">
+ <xsl:call-template name="object-name"/>
+ </xsl:with-param>
<xsl:with-param name="standalone" select="true()"/>
</xsl:call-template>
</xsl:with-param>
@@ -668,7 +674,7 @@
</xsl:with-param>
</xsl:call-template>
</xsl:template>
-
+
<xsl:template match="copy-assignment" mode="reference">
<xsl:call-template name="function.documentation">
<xsl:with-param name="text">
@@ -678,7 +684,9 @@
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="0"/>
<xsl:with-param name="is-reference" select="true()"/>
- <xsl:with-param name="copy-assign-for" select="../@name"/>
+ <xsl:with-param name="copy-assign-for">
+ <xsl:call-template name="object-name"/>
+ </xsl:with-param>
<xsl:with-param name="standalone" select="true()"/>
</xsl:call-template>
</xsl:with-param>
@@ -698,7 +706,9 @@
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="0"/>
<xsl:with-param name="is-reference" select="true()"/>
- <xsl:with-param name="destructor-for" select="../@name"/>
+ <xsl:with-param name="destructor-for">
+ <xsl:call-template name="object-name"/>
+ </xsl:with-param>
<xsl:with-param name="standalone" select="true()"/>
</xsl:call-template>
</xsl:with-param>
@@ -826,7 +836,7 @@
<!-- True if we should compact this function -->
<xsl:variable name="compact"
select="not (para|description|requires|effects|postconditions|returns|
- throws|complexity|notes|rationale) and
+ throws|complexity|notes|rationale) and
($boost.compact.function='1') and
not (local-name(.)='method')"/>
@@ -856,7 +866,7 @@
<!-- True if we should compact this function -->
<xsl:variable name="compact"
select="not (para|description|requires|effects|postconditions|returns|
- throws|complexity|notes|rationale) and
+ throws|complexity|notes|rationale) and
($boost.compact.function='1')"/>
<xsl:if test="not ($compact)">
@@ -891,8 +901,8 @@
<xsl:with-param name="namespace-reference" select="true()"/>
</xsl:call-template>
</xsl:with-param>
- </xsl:call-template>
- </xsl:if>
+ </xsl:call-template>
+ </xsl:if>
</xsl:template>
<xsl:template match="overloaded-function" mode="reference">
@@ -901,9 +911,9 @@
<!-- True if we should compact this function -->
<xsl:variable name="compact"
select="not (para|description|requires|effects|postconditions|returns|
- throws|complexity|notes|rationale) and
+ throws|complexity|notes|rationale) and
($boost.compact.function='1')"/>
-
+
<xsl:if test="not ($compact)">
<xsl:call-template name="function.documentation">
<xsl:with-param name="text">
@@ -911,7 +921,7 @@
<xsl:attribute name="id">
<xsl:call-template name="generate.id"/>
</xsl:attribute>
-
+
<xsl:call-template name="preformatted">
<xsl:with-param name="text">
<xsl:for-each select="signature">
@@ -935,7 +945,7 @@
<!-- True if we should compact this function -->
<xsl:variable name="compact"
select="not (para|description|requires|effects|postconditions|returns|
- throws|complexity|notes|rationale) and
+ throws|complexity|notes|rationale) and
($boost.compact.function='1')"/>
<xsl:variable name="name" select="@name"/>
@@ -975,8 +985,8 @@
<xsl:with-param name="namespace-reference" select="true()"/>
</xsl:call-template>
</xsl:with-param>
- </xsl:call-template>
- </xsl:if>
+ </xsl:call-template>
+ </xsl:if>
</xsl:template>
<xsl:template match="overloaded-method" mode="reference">
@@ -988,7 +998,7 @@
<xsl:attribute name="id">
<xsl:call-template name="generate.id"/>
</xsl:attribute>
-
+
<xsl:call-template name="preformatted">
<xsl:with-param name="text">
<xsl:for-each select="signature">
@@ -1025,7 +1035,7 @@
<xsl:with-param name="text" select="string(@name)"/>
</xsl:call-template>
</emphasis>
- <xsl:apply-templates select="method|overloaded-method"
+ <xsl:apply-templates select="method|overloaded-method"
mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
@@ -1044,7 +1054,9 @@
<xsl:with-param name="text" select="''"/>
</xsl:call-template>
<xsl:call-template name="monospaced">
- <xsl:with-param name="text" select="../@name"/>
+ <xsl:with-param name="text">
+ <xsl:call-template name="object-name"/>
+ </xsl:with-param>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
@@ -1057,7 +1069,7 @@
</xsl:with-param>
</xsl:call-template>
</xsl:if>
- </xsl:template>
+ </xsl:template>
<!-- Group free functions together under a category name (synopsis)-->
<xsl:template match="free-function-group" mode="synopsis">
@@ -1105,5 +1117,5 @@
</orderedlist>
</xsl:with-param>
</xsl:call-template>
- </xsl:template>
+ </xsl:template>
</xsl:stylesheet>
Modified: sandbox/boost_docs/trunk/tools/boostbook/xsl/lookup.xsl
==============================================================================
--- sandbox/boost_docs/trunk/tools/boostbook/xsl/lookup.xsl (original)
+++ sandbox/boost_docs/trunk/tools/boostbook/xsl/lookup.xsl 2007-09-12 17:30:17 EDT (Wed, 12 Sep 2007)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
-
+
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
@@ -110,9 +110,9 @@
<!-- Strip the qualifiers off a qualified name and return the unqualified
name. For instance, "boost::python::function" would become just
"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 -> 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"/>
@@ -157,7 +157,7 @@
<xsl:param name="depth" select="1"/>
<!-- Determine the set of ancestor namespaces -->
- <xsl:variable name="ancestors"
+ <xsl:variable name="ancestors"
select="ancestor::namespace|
ancestor::class|ancestor::struct|ancestor::union|
ancestor::class-specialization|ancestor::struct-specialization|ancestor::union-specialization"/>
@@ -279,16 +279,16 @@
$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"
+ <xsl:variable name="have-match"
select="$fully-qualified-name = concat($prefix, $name)"/>
-
+
<xsl:if test="$have-match">
<xsl:choose>
<xsl:when test="$mode='matches'">
@@ -306,7 +306,7 @@
</xsl:when>
</xsl:choose>
</xsl:if>
-
+
<xsl:if test="(not($index > count($directives))) and
(not($have-match) or ($mode = 'matches'))">
<xsl:variable name="first-branch">
@@ -324,7 +324,7 @@
</xsl:call-template>
</xsl:if>
</xsl:variable>
-
+
<xsl:choose>
<xsl:when test="string($first-branch) != ''">
<xsl:copy-of select="$first-branch"/>
@@ -338,12 +338,12 @@
<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"
+ <xsl:with-param name="prefix"
select="concat($this-context, '::')"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
- </xsl:if>
+ </xsl:if>
</xsl:when>
</xsl:choose>
</xsl:template>
@@ -372,19 +372,19 @@
<xsl:template name="cxx-link-name">
<!-- The actual lookup node -->
- <xsl:param name="lookup"/>
+ <xsl:param name="lookup"/>
<!-- The type of name to lookup (e.g., class) -->
- <xsl:param name="type"/>
+ <xsl:param name="type"/>
<!-- The name we are looking for -->
- <xsl:param name="name"/>
+ <xsl:param name="name"/>
<!-- The name we will display -->
<xsl:param name="display-name"/>
<!-- The name we are looking for (unqualified)-->
- <xsl:param name="unqualified-name"/>
+ <xsl:param name="unqualified-name"/>
<!-- The list of nodes that match the lookup node in both name and type -->
<xsl:param name="nodes"/>
Modified: sandbox/boost_docs/trunk/tools/boostbook/xsl/reference.xsl
==============================================================================
--- sandbox/boost_docs/trunk/tools/boostbook/xsl/reference.xsl (original)
+++ sandbox/boost_docs/trunk/tools/boostbook/xsl/reference.xsl 2007-09-12 17:30:17 EDT (Wed, 12 Sep 2007)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
-
+
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
@@ -22,7 +22,7 @@
<xsl:include href="macro.xsl"/>
<xsl:include href="testing/testsuite.xsl"/>
<xsl:include href="caramel/concept2docbook.xsl"/>
-
+
<xsl:template name="namespace-synopsis">
<xsl:param name="indentation" select="0"/>
<!-- Open namespace-->
@@ -33,7 +33,7 @@
<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|
struct|struct-specialization|
@@ -41,19 +41,19 @@
typedef|enum|data-member" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation + 2"/>
</xsl:apply-templates>
-
+
<!-- Emit namespace functions -->
- <xsl:apply-templates
- select="free-function-group|function|overloaded-function"
+ <xsl:apply-templates
+ select="free-function-group|function|overloaded-function"
mode="synopsis">
<xsl:with-param name="indentation" select="$indentation + 2"/>
</xsl:apply-templates>
-
+
<!-- Emit namespaces -->
<xsl:apply-templates select="namespace" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation + 2"/>
</xsl:apply-templates>
-
+
<!-- Close namespace -->
<xsl:text> </xsl:text>
<xsl:call-template name="indent">
@@ -90,7 +90,7 @@
<xsl:apply-templates select="class|class-specialization|
struct|struct-specialization|
union|union-specialization|enum|function|
- overloaded-function|data-member"
+ overloaded-function|data-member"
mode="namespace-reference"/>
</xsl:template>
Modified: sandbox/boost_docs/trunk/tools/boostbook/xsl/type.xsl
==============================================================================
--- sandbox/boost_docs/trunk/tools/boostbook/xsl/type.xsl (original)
+++ sandbox/boost_docs/trunk/tools/boostbook/xsl/type.xsl 2007-09-12 17:30:17 EDT (Wed, 12 Sep 2007)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
-
+
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
@@ -60,7 +60,7 @@
<xsl:template name="type.display.name">
<xsl:choose>
<xsl:when test="contains(local-name(.), 'class')">
- <xsl:text>Class </xsl:text>
+ <xsl:text>Class </xsl:text>
</xsl:when>
<xsl:when test="contains(local-name(.), 'struct')">
<xsl:text>Struct </xsl:text>
@@ -85,7 +85,7 @@
<xsl:value-of select="@name"/>
<xsl:apply-templates select="specialization"/>
</xsl:with-param>
- </xsl:call-template>
+ </xsl:call-template>
</xsl:template>
<!-- Determine the class key for the given node -->
@@ -98,7 +98,7 @@
<xsl:otherwise>
<xsl:value-of select="local-name($node)"/>
</xsl:otherwise>
- </xsl:choose>
+ </xsl:choose>
</xsl:template>
<!-- Emit class synopsis -->
@@ -106,7 +106,7 @@
struct|struct-specialization|
union|union-specialization" mode="synopsis">
<xsl:param name="indentation"/>
-
+
<!-- The keyword used to declare this class type, e.g., class,
struct, or union. -->
<xsl:variable name="class-key">
@@ -135,7 +135,7 @@
</xsl:variable>
<xsl:choose>
- <xsl:when test="(string-length($full-decl-string) +
+ <xsl:when test="(string-length($full-decl-string) +
string-length($indentation)) < $pre.text.max.columns">
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
@@ -170,11 +170,11 @@
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
<xsl:text> </xsl:text>
-
+
<!-- Indent class templates' names in the synopsis -->
<xsl:text> </xsl:text>
</xsl:if>
-
+
<!-- Class name -->
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
@@ -256,21 +256,21 @@
<!-- Create a vertical ellipsis -->
<xsl:when test="@name = '...'">
<xsl:call-template name="indent">
- <xsl:with-param name="indentation" select="$indentation + 3"/>
- </xsl:call-template>
+ <xsl:with-param name="indentation" select="$indentation + 3"/>
+ </xsl:call-template>
<xsl:text>. </xsl:text>
<xsl:call-template name="indent">
- <xsl:with-param name="indentation" select="$indentation + 3"/>
+ <xsl:with-param name="indentation" select="$indentation + 3"/>
</xsl:call-template>
<xsl:text>. </xsl:text>
<xsl:call-template name="indent">
- <xsl:with-param name="indentation" select="$indentation + 3"/>
+ <xsl:with-param name="indentation" select="$indentation + 3"/>
</xsl:call-template>
<xsl:text>.</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="indent">
- <xsl:with-param name="indentation" select="$indentation"/>
+ <xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="'typedef'"/>
@@ -299,24 +299,24 @@
<xsl:value-of select="@type"/>
</xsl:when>
<xsl:otherwise>
- <xsl:apply-templates select="type/*|type/text()"
+ <xsl:apply-templates select="type/*|type/text()"
mode="highlight"/>
<!--
<xsl:call-template name="source-highlight">
<xsl:with-param name="text">
<xsl:apply-templates select="type/*|type/text()"/>
</xsl:with-param>
- </xsl:call-template>
+ </xsl:call-template>
-->
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$max-type-length > 0">
- <xsl:value-of select="substring($type-padding, 1,
+ <xsl:value-of select="substring($type-padding, 1,
$max-type-length - $type-length)"/>
<xsl:text> </xsl:text>
- <xsl:value-of select="substring(concat(@name, ';', $name-padding),
+ <xsl:value-of select="substring(concat(@name, ';', $name-padding),
1, $max-name-length)"/>
</xsl:when>
<xsl:otherwise>
@@ -348,7 +348,7 @@
<xsl:param name="indentation"/>
<xsl:param name="max-type-length" select="0"/>
<xsl:param name="max-name-length" select="0"/>
-
+
<!-- True if we should compact this typedef -->
<xsl:variable name="compact"
select="not (para|description) and ($boost.compact.typedef='1')"/>
@@ -426,10 +426,10 @@
<xsl:call-template name="source-highlight">
<xsl:with-param name="text">
- <xsl:apply-templates select="type/*|type/text()"/>
+ <xsl:apply-templates select="type/*|type/text()"/>
</xsl:with-param>
</xsl:call-template>
-
+
<xsl:if test="not(@name = '')">
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
@@ -462,7 +462,7 @@
<xsl:template name="print.base.classes.multi">
<xsl:param name="indentation"/>
-
+
<xsl:variable name="n" select="count(inherit)"/>
<xsl:for-each select="inherit">
<!-- Indentation -->
@@ -543,7 +543,7 @@
</xsl:variable>
<xsl:choose>
- <xsl:when test="$single-line-candidate and
+ <xsl:when test="$single-line-candidate and
(string-length($single-line) + $indentation + 3
< $pre.text.max.columns)">
<xsl:text> : </xsl:text>
@@ -643,7 +643,7 @@
<xsl:with-param name="typedefs" select="$rest"/>
<xsl:with-param name="max-length" select="$max-length"/>
<xsl:with-param name="want-name" select="$want-name"/>
- </xsl:call-template>
+ </xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
@@ -651,7 +651,7 @@
<xsl:value-of select="$max-length"/>
</xsl:otherwise>
</xsl:choose>
- </xsl:template>
+ </xsl:template>
<xsl:template match="constructor" mode="synopsis">
<xsl:param name="indentation"/>
@@ -659,7 +659,9 @@
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="context" select="../@name"/>
<xsl:with-param name="is-reference" select="false()"/>
- <xsl:with-param name="constructor-for" select="../@name"/>
+ <xsl:with-param name="constructor-for">
+ <xsl:call-template name="object-name"/>
+ </xsl:with-param>
</xsl:call-template>
</xsl:template>
@@ -669,7 +671,9 @@
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="context" select="../@name"/>
<xsl:with-param name="is-reference" select="false()"/>
- <xsl:with-param name="copy-assign-for" select="../@name"/>
+ <xsl:with-param name="copy-assign-for">
+ <xsl:call-template name="object-name"/>
+ </xsl:with-param>
</xsl:call-template>
</xsl:template>
@@ -679,7 +683,111 @@
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="context" select="../@name"/>
<xsl:with-param name="is-reference" select="false()"/>
- <xsl:with-param name="destructor-for" select="../@name"/>
+ <xsl:with-param name="destructor-for">
+ <xsl:call-template name="object-name"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template name="class-members-synopsis">
+ <xsl:param name="indentation" select="0"/>
+
+ <!-- Typedefs -->
+ <xsl:if test="typedef">
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="indent">
+ <xsl:with-param name="indentation" select="$indentation + 2"/>
+ </xsl:call-template>
+ <xsl:call-template name="highlight-comment">
+ <xsl:with-param name="text" select="'// types'"/>
+ </xsl:call-template>
+
+ <xsl:variable name="max-type-length">
+ <xsl:call-template name="find-max-type-length"/>
+ </xsl:variable>
+ <xsl:variable name="max-name-length">
+ <xsl:call-template name="find-max-type-length">
+ <xsl:with-param name="want-name" select="true()"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:apply-templates select="typedef" mode="synopsis">
+ <xsl:with-param name="indentation" select="$indentation + 2"/>
+ <xsl:with-param name="max-type-length"
+ select="$max-type-length"/>
+ <xsl:with-param name="max-name-length"
+ select="$max-name-length"/>
+ </xsl:apply-templates>
+ </xsl:if>
+
+ <!-- Static constants -->
+ <xsl:if test="static-constant">
+ <xsl:text> </xsl:text>
+ <xsl:if test="typedef">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ <xsl:call-template name="indent">
+ <xsl:with-param name="indentation" select="$indentation + 2"/>
+ </xsl:call-template>
+ <xsl:call-template name="highlight-comment">
+ <xsl:with-param name="text" select="'// static constants'"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="static-constant" mode="synopsis">
+ <xsl:with-param name="indentation" select="$indentation + 2"/>
+ </xsl:apply-templates>
+ </xsl:if>
+
+ <!-- Nested classes/structs/unions -->
+ <xsl:apply-templates select="class|class-specialization|
+ struct|struct-specialization|
+ union|union-specialization"
+ mode="reference">
+ <xsl:with-param name="indentation" select="$indentation + 2"/>
+ </xsl:apply-templates>
+
+ <!-- Enums -->
+ <xsl:apply-templates select="enum" mode="synopsis">
+ <xsl:with-param name="indentation" select="$indentation + 2"/>
+ </xsl:apply-templates>
+
+ <!-- Construct/Copy/Destruct -->
+ <xsl:call-template name="construct-copy-destruct-synopsis">
+ <xsl:with-param name="indentation" select="$indentation + 2"/>
+ </xsl:call-template>
+
+ <!-- Member functions -->
+ <xsl:apply-templates
+ select="method-group|method|overloaded-method"
+ mode="synopsis">
+ <xsl:with-param name="indentation" select="$indentation + 2"/>
+ </xsl:apply-templates>
+
+ <!-- Data members -->
+ <xsl:apply-templates select="data-member" mode="synopsis">
+ <xsl:with-param name="indentation" select="$indentation + 2"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template name="print-access-specification">
+ <xsl:param name="indentation" select="0"/>
+ <xsl:param name="specification" select="'public'"/>
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="indent">
+ <xsl:with-param name="indentation" select="$indentation"/>
+ </xsl:call-template>
+ <xsl:call-template name="highlight-keyword">
+ <xsl:with-param name="keyword" select="$specification"/>
+ </xsl:call-template>
+ <xsl:text>:</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="access" mode="synopsis">
+ <xsl:param name="indentation" select="0"/>
+ <xsl:call-template name="print-access-specification">
+ <xsl:with-param name="indentation" select="$indentation"/>
+ <xsl:with-param name="specification" select="@name"/>
+ </xsl:call-template>
+ <xsl:call-template name="class-members-synopsis">
+ <xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
</xsl:template>
@@ -723,7 +831,7 @@
</xsl:apply-templates>
</xsl:if>
<xsl:text> </xsl:text>
-
+
<!-- Class name -->
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
@@ -734,13 +842,13 @@
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:apply-templates select="specialization"/>
-
+
<xsl:choose>
<xsl:when test="inherit">
<!-- Base class list (with opening brace) -->
<xsl:call-template name="print.base.classes">
- <xsl:with-param name="indentation"
- select="string-length($class-key) + string-length(@name)
+ <xsl:with-param name="indentation"
+ select="string-length($class-key) + string-length(@name)
+ $indentation + 1"/>
<xsl:with-param name="base-indentation" select="$indentation"/>
</xsl:call-template>
@@ -751,90 +859,26 @@
</xsl:otherwise>
</xsl:choose>
- <!-- Public designator -->
+ <!-- Default public designator for members not inside explicit <access> elements -->
<xsl:if test="contains(local-name(.), 'class')">
- <xsl:text> </xsl:text>
- <xsl:call-template name="indent">
- <xsl:with-param name="indentation" select="$indentation"/>
- </xsl:call-template>
- <xsl:call-template name="highlight-keyword">
- <xsl:with-param name="keyword" select="'public'"/>
- </xsl:call-template>
- <xsl:text>:</xsl:text>
- </xsl:if>
-
- <!-- Typedefs -->
- <xsl:if test="typedef">
- <xsl:text> </xsl:text>
- <xsl:call-template name="indent">
- <xsl:with-param name="indentation" select="$indentation + 2"/>
- </xsl:call-template>
- <xsl:call-template name="highlight-comment">
- <xsl:with-param name="text" select="'// types'"/>
- </xsl:call-template>
-
- <xsl:variable name="max-type-length">
- <xsl:call-template name="find-max-type-length"/>
- </xsl:variable>
- <xsl:variable name="max-name-length">
- <xsl:call-template name="find-max-type-length">
- <xsl:with-param name="want-name" select="true()"/>
+ <xsl:if test="count(static-constant|typedef|enum|
+ copy-assignment|constructor|destructor|method-group|
+ function|method|overloaded-method|data-member|
+ class|class-specialization|
+ struct|struct-specialization|
+ union|union-specialization) > 0">
+ <xsl:call-template name="print-access-specification">
+ <xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
- </xsl:variable>
- <xsl:apply-templates select="typedef" mode="synopsis">
- <xsl:with-param name="indentation" select="$indentation + 2"/>
- <xsl:with-param name="max-type-length"
- select="$max-type-length"/>
- <xsl:with-param name="max-name-length"
- select="$max-name-length"/>
- </xsl:apply-templates>
- </xsl:if>
-
- <!-- Static constants -->
- <xsl:if test="static-constant">
- <xsl:text> </xsl:text>
- <xsl:if test="typedef">
- <xsl:text> </xsl:text>
</xsl:if>
- <xsl:call-template name="indent">
- <xsl:with-param name="indentation" select="$indentation + 2"/>
- </xsl:call-template>
- <xsl:call-template name="highlight-comment">
- <xsl:with-param name="text" select="'// static constants'"/>
- </xsl:call-template>
- <xsl:apply-templates select="static-constant" mode="synopsis">
- <xsl:with-param name="indentation" select="$indentation + 2"/>
- </xsl:apply-templates>
</xsl:if>
-
- <!-- Nested classes/structs/unions -->
- <xsl:apply-templates select="class|class-specialization|
- struct|struct-specialization|
- union|union-specialization"
- mode="reference">
- <xsl:with-param name="indentation" select="$indentation + 2"/>
- </xsl:apply-templates>
-
- <!-- Enums -->
- <xsl:apply-templates select="enum" mode="synopsis">
- <xsl:with-param name="indentation" select="$indentation + 2"/>
- </xsl:apply-templates>
- <!-- Construct/Copy/Destruct -->
- <xsl:call-template name="construct-copy-destruct-synopsis">
- <xsl:with-param name="indentation" select="$indentation + 2"/>
+ <xsl:call-template name="class-members-synopsis">
+ <xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
- <!-- Member functions -->
- <xsl:apply-templates
- select="method-group|method|overloaded-method"
- mode="synopsis">
- <xsl:with-param name="indentation" select="$indentation + 2"/>
- </xsl:apply-templates>
-
- <!-- Data members -->
- <xsl:apply-templates select="data-member" mode="synopsis">
- <xsl:with-param name="indentation" select="$indentation + 2"/>
+ <xsl:apply-templates select="access" mode="synopsis">
+ <xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
<!-- Closing brace -->
@@ -856,6 +900,30 @@
</xsl:call-template>
</xsl:template>
+ <xsl:template name="class-members-reference">
+ <xsl:call-template name="construct-copy-destruct-reference"/>
+
+ <xsl:apply-templates
+ select="method-group|method|overloaded-method"
+ mode="reference"/>
+
+ <!-- Emit reference docs for nested classes -->
+ <xsl:apply-templates
+ select="class|class-specialization|
+ struct|struct-specialization|
+ union|union-specialization"
+ mode="namespace-reference"/>
+
+ <!-- Emit reference docs for nested enums -->
+ <xsl:apply-templates
+ select="enum"
+ mode="namespace-reference"/>
+ </xsl:template>
+
+ <xsl:template match="access" mode="namespace-reference">
+ <xsl:call-template name="class-members-reference"/>
+ </xsl:template>
+
<!-- Emit namespace-level class reference documentation -->
<xsl:template match="class|class-specialization|
struct|struct-specialization|
@@ -899,39 +967,24 @@
<xsl:apply-templates select="para" mode="annotation"/>
</xsl:if>
<xsl:apply-templates select="description"/>
-
- <xsl:call-template name="construct-copy-destruct-reference"/>
-
- <xsl:apply-templates
- select="method-group|method|overloaded-method"
- mode="reference"/>
-
- <!-- Emit reference docs for nested classes -->
- <xsl:apply-templates
- select="class|class-specialization|
- struct|struct-specialization|
- union|union-specialization"
- mode="namespace-reference"/>
-
- <!-- Emit reference docs for nested enums -->
- <xsl:apply-templates
- select="enum"
- mode="namespace-reference"/>
-
+
+ <xsl:call-template name="class-members-reference"/>
+ <xsl:apply-templates select="access" mode="namespace-reference"/>
+
<xsl:apply-templates select="free-function-group" mode="reference">
<xsl:with-param name="class" select="@name"/>
</xsl:apply-templates>
-
+
<!-- Specializations of this class -->
<!-- TBD: fix this. We should key off the class name and match
fully-qualified names -->
<xsl:variable name="name" select="@name"/>
- <xsl:if test="local-name(.)='class' and
+ <xsl:if test="local-name(.)='class' and
../class-specialization[@name=$name]">
<refsect2>
<title>Specializations</title>
<itemizedlist>
- <xsl:apply-templates
+ <xsl:apply-templates
select="../class-specialization[@name=$name]"
mode="specialization-list"/>
</itemizedlist>
@@ -971,7 +1024,7 @@
ancestor::union|ancestor::union-specialization">
<!-- Spacing -->
- <xsl:if
+ <xsl:if
test="not(local-name(preceding-sibling::*[position()=1])=local-name(.))">
<xsl:text> </xsl:text>
</xsl:if>
@@ -1020,9 +1073,9 @@
<xsl:param name="indentation"/>
<!-- Spacing -->
- <xsl:if
+ <xsl:if
test="(not (local-name(preceding-sibling::*[position()=1])=local-name(.))
- and (position() > 1)) or
+ and (position() > 1)) or
not (para or description or not ($boost.compact.enum=1))">
<xsl:text> </xsl:text>
</xsl:if>
@@ -1079,7 +1132,7 @@
</xsl:call-template>
<xsl:text> </xsl:text>
-
+
<xsl:call-template name="anchor">
<xsl:with-param name="to">
<xsl:call-template name="generate.id">
@@ -1150,7 +1203,7 @@
<xsl:text> </xsl:text>
</xsl:if>
- <xsl:text> </xsl:text>
+ <xsl:text> </xsl:text>
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="'enum'"/>
@@ -1165,12 +1218,12 @@
<xsl:with-param name="indentation" select="4 + string-length($header)"/>
</xsl:call-template>
- <xsl:text> };</xsl:text>
+ <xsl:text> };</xsl:text>
</xsl:template>
<!-- List enumeration values in a compact form e.g.,
- enum Name { value1 = foo, value2 = bar, ... };
- This routine prints only the enumeration values; the caller is
+ enum Name { value1 = foo, value2 = bar, ... };
+ This routine prints only the enumeration values; the caller is
responsible for printing everything outside the braces
(inclusive). -->
<xsl:template name="type.enum.list.compact">
@@ -1190,7 +1243,7 @@
<xsl:if test="not($pos > count(enumvalue))">
<xsl:variable name="value" select="enumvalue[position()=$pos]"/>
-
+
<!-- Compute the string to be printed for this value -->
<xsl:variable name="result">
<xsl:value-of select="$prefix"/>
@@ -1214,8 +1267,8 @@
<xsl:value-of select="$end"/>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of select="$indentation
- + string-length($result)
+ <xsl:value-of select="$indentation
+ + string-length($result)
- string-length($prefix)"/>
</xsl:otherwise>
</xsl:choose>
@@ -1254,7 +1307,7 @@
print it. -->
<xsl:if test="$value/default">
<xsl:text> = </xsl:text>
- <xsl:apply-templates
+ <xsl:apply-templates
select="$value/default/*|$value/default/text()"/>
</xsl:if>
Modified: sandbox/boost_docs/trunk/tools/boostbook/xsl/utility.xsl
==============================================================================
--- sandbox/boost_docs/trunk/tools/boostbook/xsl/utility.xsl (original)
+++ sandbox/boost_docs/trunk/tools/boostbook/xsl/utility.xsl 2007-09-12 17:30:17 EDT (Wed, 12 Sep 2007)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
-
+
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
@@ -20,4 +20,33 @@
</xsl:if>
</xsl:template>
+ <!-- get name of first ancestor-or-self which is a class, struct or union -->
+ <xsl:template name="object-name">
+ <xsl:value-of select="(ancestor-or-self::class |
+ ancestor-or-self::class-specialization |
+ ancestor-or-self::struct |
+ ancestor-or-self::struct-specialization |
+ ancestor-or-self::union |
+ ancestor-or-self::union-specialization)/@name[last()]"/>
+ </xsl:template>
+
+ <!-- get name of access specification that we are inside -->
+ <xsl:template name="access-name">
+ <xsl:variable name="ancestors" select="ancestor-or-self::access |
+ ancestor-or-self::class |
+ ancestor-or-self::class-specialization |
+ ancestor-or-self::struct |
+ ancestor-or-self::struct-specialization |
+ ancestor-or-self::union |
+ ancestor-or-self::union-specialization"/>
+ <xsl:choose>
+ <xsl:when test="name($ancestors[last()])='access'">
+ <xsl:value-of select="$ancestors[last()]/@name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ public
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
</xsl:stylesheet>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk