Merge Boostbook.

- Support some colour roles (thanks to Paul Bristow).
- Support assignment return types in doxygen2boostbook. Fixes #9241.
- Fix virtual methods in doxygen2boostbook.
- Add newlines to doxygen2boostbook to make the output a tad more readable.
- Improved last-revision handling.
- Support noexcept and constexpr in doxygen2boostbook.
- Improved boostbook for virtual and explicit methods from doxygen2boostbook.
- Support `language="c++"` attribute for `code` and `programlisting` elements.
- Use that to do syntax highlighting for doxygen2boostbook.


[SVN r86725]
This commit is contained in:
Daniel James 2013-11-16 20:10:31 +00:00
parent dfe3b4dfe5
commit ebfbc08fce
10 changed files with 467 additions and 207 deletions

View File

@ -1,12 +1,60 @@
<?xml version="1.0" standalone="yes"?>
<library-reference id="example_reference"><title>Example Reference</title><header name="boost/example.hpp"><namespace name="example"><class name="example"><purpose>Documentation for class example. </purpose><class name="inner_class"><data-member name="x"><type>int</type></data-member></class><enum name="class_enum"><enumvalue name="enumerator"/></enum><typedef name="documented_type1"><description><para>This type has documentation. </para></description><type>int</type></typedef><typedef name="documented_type2"><purpose>This type has documentation. </purpose><type>long</type></typedef><typedef name="documented_type3"><description><para>This type has documentation. </para></description><type>long double</type></typedef><typedef name="undocumented_type1"><type>short</type></typedef><typedef name="undocumented_type2"><type>double</type></typedef><data-member name="integer"><type>int</type></data-member><data-member name="mutable_integer" specifiers="mutable"><type>int</type></data-member><data-member name="const_integer"><type>const int</type></data-member><data-member name="static_integer" specifiers="static"><type>int</type></data-member><data-member name="static_const_integer" specifiers="static"><type>const int</type></data-member><method-group name="public member functions"><method name="conversion-operator" cv="" specifiers="explicit"><type>int</type></method></method-group><constructor cv="= default"><parameter name=""><paramtype><classname>example</classname> const &amp;</paramtype></parameter></constructor><copy-assignment cv="= delete"><parameter name=""><paramtype><classname>example</classname> const &amp;</paramtype></parameter></copy-assignment></class><struct name="example_template"><template>
<library-reference id="example_reference"><title>Example Reference</title><header name="boost/example.hpp">
<namespace name="example">
<class name="example"><purpose>Documentation for class example. </purpose><description><para>Detailed documentation</para><para><programlisting language="c++">void class_code_sample();
</programlisting> </para></description><class name="inner_class"><data-member name="x"><type>int</type></data-member>
</class><enum name="class_enum"><enumvalue name="enumerator"/></enum>
<typedef name="documented_type1"><description><para>This type has documentation. </para></description><type>int</type></typedef>
<typedef name="documented_type2"><purpose>This type has documentation. </purpose><type>long</type></typedef>
<typedef name="documented_type3"><description><para>This type has documentation. </para></description><type>long double</type></typedef>
<typedef name="undocumented_type1"><type>short</type></typedef>
<typedef name="undocumented_type2"><type>double</type></typedef>
<data-member name="integer"><type>int</type></data-member>
<data-member name="mutable_integer" specifiers="mutable"><type>int</type></data-member>
<data-member name="const_integer"><type>const int</type></data-member>
<data-member name="static_integer" specifiers="static"><type>int</type></data-member>
<data-member name="static_const_integer" specifiers="static"><type>const int</type></data-member>
<method-group name="public member functions">
<method name="virtual_method" specifiers="virtual"><type>int</type></method>
<method name="virtual_abstract_method" cv="= 0" specifiers="virtual"><type>int</type></method>
<method name="virtual_const_method" cv="const" specifiers="virtual"><type>int</type></method>
<method name="method_with_default_value"><type>int</type><parameter name=""><paramtype>int</paramtype><default>default_value</default></parameter></method>
<method name="method_with_fp"><type>int</type><parameter name="fp"><paramtype>int(*)()</paramtype></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
<method name="method_with_string_default1"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>")"</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
<method name="method_with_string_default2"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>"("</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
<method name="method_with_char_default1"><type>int</type><parameter name=""><paramtype>char</paramtype><default>'('</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
<method name="method_with_char_default2"><type>int</type><parameter name=""><paramtype>char</paramtype><default>')'</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
<method name="volatile_method_with_fp" cv="volatile"><type>int</type><parameter name="fp"><paramtype>int(*)()</paramtype></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
<method name="volatile_method_with_string_default1" cv="volatile"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>")"</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
<method name="volatile_method_with_string_default2" cv="volatile"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>"("</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
<method name="volatile_method_with_char_default1" cv="volatile"><type>int</type><parameter name=""><paramtype>char</paramtype><default>'('</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
<method name="volatile_method_with_char_default2" cv="volatile"><type>int</type><parameter name=""><paramtype>char</paramtype><default>')'</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
<method name="const_method" cv="const"><type>void</type></method>
<method name="volatile_method" cv="volatile"><type>void</type></method>
<method name="trad_noexcept" cv="noexcept"><type>void</type></method>
<method name="trad_noexcept_if" cv="noexcept(a==b &amp;&amp;(c||d)))"><type>void</type></method>
<method name="boost_noexcept" cv="noexcept"><type>void</type></method>
<method name="boost_noexcept_if" cv="noexcept(condition)"><type>void</type></method>
<method name="trad_constexpr" cv="constexpr"><type>void</type></method>
<method name="boost_constexpr" cv="constexpr"><type>void</type></method>
<method name="boost_constexpr_or_const" cv="constexpr"><type>void</type></method>
<method name="constexpr_noexcept" cv="constexpr noexcept"><type>void</type></method>
<method name="conversion-operator" specifiers="explicit"><type>int</type></method>
</method-group>
<constructor cv="= default"><parameter name=""><paramtype><classname>example</classname> const &amp;</paramtype></parameter></constructor>
<copy-assignment cv="= delete"><type><classname>example</classname> &amp;</type><parameter name=""><paramtype><classname>example</classname> const &amp;</paramtype></parameter></copy-assignment>
<method-group name="public static functions">
<method name="static_method" specifiers="static"><type>int</type></method>
<method name="static_constexpr" cv="constexpr" specifiers="static"><type>int</type></method>
</method-group>
</class><struct name="example_template"><template>
<template-type-parameter name="TypeParameter"><purpose><para>A template parameter </para></purpose></template-type-parameter>
<template-nontype-parameter name="NonTypeParameter"><type>int</type><purpose><para>This is a non-type template parameter </para></purpose></template-nontype-parameter>
<template-type-parameter name="TypeParameterWithDefault"><default>int</default><purpose><para>This is a template parameter with a default argument </para></purpose></template-type-parameter>
</template><description><para>Test some doxygen markup</para><para><warning><para>This is just an example.</para></warning>
Embedded docbook list:</para><para>
<orderedlist><listitem><simpara>1</simpara></listitem><listitem><simpara>2</simpara></listitem></orderedlist>
</para><para><emphasis>Special</emphasis> <emphasis role="bold">Bold</emphasis> <computeroutput>Typewriter</computeroutput> <emphasis>Italics</emphasis> <emphasis>emphasis</emphasis> <computeroutput>parameter</computeroutput> </para><para><itemizedlist>
<orderedlist><listitem><simpara>1</simpara></listitem><listitem><simpara>2</simpara></listitem></orderedlist>
</para><para><emphasis>Special</emphasis> <emphasis role="bold">Bold</emphasis> <computeroutput>Typewriter</computeroutput> <emphasis>Italics</emphasis> <emphasis>emphasis</emphasis> <computeroutput>parameter</computeroutput> </para><para><itemizedlist>
<listitem><para>Arg1 first argument. </para></listitem>
<listitem><para>Arg2 second argument.</para></listitem>
</itemizedlist>
@ -15,19 +63,37 @@ Embedded docbook list:</para><para>
<listitem><para>Second list item</para></listitem>
</itemizedlist>
Line 1<sbr/>
Line 2</para><para><programlisting> void foo() {}
Line 2</para><para><programlisting language="c++">void foo() {}
</programlisting></para><para>
</para></description></struct><struct name="specialization_test"><template>
<template-type-parameter name="T"/>
</template></struct><struct-specialization name="specialization_test"><template>
<template-type-parameter name="T"/>
</template><specialization><template-arg>T *</template-arg></specialization><method-group name="public member functions"/><constructor><description><para>A constructor. </para></description></constructor><destructor><description><para>A destructor. </para></description></destructor><copy-assignment cv=""><parameter name=""><paramtype>const <classname>specialization_test</classname> &amp;</paramtype></parameter><description><para>An assignment operator. </para></description></copy-assignment></struct-specialization><enum name="namespace_enum"><enumvalue name="enumerator"/></enum><data-member name="namespace_integer"><type>int</type></data-member><data-member name="namespace_static_integer" specifiers="static"><type>int</type></data-member><data-member name="namespace_const_integer"><type>const int</type></data-member><data-member name="namespace_static_const_integer" specifiers="static"><type>const int</type></data-member><function name="namespace_func"><type>int</type><parameter name="i"><paramtype>int</paramtype><description><para>A function parameter </para></description></parameter><parameter name="j"><paramtype>int</paramtype><description><para>Another </para></description></parameter><description><para>
</template><specialization><template-arg>T *</template-arg></specialization><method-group name="public member functions">
</method-group>
<constructor><description><para>A constructor. </para></description></constructor>
<destructor><description><para>A destructor. </para></description></destructor>
<copy-assignment><type><emphasis>unspecified</emphasis></type><parameter name=""><paramtype>const <classname>specialization_test</classname> &amp;</paramtype></parameter><description><para>An assignment operator. </para></description></copy-assignment>
</struct-specialization><enum name="namespace_enum"><enumvalue name="enumerator"/></enum>
<data-member name="namespace_integer"><type>int</type></data-member>
<data-member name="namespace_static_integer" specifiers="static"><type>int</type></data-member>
<data-member name="namespace_const_integer"><type>const int</type></data-member>
<data-member name="namespace_static_const_integer" specifiers="static"><type>const int</type></data-member>
<function name="free_function"><type>void</type><parameter name="x"><paramtype>int</paramtype><description><para>Parameter description.</para></description></parameter><description><para>
<programlisting language="c++">void function_code_sample();
</programlisting> </para></description></function>
<function name="namespace_func"><type>int</type><parameter name="i"><paramtype>int</paramtype><description><para>A function parameter </para></description></parameter><parameter name="j"><paramtype>int</paramtype><description><para>Another </para></description></parameter><description><para>
This is a test function. <classname alt="example::example">Link to class</classname> <classname alt="example::example_template">Link to class template</classname> <note><para>This is a note.</para></note>
<para><emphasis role="bold">See Also:</emphasis><para><classname alt="example::example">example::example</classname> and <classname alt="example::example_template">example_template</classname> </para></para>
</para></description><requires><para>i &gt; j</para></requires><returns><para>The answer </para></returns></function><function name="namespace_func_template"><type>void</type><template>
</para></description><requires><para>i &gt; j</para></requires><returns><para>The answer </para></returns></function>
<function name="namespace_func_template"><type>void</type><template>
<template-type-parameter name="TypeParameter"><purpose><para>A template parameter </para></purpose></template-type-parameter>
<template-nontype-parameter name="NonTypeParameter"><type>int</type><purpose><para>This is a non-type template parameter </para></purpose></template-nontype-parameter>
</template><description><para>Testing a function template.
</para></description></function></namespace><macro name="EXAMPLE" kind="functionlike"><macro-parameter name="m"/><purpose>Documentation for macro example. </purpose></macro></header></library-reference>
</para></description></function>
</namespace>
<macro name="EXAMPLE" kind="functionlike"><macro-parameter name="m"/><purpose>Documentation for macro example. </purpose></macro>
</header>
</library-reference>

