Boost logo

Boost-Commit :

From: fmhess_at_[hidden]
Date: 2007-12-20 09:39:54


Author: fmhess
Date: 2007-12-20 09:39:53 EST (Thu, 20 Dec 2007)
New Revision: 42202
URL: http://svn.boost.org/trac/boost/changeset/42202

Log:
Made putting the name of a typedef inside
a "classname" element successfully produce a link to the typedef's
reference documentation, or to the typedef's synopsis if that is
all it has.

Text files modified:
   trunk/tools/boostbook/xsl/annotation.xsl | 2 +-
   trunk/tools/boostbook/xsl/type.xsl | 25 ++++++++++++++++++++++---
   2 files changed, 23 insertions(+), 4 deletions(-)

Modified: trunk/tools/boostbook/xsl/annotation.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/annotation.xsl (original)
+++ trunk/tools/boostbook/xsl/annotation.xsl 2007-12-20 09:39:53 EST (Thu, 20 Dec 2007)
@@ -8,7 +8,7 @@
   -->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 version="1.0">
- <xsl:key name="classes" match="class|struct|union" use="@name"/>
+ <xsl:key name="classes" match="class|struct|union|typedef" use="@name"/>
   <xsl:key name="methods" match="method|overloaded-method" use="@name"/>
   <xsl:key name="functions" match="function|overloaded-function" use="@name"/>
   <xsl:key name="enums" match="enum" use="@name"/>

Modified: trunk/tools/boostbook/xsl/type.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/type.xsl (original)
+++ trunk/tools/boostbook/xsl/type.xsl 2007-12-20 09:39:53 EST (Thu, 20 Dec 2007)
@@ -333,8 +333,16 @@
             <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),
- 1, $max-name-length)"/>
+ <xsl:variable name="truncated-typedef-name" select="substring(@name,
+ 1, $max-name-length)"/>
+ <xsl:call-template name="link-or-anchor">
+ <xsl:with-param name="to" select="$link-to"/>
+ <xsl:with-param name="text" select="$truncated-typedef-name"/>
+ <xsl:with-param name="link-type" select="$link-type"/>
+ <xsl:with-param name="highlight" select="true()"/>
+ </xsl:call-template>
+ <xsl:value-of select="substring(concat(';', $name-padding),
+ 1, $max-name-length - string-length($truncated-typedef-name))"/>
           </xsl:when>
           <xsl:otherwise>
             <xsl:text> </xsl:text>
@@ -365,6 +373,7 @@
     <xsl:param name="indentation"/>
     <xsl:param name="max-type-length" select="0"/>
     <xsl:param name="max-name-length" select="0"/>
+ <xsl:param name="allow-anchor" select="true()"/>
 
     <!-- True if we should compact this typedef -->
     <xsl:variable name="compact"
@@ -380,7 +389,7 @@
         <xsl:call-template name="type.typedef.display.aligned">
           <xsl:with-param name="compact" select="$compact"/>
           <xsl:with-param name="indentation" select="$indentation"/>
- <xsl:with-param name="is-reference" select="true()"/>
+ <xsl:with-param name="is-reference" select="$allow-anchor"/>
           <xsl:with-param name="max-type-length" select="$max-type-length"/>
           <xsl:with-param name="max-name-length" select="$max-name-length"/>
         </xsl:call-template>
@@ -728,6 +737,8 @@
 
   <xsl:template name="class-members-synopsis">
     <xsl:param name="indentation" select="0"/>
+ <!-- Used to suppress anchors in nested synopsis, so we don't get multiple anchors -->
+ <xsl:param name="allow-synopsis-anchors" select="false()"/>
 
     <!-- Typedefs -->
     <xsl:if test="typedef">
@@ -770,6 +781,7 @@
           select="$max-type-length"/>
         <xsl:with-param name="max-name-length"
           select="$max-name-length"/>
+ <xsl:with-param name="allow-anchor" select="$allow-synopsis-anchors"/>
       </xsl:apply-templates>
     </xsl:if>
 
@@ -836,17 +848,21 @@
 
   <xsl:template match="access" mode="synopsis">
     <xsl:param name="indentation" select="0"/>
+ <xsl:param name="allow-synopsis-anchors" select="false()"/>
+
     <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:with-param name="allow-synopsis-anchors" select="$allow-synopsis-anchors"/>
     </xsl:call-template>
   </xsl:template>
 
   <xsl:template name="class-type-synopsis">
     <xsl:param name="indentation" select="0"/>
+ <xsl:param name="allow-synopsis-anchors" select="false()"/>
 
     <!-- The keyword used to declare this class type, e.g., class,
          struct, or union. -->
@@ -940,10 +956,12 @@
 
     <xsl:call-template name="class-members-synopsis">
       <xsl:with-param name="indentation" select="$indentation"/>
+ <xsl:with-param name="allow-synopsis-anchors" select="$allow-synopsis-anchors"/>
     </xsl:call-template>
 
     <xsl:apply-templates select="access" mode="synopsis">
       <xsl:with-param name="indentation" select="$indentation"/>
+ <xsl:with-param name="allow-synopsis-anchors" select="$allow-synopsis-anchors"/>
     </xsl:apply-templates>
 
     <!-- Closing brace -->
@@ -1049,6 +1067,7 @@
       <xsl:with-param name="synopsis">
         <xsl:call-template name="class-type-synopsis">
           <xsl:with-param name="indentation" select="$indentation"/>
+ <xsl:with-param name="allow-synopsis-anchors" select="true()"/>
         </xsl:call-template>
         <!-- Associated free functions -->
         <xsl:apply-templates select="ancestor-or-self::*/free-function-group"


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