Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74982 - in trunk/tools/boostbook: test/doxygen test/doxygen/boost xsl
From: steven_at_[hidden]
Date: 2011-10-16 13:32:18


Author: steven_watanabe
Date: 2011-10-16 13:32:17 EDT (Sun, 16 Oct 2011)
New Revision: 74982
URL: http://svn.boost.org/trac/boost/changeset/74982

Log:
Better handling of tparam.
Text files modified:
   trunk/tools/boostbook/test/doxygen/Jamfile.v2 | 3 ++-
   trunk/tools/boostbook/test/doxygen/autodoc.gold | 6 +++++-
   trunk/tools/boostbook/test/doxygen/boost/example.hpp | 8 ++++++++
   trunk/tools/boostbook/xsl/function.xsl | 33 +++++++++++++++++++++++++++++++++
   trunk/tools/boostbook/xsl/template.xsl | 5 ++++-
   trunk/tools/boostbook/xsl/type.xsl | 32 ++++++++++++++++++++++++++++++++
   6 files changed, 84 insertions(+), 3 deletions(-)

Modified: trunk/tools/boostbook/test/doxygen/Jamfile.v2
==============================================================================
--- trunk/tools/boostbook/test/doxygen/Jamfile.v2 (original)
+++ trunk/tools/boostbook/test/doxygen/Jamfile.v2 2011-10-16 13:32:17 EDT (Sun, 16 Oct 2011)
@@ -3,7 +3,8 @@
 # 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)
 
-import doxygen ;
+using boostbook ;
+using doxygen ;
 import os ;
 
 doxygen autodoc

Modified: trunk/tools/boostbook/test/doxygen/autodoc.gold
==============================================================================
--- trunk/tools/boostbook/test/doxygen/autodoc.gold (original)
+++ trunk/tools/boostbook/test/doxygen/autodoc.gold 2011-10-16 13:32:17 EDT (Sun, 16 Oct 2011)
@@ -22,4 +22,8 @@
 
 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></namespace><macro name="EXAMPLE" kind="functionlike"><macro-parameter name="m"/><purpose>Documentation for macro example. </purpose></macro></header></library-reference>
+</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>

Modified: trunk/tools/boostbook/test/doxygen/boost/example.hpp
==============================================================================
--- trunk/tools/boostbook/test/doxygen/boost/example.hpp (original)
+++ trunk/tools/boostbook/test/doxygen/boost/example.hpp 2011-10-16 13:32:17 EDT (Sun, 16 Oct 2011)
@@ -114,6 +114,14 @@
      * \see example::example and example_template
      */
     int namespace_func(int i, int j);
+
+ /**
+ * Testing a function template.
+ * \tparam TypeParameter A template parameter
+ * \tparam NonTypeParameter This is a non-type template parameter
+ */
+ template <typename TypeParameter, int NonTypeParameter>
+ void namespace_func_template();
 }
 
 #define EXAMPLE(m) The macro

Modified: trunk/tools/boostbook/xsl/function.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/function.xsl (original)
+++ trunk/tools/boostbook/xsl/function.xsl 2011-10-16 13:32:17 EDT (Sun, 16 Oct 2011)
@@ -803,6 +803,8 @@
     <xsl:apply-templates select="description/*"/>
 
     <xsl:if test="parameter/description|signature/parameter/description|
+ template/template-type-parameter/purpose|
+ template/template-nontype-parameter/purpose|
                   requires|effects|postconditions|returns|throws|complexity|
                   notes|rationale">
       <variablelist spacing="compact">
@@ -839,6 +841,37 @@
           </varlistentry>
         </xsl:if>
 
+ <!-- Document template parameters -->
+ <xsl:if test="template/template-type-parameter/purpose|
+ template/template-nontype-parameter/purpose">
+ <varlistentry>
+ <term>Template Parameters:</term>
+ <listitem>
+ <variablelist spacing="compact">
+ <xsl:processing-instruction name="dbhtml">
+ list-presentation="table"
+ </xsl:processing-instruction>
+ <xsl:for-each select="template/template-type-parameter|
+ template/template-nontype-parameter">
+ <xsl:sort select="attribute::name"/>
+ <xsl:if test="purpose">
+ <varlistentry>
+ <term>
+ <xsl:call-template name="monospaced">
+ <xsl:with-param name="text" select="@name"/>
+ </xsl:call-template>
+ </term>
+ <listitem>
+ <xsl:apply-templates select="purpose/*"/>
+ </listitem>
+ </varlistentry>
+ </xsl:if>
+ </xsl:for-each>
+ </variablelist>
+ </listitem>
+ </varlistentry>
+ </xsl:if>
+
         <!-- Document rest of function's contract -->
         <xsl:for-each select="requires|effects|postconditions|returns|throws|complexity|
                       notes|rationale">

Modified: trunk/tools/boostbook/xsl/template.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/template.xsl (original)
+++ trunk/tools/boostbook/xsl/template.xsl 2011-10-16 13:32:17 EDT (Sun, 16 Oct 2011)
@@ -8,6 +8,9 @@
   -->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 version="1.0">
+
+ <xsl:param name="template.param.brief" select="false()"/>
+
   <!-- Determine the length of a template header synopsis -->
   <xsl:template name="template.synopsis.length">
     <xsl:variable name="text">
@@ -235,7 +238,7 @@
     <xsl:param name="parameters" select="template-type-parameter|template-varargs|template-nontype-parameter"/>
 
     <xsl:choose>
- <xsl:when test="$parameters/purpose">
+ <xsl:when test="$parameters/purpose and $template.param.brief">
         <xsl:call-template name="template.reference.parameters.comments">
           <xsl:with-param name="indentation" select="$indentation"/>
           <xsl:with-param name="highlight" select="$highlight"/>

Modified: trunk/tools/boostbook/xsl/type.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/type.xsl (original)
+++ trunk/tools/boostbook/xsl/type.xsl 2011-10-16 13:32:17 EDT (Sun, 16 Oct 2011)
@@ -1191,6 +1191,38 @@
         </xsl:if>
         <xsl:apply-templates select="description"/>
 
+ <!-- Document template parameters -->
+ <xsl:if test="(template/template-type-parameter/purpose|
+ template/template-nontype-parameter/purpose)
+ and not($template.param.brief)">
+ <varlistentry>
+ <term>Template Parameters:</term>
+ <listitem>
+ <variablelist spacing="compact">
+ <xsl:processing-instruction name="dbhtml">
+ list-presentation="table"
+ </xsl:processing-instruction>
+ <xsl:for-each select="template/template-type-parameter|
+ template/template-nontype-parameter">
+ <xsl:sort select="attribute::name"/>
+ <xsl:if test="purpose">
+ <varlistentry>
+ <term>
+ <xsl:call-template name="monospaced">
+ <xsl:with-param name="text" select="@name"/>
+ </xsl:call-template>
+ </term>
+ <listitem>
+ <xsl:apply-templates select="purpose/*"/>
+ </listitem>
+ </varlistentry>
+ </xsl:if>
+ </xsl:for-each>
+ </variablelist>
+ </listitem>
+ </varlistentry>
+ </xsl:if>
+
         <xsl:call-template name="class-members-reference"/>
         <xsl:apply-templates select="access" mode="namespace-reference"/>
 


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