View File

@ -7,6 +7,12 @@
\class example::example
\brief Documentation for class example
Detailed documentation
\code{.cpp}
void class_code_sample();
\endcode
*/
/*!
@ -23,6 +29,16 @@ enum global_enum { enumerator1 = 1, enumerator2 };
namespace example
{
/*!
\param x Parameter description.
\code{.cpp}
void function_code_sample();
\endcode
*/
void free_function(int x);
int namespace_integer;
static int namespace_static_integer;
const int namespace_const_integer = 1;
@ -34,6 +50,39 @@ namespace example
public:
example(example const&) = default;
example& operator=(example const&) = delete;
virtual int virtual_method();
virtual int virtual_abstract_method() = 0;
virtual int virtual_const_method() const;
int method_with_default_value(int = default_value);
int method_with_fp(int (*fp)(), volatile char);
int method_with_string_default1(char* = ")", volatile char);
int method_with_string_default2(char* = "(", volatile char);
int method_with_char_default1(char = '(', volatile char);
int method_with_char_default2(char = ')', volatile char);
int volatile_method_with_fp(int (*fp)(), volatile char) volatile;
int volatile_method_with_string_default1(char* = ")", volatile char) volatile;
int volatile_method_with_string_default2(char* = "(", volatile char) volatile;
int volatile_method_with_char_default1(char = '(', volatile char) volatile;
int volatile_method_with_char_default2(char = ')', volatile char) volatile;
void const_method() const;
void volatile_method() volatile;
void trad_noexcept() noexcept;
void trad_noexcept_if() noexcept(a == b && (c || d));
void boost_noexcept() BOOST_NOEXCEPT;
void boost_noexcept_if() BOOST_NOEXCEPT_IF(a == b && (c || d));
void trad_constexpr() constexpr;
void boost_constexpr() BOOST_CONSTEXPR;
void boost_constexpr_or_const() BOOST_CONSTEXPR_OR_CONST;
void constexpr_noexcept() constexpr noexcept;
static int static_method();
static int static_constexpr() constexpr;
int integer;
static int static_integer;
@ -149,7 +198,7 @@ namespace example
/** A destructor. */
~specialization_test();
/** An assignment operator. */
specialization_test& operator=(const specialization_test&);
detail::unspecified& operator=(const specialization_test&);
};
}

