mirror of
https://github.com/boostorg/boostbook.git
synced 2025-05-09 15:03:57 +00:00
dtd/boostbook.dtd:
- Parameters can now have <description> elements - Add function specifiers xsl/function.xsl: - When needed, place function return type on a separate line - Format <description> element for parameters - Use "spacing=boost" for variablelists used for function requirements xsl/doxygen/doxygen2boostbook.xsl: - Emit <description> elements for parameters when available - Properly translate file descriptions [SVN r18963]
This commit is contained in:
parent
9bc590a839
commit
bfa67ad183
@ -211,7 +211,8 @@
|
|||||||
|
|
||||||
<!ELEMENT data-member (type, purpose?, description?)>
|
<!ELEMENT data-member (type, purpose?, description?)>
|
||||||
<!ATTLIST data-member
|
<!ATTLIST data-member
|
||||||
name CDATA #REQUIRED
|
name CDATA #REQUIRED
|
||||||
|
specifiers CDATA #IMPLIED
|
||||||
%boost.common.attrib;>
|
%boost.common.attrib;>
|
||||||
|
|
||||||
<!ELEMENT paramtype ANY>
|
<!ELEMENT paramtype ANY>
|
||||||
@ -370,7 +371,7 @@
|
|||||||
|
|
||||||
<!ELEMENT if-fails ANY>
|
<!ELEMENT if-fails ANY>
|
||||||
|
|
||||||
<!ELEMENT parameter (paramtype, default?)>
|
<!ELEMENT parameter (paramtype, default?, description?)>
|
||||||
<!ATTLIST parameter
|
<!ATTLIST parameter
|
||||||
name CDATA #IMPLIED>
|
name CDATA #IMPLIED>
|
||||||
|
|
||||||
|
@ -267,8 +267,10 @@ Cannot handle compounddef with kind=<xsl:value-of select="@kind"/>
|
|||||||
string(compoundname))"/>
|
string(compoundname))"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
|
|
||||||
<xsl:apply-templates select="briefdescription" mode="passthrough"/>
|
<xsl:if test="briefdescription/*|detaileddescription/*">
|
||||||
<xsl:apply-templates select="detaileddescription" mode="passthrough"/>
|
<xsl:apply-templates select="briefdescription/*" mode="passthrough"/>
|
||||||
|
<xsl:apply-templates select="detaileddescription/*" mode="passthrough"/>
|
||||||
|
</xsl:if>
|
||||||
|
|
||||||
<xsl:apply-templates mode="toplevel">
|
<xsl:apply-templates mode="toplevel">
|
||||||
<xsl:with-param name="with-namespace-refs"
|
<xsl:with-param name="with-namespace-refs"
|
||||||
@ -455,6 +457,9 @@ Cannot handle compounddef with kind=<xsl:value-of select="@kind"/>
|
|||||||
</method-group>
|
</method-group>
|
||||||
<xsl:apply-templates/>
|
<xsl:apply-templates/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
<xsl:when test="@kind='public-static-attrib' or @kind='public-attrib'">
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
</xsl:when>
|
||||||
<xsl:when test="@kind='public-type'">
|
<xsl:when test="@kind='public-type'">
|
||||||
<xsl:apply-templates/>
|
<xsl:apply-templates/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
@ -466,9 +471,15 @@ Cannot handle compounddef with kind=<xsl:value-of select="@kind"/>
|
|||||||
<xsl:when test="@kind='typedef'">
|
<xsl:when test="@kind='typedef'">
|
||||||
<xsl:apply-templates/>
|
<xsl:apply-templates/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
<xsl:when test="@kind='var'">
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
</xsl:when>
|
||||||
<xsl:when test="@kind='enum'">
|
<xsl:when test="@kind='enum'">
|
||||||
<xsl:apply-templates/>
|
<xsl:apply-templates/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
<xsl:when test="@kind='user-defined'">
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:message>
|
<xsl:message>
|
||||||
Cannot handle sectiondef with kind=<xsl:value-of select="@kind"/>
|
Cannot handle sectiondef with kind=<xsl:value-of select="@kind"/>
|
||||||
@ -532,6 +543,9 @@ Cannot handle sectiondef with kind=<xsl:value-of select="@kind"/>
|
|||||||
<xsl:when test="@kind='enum'">
|
<xsl:when test="@kind='enum'">
|
||||||
<xsl:call-template name="enum"/>
|
<xsl:call-template name="enum"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
<xsl:when test="@kind='variable'">
|
||||||
|
<xsl:call-template name="variable"/>
|
||||||
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:message>
|
<xsl:message>
|
||||||
Cannot handle memberdef element with kind=<xsl:value-of select="@kind"/>
|
Cannot handle memberdef element with kind=<xsl:value-of select="@kind"/>
|
||||||
@ -572,16 +586,42 @@ Cannot handle memberdef element with kind=<xsl:value-of select="@kind"/>
|
|||||||
<xsl:apply-templates select="type/*|type/text()" mode="passthrough"/>
|
<xsl:apply-templates select="type/*|type/text()" mode="passthrough"/>
|
||||||
</paramtype>
|
</paramtype>
|
||||||
|
|
||||||
<!-- TBD: handling of parameter descriptions -->
|
<!-- Default argument -->
|
||||||
<xsl:if test="defval">
|
<xsl:if test="defval">
|
||||||
<default>
|
<default>
|
||||||
<xsl:apply-templates select="defval/*|defval/text()"
|
<xsl:apply-templates select="defval/*|defval/text()"
|
||||||
mode="passthrough"/>
|
mode="passthrough"/>
|
||||||
</default>
|
</default>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
|
<!-- Parameter description -->
|
||||||
|
<xsl:variable name="name">
|
||||||
|
<xsl:value-of select="declname/text()"/>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
|
<xsl:apply-templates select="../detaileddescription/para/parameterlist[attribute::kind='param']/parameterdescription"
|
||||||
|
mode="parameter.description">
|
||||||
|
<xsl:with-param name="name">
|
||||||
|
<xsl:value-of select="$name"/>
|
||||||
|
</xsl:with-param>
|
||||||
|
</xsl:apply-templates>
|
||||||
</parameter>
|
</parameter>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="parameterdescription" mode="parameter.description">
|
||||||
|
<!-- The parameter name we are looking for -->
|
||||||
|
<xsl:param name="name"/>
|
||||||
|
|
||||||
|
<!-- The parametername node associated with this description -->
|
||||||
|
<xsl:variable name="name-node" select="../*[position()=1]"/>
|
||||||
|
|
||||||
|
<xsl:if test="string($name-node/text()) = $name">
|
||||||
|
<description>
|
||||||
|
<xsl:apply-templates select="para" mode="passthrough"/>
|
||||||
|
</description>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<!-- Handle function children -->
|
<!-- Handle function children -->
|
||||||
<xsl:template name="function.children">
|
<xsl:template name="function.children">
|
||||||
<!-- Emit template header -->
|
<!-- Emit template header -->
|
||||||
@ -683,6 +723,30 @@ Cannot handle memberdef element with kind=<xsl:value-of select="@kind"/>
|
|||||||
</method>
|
</method>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Handle member variables -->
|
||||||
|
<xsl:template name="variable">
|
||||||
|
<data-member>
|
||||||
|
<xsl:attribute name="name">
|
||||||
|
<xsl:value-of select="name/text()"/>
|
||||||
|
</xsl:attribute>
|
||||||
|
|
||||||
|
<!-- Specifiers -->
|
||||||
|
<xsl:if test="@static = 'yes'">
|
||||||
|
<xsl:attribute name="specifiers">static</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="@mutable = 'yes'">
|
||||||
|
<xsl:attribute name="specifiers">mutable</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
|
||||||
|
<type>
|
||||||
|
<xsl:apply-templates select="type/text()|type/*" mode="passthrough"/>
|
||||||
|
</type>
|
||||||
|
|
||||||
|
<xsl:apply-templates select="briefdescription" mode="passthrough"/>
|
||||||
|
<xsl:apply-templates select="detaileddescription" mode="passthrough"/>
|
||||||
|
</data-member>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<!-- Things we ignore directly -->
|
<!-- Things we ignore directly -->
|
||||||
<xsl:template match="compoundname" mode="toplevel"/>
|
<xsl:template match="compoundname" mode="toplevel"/>
|
||||||
<xsl:template match="includes|includedby|incdepgraph|invincdepgraph" mode="toplevel"/>
|
<xsl:template match="includes|includedby|incdepgraph|invincdepgraph" mode="toplevel"/>
|
||||||
|
128
xsl/function.xsl
128
xsl/function.xsl
@ -14,6 +14,13 @@
|
|||||||
"standardese", for now -->
|
"standardese", for now -->
|
||||||
<xsl:param name="boost.generation.mode">compact</xsl:param>
|
<xsl:param name="boost.generation.mode">compact</xsl:param>
|
||||||
|
|
||||||
|
<!-- The longest type length that is considered "short" for the
|
||||||
|
layout of function return types. When the length of the result type
|
||||||
|
and any storage specifiers is greater than this length, they will be
|
||||||
|
placed on a separate line from the function name and parameters
|
||||||
|
unless everything fits on a single line. -->
|
||||||
|
<xsl:param name="boost.short.result.type">6</xsl:param>
|
||||||
|
|
||||||
<!-- Display a function declaration -->
|
<!-- Display a function declaration -->
|
||||||
<xsl:template name="function">
|
<xsl:template name="function">
|
||||||
<xsl:param name="indentation"/>
|
<xsl:param name="indentation"/>
|
||||||
@ -56,6 +63,9 @@
|
|||||||
<!-- True if this is the function's separate documentation -->
|
<!-- True if this is the function's separate documentation -->
|
||||||
<xsl:param name="standalone" select="false()"/>
|
<xsl:param name="standalone" select="false()"/>
|
||||||
|
|
||||||
|
<!-- True if we should suppress the template header -->
|
||||||
|
<xsl:param name="suppress-template" select="false()"/>
|
||||||
|
|
||||||
<!-- Calculate the type -->
|
<!-- Calculate the type -->
|
||||||
<xsl:variable name="type">
|
<xsl:variable name="type">
|
||||||
<xsl:if test="@specifiers">
|
<xsl:if test="@specifiers">
|
||||||
@ -109,7 +119,8 @@
|
|||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
<xsl:if test="not ($standalone) or
|
<xsl:if test="not ($standalone) or
|
||||||
(local-name(.)='signature' and (position() > 1))">
|
(local-name(.)='signature' and (position() > 1))
|
||||||
|
or $suppress-template">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
@ -120,7 +131,14 @@
|
|||||||
|
|
||||||
<!-- Build the template header -->
|
<!-- Build the template header -->
|
||||||
<xsl:variable name="template-length">
|
<xsl:variable name="template-length">
|
||||||
<xsl:call-template name="template.synopsis.length"/>
|
<xsl:choose>
|
||||||
|
<xsl:when test="$suppress-template">
|
||||||
|
0
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:call-template name="template.synopsis.length"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
<!-- Build a full parameter string (without line breaks) -->
|
<!-- Build a full parameter string (without line breaks) -->
|
||||||
@ -156,40 +174,21 @@
|
|||||||
<xsl:apply-templates select="template" mode="synopsis">
|
<xsl:apply-templates select="template" mode="synopsis">
|
||||||
<xsl:with-param name="indentation" select="$indentation"/>
|
<xsl:with-param name="indentation" select="$indentation"/>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
<xsl:call-template name="indent">
|
|
||||||
<xsl:with-param name="indentation" select="$indentation + 2"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
|
|
||||||
<!-- Emit the function declaration without parameters -->
|
<!-- Emit the rest of the function declaration (without the
|
||||||
<xsl:call-template name="source-highlight">
|
template header) indented two extra spaces. -->
|
||||||
<xsl:with-param name="text" select="$type"/>
|
<xsl:call-template name="function">
|
||||||
</xsl:call-template>
|
<xsl:with-param name="indentation" select="$indentation + 2"/>
|
||||||
<xsl:call-template name="link-or-anchor">
|
<xsl:with-param name="is-reference" select="$is-reference"/>
|
||||||
<xsl:with-param name="to" select="$link-to"/>
|
|
||||||
<xsl:with-param name="text">
|
|
||||||
<xsl:call-template name="source-highlight">
|
|
||||||
<xsl:with-param name="text"
|
|
||||||
select="$function-name"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:with-param>
|
|
||||||
<xsl:with-param name="link-type" select="$link-type"/>
|
|
||||||
<xsl:with-param name="highlight" select="true()"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
|
|
||||||
<!-- Emit the parameters -->
|
|
||||||
<xsl:text>(</xsl:text>
|
|
||||||
<xsl:call-template name="function-parameters">
|
|
||||||
<xsl:with-param name="include-names" select="$include-names"/>
|
<xsl:with-param name="include-names" select="$include-names"/>
|
||||||
<xsl:with-param name="indentation"
|
<xsl:with-param name="link-type" select="$link-type"/>
|
||||||
select="$indentation + 3 + string-length($type) +
|
<xsl:with-param name="link-to" select="$link-to"/>
|
||||||
string-length($function-name)"/>
|
<xsl:with-param name="constructor-for" select="$constructor-for"/>
|
||||||
<xsl:with-param name="final" select="true()"/>
|
<xsl:with-param name="destructor-for" select="$destructor-for"/>
|
||||||
</xsl:call-template>
|
<xsl:with-param name="copy-assign-for" select="$copy-assign-for"/>
|
||||||
<xsl:text>)</xsl:text>
|
<xsl:with-param name="name" select="$name"/>
|
||||||
|
<xsl:with-param name="standalone" select="$standalone"/>
|
||||||
<xsl:call-template name="source-highlight">
|
<xsl:with-param name="suppress-template" select="true()"/>
|
||||||
<xsl:with-param name="text" select="$postdeclarator"/>
|
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
|
||||||
@ -198,11 +197,13 @@
|
|||||||
<xsl:call-template name="link-or-anchor">
|
<xsl:call-template name="link-or-anchor">
|
||||||
<xsl:with-param name="to" select="$link-to"/>
|
<xsl:with-param name="to" select="$link-to"/>
|
||||||
<xsl:with-param name="text">
|
<xsl:with-param name="text">
|
||||||
<xsl:apply-templates select="template" mode="synopsis">
|
<xsl:if test="not($suppress-template)">
|
||||||
<xsl:with-param name="indentation" select="$indentation"/>
|
<xsl:apply-templates select="template" mode="synopsis">
|
||||||
<xsl:with-param name="wrap" select="false()"/>
|
<xsl:with-param name="indentation" select="$indentation"/>
|
||||||
<xsl:with-param name="highlight" select="false()"/>
|
<xsl:with-param name="wrap" select="false()"/>
|
||||||
</xsl:apply-templates>
|
<xsl:with-param name="highlight" select="false()"/>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</xsl:if>
|
||||||
<xsl:value-of select="$type"/>
|
<xsl:value-of select="$type"/>
|
||||||
<xsl:value-of select="$function-name"/>
|
<xsl:value-of select="$function-name"/>
|
||||||
<xsl:text>(</xsl:text>
|
<xsl:text>(</xsl:text>
|
||||||
@ -218,17 +219,35 @@
|
|||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
<xsl:with-param name="link-type" select="$link-type"/>
|
<xsl:with-param name="link-type" select="$link-type"/>
|
||||||
<xsl:with-param name="highlight" select="true()"/>
|
<xsl:with-param name="highlight" select="true()"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
|
<xsl:text>;</xsl:text>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
|
||||||
<!-- This declaration will take multiple lines -->
|
<!-- This declaration will take multiple lines -->
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:apply-templates select="template" mode="synopsis">
|
|
||||||
<xsl:with-param name="indentation" select="$indentation"/>
|
|
||||||
</xsl:apply-templates>
|
|
||||||
<xsl:call-template name="source-highlight">
|
<xsl:call-template name="source-highlight">
|
||||||
<xsl:with-param name="text" select="$type"/>
|
<xsl:with-param name="text" select="$type"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
|
<xsl:if test="string-length($type) > $boost.short.result.type">
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<xsl:call-template name="indent">
|
||||||
|
<xsl:with-param name="indentation" select="$indentation"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:if>
|
||||||
|
|
||||||
|
<!-- Determine how many columns the type and storage
|
||||||
|
specifiers take on the same line as the function name. -->
|
||||||
|
<xsl:variable name="type-length">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="string-length($type) > $boost.short.result.type">
|
||||||
|
0
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="string-length($type)"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
<xsl:call-template name="link-or-anchor">
|
<xsl:call-template name="link-or-anchor">
|
||||||
<xsl:with-param name="to" select="$link-to"/>
|
<xsl:with-param name="to" select="$link-to"/>
|
||||||
<xsl:with-param name="text" select="$function-name"/>
|
<xsl:with-param name="text" select="$function-name"/>
|
||||||
@ -239,7 +258,7 @@
|
|||||||
<xsl:call-template name="function-parameters">
|
<xsl:call-template name="function-parameters">
|
||||||
<xsl:with-param name="include-names" select="$include-names"/>
|
<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)
|
select="$indentation + $type-length
|
||||||
+ string-length($function-name) + 1"/>
|
+ string-length($function-name) + 1"/>
|
||||||
<xsl:with-param name="final" select="true()"/>
|
<xsl:with-param name="final" select="true()"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
@ -247,9 +266,9 @@
|
|||||||
<xsl:call-template name="source-highlight">
|
<xsl:call-template name="source-highlight">
|
||||||
<xsl:with-param name="text" select="$postdeclarator"/>
|
<xsl:with-param name="text" select="$postdeclarator"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
|
<xsl:text>;</xsl:text>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
<xsl:text>;</xsl:text>
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- Synopsis of function parameters, e.g., "(const T&, int x = 5)" -->
|
<!-- Synopsis of function parameters, e.g., "(const T&, int x = 5)" -->
|
||||||
@ -660,6 +679,23 @@
|
|||||||
<xsl:apply-templates select="purpose/*"/>
|
<xsl:apply-templates select="purpose/*"/>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
|
<!-- Document parameters -->
|
||||||
|
<xsl:if test="parameter/description">
|
||||||
|
<variablelist spacing="compact">
|
||||||
|
<title>Parameters</title>
|
||||||
|
<xsl:for-each select="parameter">
|
||||||
|
<xsl:if test="description">
|
||||||
|
<varlistentry>
|
||||||
|
<term><xsl:value-of select="@name"/></term>
|
||||||
|
<listitem>
|
||||||
|
<xsl:apply-templates select="description/*"/>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:for-each>
|
||||||
|
</variablelist>
|
||||||
|
</xsl:if>
|
||||||
|
|
||||||
<xsl:apply-templates select="description/*"/>
|
<xsl:apply-templates select="description/*"/>
|
||||||
|
|
||||||
<xsl:if test="para">
|
<xsl:if test="para">
|
||||||
@ -715,7 +751,7 @@
|
|||||||
|
|
||||||
<!-- The "compact" function requirements mode uses variable lists -->
|
<!-- The "compact" function requirements mode uses variable lists -->
|
||||||
<xsl:template name="function.requirements.compact">
|
<xsl:template name="function.requirements.compact">
|
||||||
<variablelist>
|
<variablelist spacing="boost">
|
||||||
<xsl:apply-templates
|
<xsl:apply-templates
|
||||||
select="requires|effects|postconditions|returns|throws|complexity|
|
select="requires|effects|postconditions|returns|throws|complexity|
|
||||||
notes|rationale"
|
notes|rationale"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user