Update of /cvsroot/boost/boost/tools/boostbook/xsl
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12571

Modified Files:
        type.xsl 
Log Message:
apply various patches from Julio M. Merino Vidal

Index: type.xsl
===================================================================
RCS file: /cvsroot/boost/boost/tools/boostbook/xsl/type.xsl,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- type.xsl    14 Mar 2007 22:33:58 -0000      1.17
+++ type.xsl    4 Apr 2007 22:52:17 -0000       1.18
@@ -20,6 +20,11 @@
        separate refentry element for the enum. -->
   <xsl:param name="boost.compact.enum">1</xsl:param>
 
+  <!-- When true, the stylesheet will emit compact definitions of
+       typedefs when the typedef does not have any detailed
+       description. -->
+  <xsl:param name="boost.compact.typedef">1</xsl:param>
+
   <xsl:template match="class|struct|union" mode="generate.id">
     <xsl:call-template name="fully-qualified-name">
       <xsl:with-param name="node" select="."/>
@@ -27,6 +32,13 @@
     </xsl:call-template>
   </xsl:template>
 
+  <xsl:template match="typedef" mode="generate.id">
+    <xsl:call-template name="fully-qualified-name">
+      <xsl:with-param name="node" select="."/>
+      <xsl:with-param name="separator" select="'.'"/>
+    </xsl:call-template>
+  </xsl:template>
+
   <xsl:template match="enum" mode="generate.id">
     <xsl:call-template name="fully-qualified-name">
       <xsl:with-param name="node" select="."/>
@@ -193,10 +205,38 @@
 
   <!-- Emit a typedef synopsis -->
   <xsl:template name="type.typedef.display.aligned">
+    <xsl:param name="compact"/>
     <xsl:param name="indentation"/>
+    <xsl:param name="is-reference"/>
     <xsl:param name="max-type-length"/>
     <xsl:param name="max-name-length"/>
 
+    <!-- What type of link the typedef name should have. This shall
+         be one of 'anchor' (the typedef output will be the target of
+         links), 'link' (the typedef output will link to a definition), or
+         'none' (the typedef output will not be either a link or a link
+         target) -->
+    <xsl:param name="link-type">
+      <xsl:choose>
+        <xsl:when test="$is-reference">
+          <xsl:text>anchor</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>link</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:param>
+
+    <!-- The id we should link to or anchor as -->
+    <xsl:param name="link-to">
+      <xsl:call-template name="generate.id"/>
+    </xsl:param>
+
+    <!-- The id we should link to or anchor as -->
+    <xsl:param name="typedef-name">
+      <xsl:value-of select="@name"/>
+    </xsl:param>
+
     <!-- Padding for the typedef types -->
     <xsl:variable name="type-padding">
       <xsl:call-template name="indent">
@@ -280,11 +320,18 @@
                                             1, $max-name-length)"/>
           </xsl:when>
           <xsl:otherwise>
-            <xsl:value-of select="concat(' ',@name,';')"/>
+            <xsl:text> </xsl:text>
+            <xsl:call-template name="link-or-anchor">
+              <xsl:with-param name="to" select="$link-to"/>
+              <xsl:with-param name="text" select="$typedef-name"/>
+              <xsl:with-param name="link-type" select="$link-type"/>
+              <xsl:with-param name="highlight" select="true()"/>
+            </xsl:call-template>
+            <xsl:text>;</xsl:text>
           </xsl:otherwise>
         </xsl:choose>
 
-        <xsl:if test="purpose">
+        <xsl:if test="$compact and purpose">
           <xsl:text>  </xsl:text>
           <xsl:call-template name="highlight-comment">
             <xsl:with-param name="text">
@@ -302,20 +349,68 @@
     <xsl:param name="max-type-length" select="0"/>
     <xsl:param name="max-name-length" select="0"/>
     
-    <!-- Spacing -->
-    <xsl:if test="not 
(local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() 
&gt; 1)">
-      <xsl:text>&#10;</xsl:text>
-    </xsl:if>
+    <!-- True if we should compact this typedef -->
+    <xsl:variable name="compact"
+      select="not (para|description) and ($boost.compact.typedef='1')"/>
 
-    <xsl:call-template name="type.typedef.display.aligned">
-      <xsl:with-param name="indentation" select="$indentation"/>
-      <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>
+    <xsl:choose>
+      <xsl:when test="$compact">
+        <!-- Spacing -->
+        <xsl:if test="not 
(local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() 
&gt; 1)">
+          <xsl:text>&#10;</xsl:text>
+        </xsl:if>
+
+        <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="max-type-length" select="$max-type-length"/>
+          <xsl:with-param name="max-name-length" select="$max-name-length"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <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="false()"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:template>
 
-  <!-- TBD: Implement this -->
-  <xsl:template match="typedef" mode="reference"/>
+  <!-- Emit a typedef reference entry -->
+  <xsl:template match="typedef" mode="reference">
+    <!-- True if this typedef was compacted -->
+    <xsl:variable name="compact"
+      select="not (para|description) and ($boost.compact.typedef='1')"/>
+
+    <xsl:if test="not ($compact)">
+      <xsl:call-template name="reference-documentation">
+        <xsl:with-param name="refname" select="@name"/>
+        <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
+        <xsl:with-param name="anchor">
+          <xsl:call-template name="generate.id"/>
+        </xsl:with-param>
+        <xsl:with-param name="name">
+          <xsl:text>Type definition </xsl:text>
+          <xsl:call-template name="monospaced">
+            <xsl:with-param name="text" select="@name"/>
+          </xsl:call-template>
+        </xsl:with-param>
+        <xsl:with-param name="synopsis">
+          <xsl:call-template name="type.typedef.display.aligned">
+            <xsl:with-param name="compact" select="false()"/>
+            <xsl:with-param name="indentation" select="0"/>
+            <xsl:with-param name="is-reference" select="true()"/>
+            <xsl:with-param name="link-type" select="'none'"/>
+          </xsl:call-template>
+        </xsl:with-param>
+        <xsl:with-param name="text">
+          <xsl:apply-templates select="description"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
 
   <!-- Emit a list of static constants -->
   <xsl:template match="static-constant" mode="synopsis">


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to