View File

@ -0,0 +1,13 @@
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<book xmlns:xi="http://www.w3.org/2001/XInclude" id="test" lang="en">
<title>Test language attribute</title>
<programlisting>plain text</programlisting>
<programlisting><phrase role="keyword">void</phrase> <phrase role="identifier">main</phrase><phrase role="special">(</phrase><phrase role="special">)</phrase> <phrase role="special">{</phrase><phrase role="special">}</phrase></programlisting>
<programlisting><phrase role="keyword">actions</phrase> something <phrase role="special">;</phrase></programlisting>
<para>
<computeroutput>plain text</computeroutput>
<computeroutput><phrase role="keyword">void</phrase> <phrase role="identifier">main</phrase><phrase role="special">(</phrase><phrase role="special">)</phrase> <phrase role="special">{</phrase><phrase role="special">}</phrase></computeroutput>
<computeroutput><phrase role="keyword">actions</phrase> something <phrase role="special">;</phrase></computeroutput>
</para>
</book>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2013 Daniel James.
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)
-->
<!DOCTYPE boostbook PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
<boostbook id="test" xmlns:xi="http://www.w3.org/2001/XInclude"
last-revision="$Date: 2010-10-30 15:29:27 +0100 (Sat, 30 Oct 2010) $"
lang="en">
<title>Test language attribute</title>
<programlisting>plain text</programlisting>
<programlisting language="c++">void main() {}</programlisting>
<programlisting language="jam">actions something ;</programlisting>
<para>
<code>plain text</code>
<code language="c++">void main() {}</code>
<code language="jam">actions something ;</code>
</para>
</boostbook>

View File

@ -400,6 +400,14 @@
</computeroutput>
</xsl:template>
<xsl:template match="code[@language='c++']" mode="annotation">
<computeroutput>
<xsl:apply-templates mode="annotation">
<xsl:with-param name="highlight" select="true()"/>
</xsl:apply-templates>
</computeroutput>
</xsl:template>
<xsl:template match="bold" mode="annotation">
<emphasis role="bold">
<xsl:apply-templates mode="annotation"/>

View File

@ -398,6 +398,10 @@ Error: XSL template 'link-or-anchor' called with invalid link-type '<xsl:value-o
</computeroutput>
</xsl:template>
<xsl:template match="code[@language='c++']">
<xsl:apply-templates select="." mode="annotation"/>
</xsl:template>
<xsl:template match="bold">
<emphasis role="bold">
<xsl:apply-templates mode="annotation"/>
@ -454,6 +458,10 @@ Error: XSL template 'link-or-anchor' called with invalid link-type '<xsl:value-o
</programlisting>
</xsl:template>
<xsl:template match="programlisting[@language='c++']">
<xsl:apply-templates select="." mode="annotation"/>
</xsl:template>
<!-- These DocBook elements have special meaning. Use the annotation mode -->
<xsl:template match="classname|methodname|functionname|enumname|
macroname|headername|globalname">

View File

@ -202,6 +202,7 @@
<xsl:attribute name="name">
<xsl:value-of select="$name"/>
</xsl:attribute>
<xsl:text>&#10;</xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="with-namespace-refs"
@ -209,6 +210,7 @@
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</namespace>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:if>
</xsl:template>
@ -301,6 +303,7 @@
<xsl:apply-templates select="detaileddescription" mode="passthrough"/>
<xsl:apply-templates select="inbodydescription" mode="passthrough"/>
</enum>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:if>
</xsl:template>
@ -387,6 +390,7 @@
<xsl:with-param name="header" select="location/attribute::file"/>
</xsl:call-template>
</xsl:attribute>
<xsl:text>&#10;</xsl:text><!-- Newline -->
<xsl:if test="briefdescription/*|detaileddescription/*|inbodydescription/*">
<xsl:apply-templates select="briefdescription/*" mode="passthrough"/>
@ -400,6 +404,7 @@
<xsl:with-param name="in-file" select="location/attribute::file"/>
</xsl:apply-templates>
</header>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:if>
</xsl:template>
@ -518,6 +523,7 @@
<xsl:apply-templates select="detaileddescription" mode="passthrough"/>
<xsl:apply-templates select="inbodydescription" mode="passthrough"/>
</macro>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:when>
<xsl:when test="@kind='function'">
@ -717,29 +723,35 @@
<xsl:when test="@kind='public-static-func'">
<!-- TBD: pass on the fact that these are static functions -->
<method-group name="public static functions">
<xsl:text>&#10;</xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</method-group>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:when>
<xsl:when test="@kind='protected-static-func'">
<!-- TBD: pass on the fact that these are static functions -->
<method-group name="protected static functions">
<xsl:text>&#10;</xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</method-group>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:when>
<xsl:when test="@kind='private-static-func'">
<!-- TBD: pass on the fact that these are static functions -->
<method-group name="private static functions">
<xsl:text>&#10;</xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</method-group>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:when>
<xsl:when test="@kind='public-func'">
<xsl:variable name="members" select="./memberdef"/>
@ -750,21 +762,25 @@
</xsl:variable>
<xsl:if test="$num-internal-only &lt; count($members)">
<method-group name="public member functions">
<xsl:text>&#10;</xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</method-group>
<xsl:text>&#10;</xsl:text><!-- Newline -->
<xsl:apply-templates/>
</xsl:if>
</xsl:when>
<xsl:when test="@kind='protected-func'">
<method-group name="protected member functions">
<xsl:text>&#10;</xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</method-group>
<xsl:text>&#10;</xsl:text><!-- Newline -->
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="@kind='private-func'">
@ -776,22 +792,26 @@
</xsl:variable>
<xsl:if test="$num-internal-only &lt; count($members)">
<method-group name="private member functions">
<xsl:text>&#10;</xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</method-group>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:if>
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="@kind='friend'">
<xsl:if test="./memberdef/detaileddescription/para or ./memberdef/briefdescription/para">
<method-group name="friend functions">
<xsl:text>&#10;</xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</method-group>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:if>
</xsl:when>
<xsl:when test="@kind='public-static-attrib' or @kind='public-attrib'">
@ -968,6 +988,7 @@
<type><xsl:apply-templates select="type"/></type>
</typedef>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:if>
</xsl:template>
@ -1038,6 +1059,162 @@
</xsl:if>
</xsl:template>
<xsl:template name="function.attributes">
<!-- argsstring = '(arguments) [= delete] [= default] [constexpt]' -->
<xsl:variable name="extra-qualifiers-a">
<xsl:if test="contains(argsstring/text(), '(')">
<xsl:call-template name="strip-brackets">
<xsl:with-param name="text" select="substring-after(argsstring/text(), '(')" />
</xsl:call-template>
</xsl:if>
</xsl:variable>
<xsl:variable name="extra-qualifiers">
<xsl:if test="$extra-qualifiers-a">
<xsl:value-of select="concat(' ', normalize-space($extra-qualifiers-a), ' ')" />
</xsl:if>
</xsl:variable>
<!-- CV Qualifiers -->
<!-- Plus deleted and defaulted function markers as they're not properly
supported in boostbook -->
<!-- noexcept is complicated because is can have parameters.
TODO: should really remove the noexcept parameters before doing
anything else. -->
<xsl:variable name="noexcept">
<xsl:choose>
<xsl:when test="contains($extra-qualifiers, ' noexcept(')">
<xsl:call-template name="noexcept-if">
<xsl:with-param name="condition" select="substring-after($extra-qualifiers, ' noexcept(')" />
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($extra-qualifiers, ' BOOST_NOEXCEPT_IF(')">
<xsl:call-template name="noexcept-if">
<xsl:with-param name="condition" select="substring-after($extra-qualifiers, ' BOOST_NOEXCEPT_IF(')" />
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($extra-qualifiers, ' noexcept ') or contains($extra-qualifiers, ' BOOST_NOEXCEPT ')">
<xsl:value-of select="'noexcept '" />
</xsl:when>
</xsl:choose>
</xsl:variable>
<!-- Calculate constexpr now, so that we can avoid it getting confused
with const -->
<xsl:variable name="constexpr" select="
contains($extra-qualifiers, ' const expr ') or
contains($extra-qualifiers, ' BOOST_CONSTEXPR ') or
contains($extra-qualifiers, ' BOOST_CONSTEXPR_OR_CONST ')" />
<!-- The 'substring' trick includes the string if the condition is true -->
<xsl:variable name="cv-qualifiers" select="normalize-space(concat(
substring('constexpr ', 1, 999 * $constexpr),
substring('const ', 1, 999 * (not($constexpr) and @const='yes')),
substring('volatile ', 1, 999 * (@volatile='yes' or contains($extra-qualifiers, ' volatile '))),
$noexcept,
substring('= delete ', 1, 999 * contains($extra-qualifiers, ' =delete ')),
substring('= default ', 1, 999 * contains($extra-qualifiers, ' =default ')),
substring('= 0 ', 1, 999 * (@virt = 'pure-virtual')),
''))" />
<!-- Specifiers -->
<xsl:variable name="specifiers" select="normalize-space(concat(
substring('explicit ', 1, 999 * (@explicit = 'yes')),
substring('virtual ', 1, 999 * (
@virtual='yes' or @virt='virtual' or @virt='pure-virtual')),
substring('static ', 1, 999 * (@static = 'yes')),
''))" />
<xsl:if test="$cv-qualifiers">
<xsl:attribute name="cv">
<xsl:value-of select="$cv-qualifiers" />
</xsl:attribute>
</xsl:if>
<xsl:if test="$specifiers">
<xsl:attribute name="specifiers">
<xsl:value-of select="$specifiers" />
</xsl:attribute>
</xsl:if>
</xsl:template>
<!-- $condition = string after the opening bracket of the condition -->
<xsl:template name="noexcept-if">
<xsl:param name="condition"/>
<xsl:variable name="trailing">
<xsl:call-template name="strip-brackets">
<xsl:with-param name="text" select="$condition" />
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($trailing)">
<xsl:value-of select="concat(
'noexcept(',
substring($condition, 1, string-length($condition) - string-length($trailing)),
') ')" />
</xsl:when>
<xsl:otherwise>
<!-- Something has gone wrong so: -->
<xsl:value-of select="'noexcept(condition) '" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- $text = substring after the opening bracket -->
<xsl:template name="strip-brackets">
<xsl:param name="text"/>
<xsl:if test="contains($text, ')')">
<xsl:variable name="prefix1" select="substring-before($text, ')')" />
<xsl:variable name="prefix2" select="substring($prefix1, 1,
string-length(substring-before($prefix1, '(')) +
999 * not(contains($prefix1, '(')))" />
<xsl:variable name="prefix3" select="substring($prefix2, 1,
string-length(substring-before($prefix2, '&quot;')) +
999 * not(contains($prefix2, '&quot;')))" />
<xsl:variable name="prefix" select="substring($prefix3, 1,
string-length(substring-before($prefix3, &quot;'&quot;)) +
999 * not(contains($prefix3, &quot;'&quot;)))" />
<xsl:variable name="prefix-length" select="string-length($prefix)" />
<xsl:variable name="char" select="substring($text, $prefix-length + 1, 1)" />
<xsl:choose>
<xsl:when test="$char=')'">
<xsl:value-of select="substring($text, $prefix-length + 2)" />
</xsl:when>
<xsl:when test="$char='('">
<xsl:variable name="text2">
<xsl:call-template name="strip-brackets">
<xsl:with-param name="text" select="substring($text, $prefix-length + 2)" />
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="strip-brackets">
<xsl:with-param name="text" select="$text2" />
</xsl:call-template>
</xsl:when>
<xsl:when test="$char=&quot;'&quot;">
<!-- Not bothering with escapes, because this is crazy enough as it is -->
<xsl:call-template name="strip-brackets">
<xsl:with-param name="text" select="substring-after(substring($text, $prefix-length + 2), &quot;'&quot;)" />
</xsl:call-template>
</xsl:when>
<xsl:when test="$char='&quot;'">
<!-- Not bothering with escapes, because this is crazy enough as it is -->
<xsl:call-template name="strip-brackets">
<xsl:with-param name="text" select="substring-after(substring($text, $prefix-length + 2), '&quot;')" />
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
<!-- Handle function children -->
<xsl:template name="function.children">
<xsl:param name="is-overloaded" select="false()"/>
@ -1125,6 +1302,7 @@
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:template>
<!-- Emit overload signatures -->
@ -1164,20 +1342,10 @@
<xsl:if test="@explicit = 'yes'">
<xsl:attribute name="specifiers">explicit</xsl:attribute>
</xsl:if>
<!-- CV Qualifiers -->
<xsl:if test="contains(argsstring/text(),'=delete') or contains(argsstring/text(),'=default')">
<xsl:attribute name="cv">
<!-- Cheat and add deleted and defaulted function markers to the CV qualifiers -->
<xsl:if test="contains(argsstring/text(),'=delete')">
<xsl:text>= delete</xsl:text>
</xsl:if>
<xsl:if test="contains(argsstring/text(),'=default')">
<xsl:text>= default</xsl:text>
</xsl:if>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="function.attributes"/>
<xsl:call-template name="function.children"/>
</constructor>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:template>
<!-- Handle Destructors -->
@ -1185,41 +1353,21 @@
<destructor>
<xsl:call-template name="function.children"/>
</destructor>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:template>
<!-- Handle Copy Assignment -->
<xsl:template name="copy-assignment">
<copy-assignment>
<!-- CV Qualifiers -->
<xsl:if test="not (@const='no' and @volatile='no')">
<xsl:attribute name="cv">
<xsl:if test="@const='yes'">
<xsl:text>const</xsl:text>
</xsl:if>
<xsl:if test="@volatile='yes'">
<xsl:if test="@const='yes'">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:text>volatile</xsl:text>
</xsl:if>
<!-- Cheat and add deleted and defaulted function markers to the CV qualifiers -->
<xsl:if test="contains(argsstring/text(),'=delete')">
<xsl:if test="@const='yes' or @volatile='yes'">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:text>= delete</xsl:text>
</xsl:if>
<xsl:if test="contains(argsstring/text(),'=default')">
<xsl:if test="@const='yes' or @volatile='yes'">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:text>= default</xsl:text>
</xsl:if>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="function.attributes"/>
<!-- Return type -->
<xsl:element name="type">
<xsl:apply-templates select="type"/>
</xsl:element>
<xsl:call-template name="function.children"/>
</copy-assignment>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:template>
<!-- Handle conversion operator -->
@ -1228,32 +1376,7 @@
<xsl:attribute name="name">
<xsl:text>conversion-operator</xsl:text>
</xsl:attribute>
<!-- CV Qualifiers -->
<xsl:if test="not (@const='no' and @volatile='no') or contains(argsstring/text(),'=delete')">
<xsl:attribute name="cv">
<xsl:if test="@const='yes'">
<xsl:text>const</xsl:text>
</xsl:if>
<xsl:if test="@volatile='yes'">
<xsl:if test="@const='yes'">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:text>volatile</xsl:text>
</xsl:if>
<!-- Cheat and add deleted function markers to the CV qualifiers -->
<xsl:if test="contains(argsstring/text(),'=delete')">
<xsl:if test="@const='yes' or @volatile='yes'">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:text>= delete</xsl:text>
</xsl:if>
</xsl:attribute>
</xsl:if>
<xsl:if test="@explicit = 'yes'">
<xsl:attribute name="specifiers">explicit</xsl:attribute>
</xsl:if>
<xsl:call-template name="function.attributes"/>
<!-- Conversion type -->
<type>
@ -1262,6 +1385,7 @@
<xsl:call-template name="function.children"/>
</method>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:template>
<!-- Handle methods -->
@ -1270,45 +1394,16 @@
<xsl:attribute name="name">
<xsl:value-of select="name/text()"/>
</xsl:attribute>
<!-- CV Qualifiers -->
<xsl:if test="not (@const='no' and @volatile='no') or contains(argsstring/text(),'=delete')">
<xsl:attribute name="cv">
<xsl:if test="@const='yes'">
<xsl:text>const</xsl:text>
</xsl:if>
<xsl:if test="@volatile='yes'">
<xsl:if test="@const='yes'">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:text>volatile</xsl:text>
</xsl:if>
<!-- Cheat and add deleted function markers to the CV qualifiers -->
<xsl:if test="contains(argsstring/text(),'=default')">
<xsl:if test="@const='yes' or @volatile='yes'">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:text>= default</xsl:text>
</xsl:if>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="function.attributes"/>
<!-- Return type -->
<xsl:element name="type">
<!-- Cheat on virtual and static by dropping them into the type -->
<xsl:if test="@static='yes'">
<xsl:text>static </xsl:text>
</xsl:if>
<xsl:if test="@virtual='yes'">
<xsl:text>virtual </xsl:text>
</xsl:if>
<xsl:apply-templates select="type"/>
</xsl:element>
<xsl:call-template name="function.children"/>
</method>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:template>
<!-- Handle member variables -->
@ -1336,6 +1431,7 @@
<xsl:apply-templates select="detaileddescription" mode="passthrough"/>
<xsl:apply-templates select="inbodydescription" mode="passthrough"/>
</data-member>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:if>
</xsl:template>
@ -1612,7 +1708,7 @@
<!-- Handle program listings -->
<xsl:template match="programlisting" mode="passthrough">
<programlisting>
<programlisting language="c++">
<xsl:apply-templates mode="programlisting"/>
</programlisting>
</xsl:template>

View File

@ -216,13 +216,105 @@
</xsl:choose>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<xsl:apply-templates select="*[local-name(.)!='label']"/>
<xsl:apply-templates select="*[local-name(.)!='label']"/>text-align
</fo:list-item-body>
</fo:list-item>
</xsl:template>
<!--
The following rules apply text coloring to Quickbook items like
[role blue Some blue text]
These correspond to an arbitrary list of colors added to the CSS file
$(BOOST-ROOT)\doc\src\boostbook.css
and are required for building pdf documentation.
A more elegant way of doing this is probably possible.
Other colors can be added simply by copying these examples.
-->
<xsl:template match="phrase[@role='red']">
<fo:inline color="red">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="phrase[@role='blue']">
<fo:inline color="blue">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="phrase[@role='green']">
<fo:inline color="green">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="phrase[@role='lime']">
<fo:inline color="lime">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="phrase[@role='navy']">
<fo:inline color="navy">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="phrase[@role='yellow']">
<fo:inline color="yellow">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="phrase[@role='magenta']">
<fo:inline color="magenta">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="phrase[@role='indigo']">
<fo:inline color="indigo">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="phrase[@role='cyan']">
<fo:inline color="cyan">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="phrase[@role='purple']">
<fo:inline color="purple">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="phrase[@role='gold']">
<fo:inline color="gold">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="phrase[@role='silver']">
<fo:inline color="silver">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="phrase[@role='gray']">
<fo:inline color="gray">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<!--
The following rules apply syntax highlighting to phrases
that have been appropriately marked up, the highlighting
used is the same as that used by our CSS style sheets,

View File

@ -232,11 +232,14 @@ set toc,title
<xsl:value-of
select="normalize-space($revision-node/attribute::rev:last-revision)"/>
</xsl:variable>
<xsl:if test="string-length($revision-text) &gt; 0">
<xsl:if test="string-length($revision-text) &gt; 0 and not($revision-text = '$Date$')">
<p>
<small>
<xsl:text>Last revised: </xsl:text>
<xsl:choose>
<xsl:when test="not(contains($revision-text, '$Date: ')) and not(contains($revision-text, '$Date:: '))">
<xsl:value-of select="$revision-text"/>
</xsl:when>
<xsl:when test="contains($revision-text, '/')">
<xsl:call-template name="format.cvs.revision">
<xsl:with-param name="text" select="$revision-text"/>

View File

@ -28,106 +28,6 @@
<xsl:param name="draft.mode">no</xsl:param>
<xsl:param name="admon.graphics" select="1"/>
<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: " or "$Date:: " -->
<xsl:variable name="text.noprefix"
select="substring-after($text, ': ')"/>
<!-- 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)"/>
<xsl:if test="$time != ''">
<xsl:value-of select="concat(' at ', $time, ' ', $timezone)"/>
</xsl:if>
</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"/>