Boost logo

Boost-Commit :

From: daniel_james_at_[hidden]
Date: 2008-05-21 16:59:57


Author: danieljames
Date: 2008-05-21 16:59:56 EDT (Wed, 21 May 2008)
New Revision: 45623
URL: http://svn.boost.org/trac/boost/changeset/45623

Log:
Generate slightly better ids in boostbook.

Merged revisions 45234-45240,45246-45248,45253-45255,45258-45260,45266,45269,45275-45282,45284-45291,45297,45299-45302,45308-45338,45340-45345,45348-45352,45356-45358,45360-45377,45379-45392,45394,45396-45408,45410-45420,45424-45444,45448,45450-45455,45457-45478,45480,45484-45544,45546-45549,45551-45564,45566-45569,45571-45572,45575,45577 via svnmerge from
https://svn.boost.org/svn/boost/trunk

................
  r45234 | danieljames | 2008-05-08 23:07:28 +0100 (Thu, 08 May 2008) | 1 line
  
  Replace spaces in generated file names with underscores, and replace multiple consecutive underscores with a single underscore.
................
  r45577 | danieljames | 2008-05-20 16:49:55 +0100 (Tue, 20 May 2008) | 31 lines
  
  Merge in improved ids in boostbook.
  
  Merged revisions 44958,45130-45131,45152-45153,45366 via svnmerge from
  https://svn.boost.org/svn/boost/branches/doc
  
  ........
    r44958 | danieljames | 2008-05-01 00:08:20 +0100 (Thu, 01 May 2008) | 2 lines
    
    Don't generated file names with spaces, and replace multiple consecutive underscores with a single underscore.
  ........
    r45130 | danieljames | 2008-05-05 12:37:04 +0100 (Mon, 05 May 2008) | 2 lines
    
    Combine the two alternative versions of the function generate.id
  ........
    r45131 | danieljames | 2008-05-05 12:37:18 +0100 (Mon, 05 May 2008) | 2 lines
    
    Deal with generated ids that contain dots which aren't separators.
  ........
    r45152 | danieljames | 2008-05-05 21:28:44 +0100 (Mon, 05 May 2008) | 2 lines
    
    Only add the id to fully qualified ids inside specializations - so that we're not adding generated ids on to the end of generated ids.
  ........
    r45153 | danieljames | 2008-05-05 21:28:56 +0100 (Mon, 05 May 2008) | 2 lines
    
    If the same macro appears twice, generated unique ids.
  ........
    r45366 | danieljames | 2008-05-14 21:39:14 +0100 (Wed, 14 May 2008) | 2 lines
    
    Avoid removing underscores that are part of a class or function name.
  ........
................

Properties modified:
   branches/release/ (props changed)
Text files modified:
   branches/release/tools/boostbook/xsl/annotation.xsl | 8 +++++---
   branches/release/tools/boostbook/xsl/chunk-common.xsl | 2 +-
   branches/release/tools/boostbook/xsl/global.xsl | 3 +--
   branches/release/tools/boostbook/xsl/lookup.xsl | 23 +++++++++++++++++------
   branches/release/tools/boostbook/xsl/macro.xsl | 4 ++++
   branches/release/tools/boostbook/xsl/type.xsl | 24 +++++-------------------
   6 files changed, 33 insertions(+), 31 deletions(-)

Modified: branches/release/tools/boostbook/xsl/annotation.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/annotation.xsl (original)
+++ branches/release/tools/boostbook/xsl/annotation.xsl 2008-05-21 16:59:56 EDT (Wed, 21 May 2008)
@@ -28,14 +28,16 @@
     <xsl:choose>
       <xsl:when test="count(key('named-entities', $name))=1
                       and ($translated-name=$name)">
- <xsl:call-template name="fully-qualified-name">
+ <xsl:call-template name="fully-qualified-id">
           <xsl:with-param name="node" select="."/>
- <xsl:with-param name="separator" select="'.'"/>
         </xsl:call-template>
       </xsl:when>
       <xsl:otherwise>
+ <xsl:call-template name="fully-qualified-id">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ <xsl:text>_</xsl:text>
         <xsl:value-of select="generate-id(.)"/>
- <xsl:text>-bb</xsl:text>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>

Modified: branches/release/tools/boostbook/xsl/chunk-common.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/chunk-common.xsl (original)
+++ branches/release/tools/boostbook/xsl/chunk-common.xsl 2008-05-21 16:59:56 EDT (Wed, 21 May 2008)
@@ -28,7 +28,7 @@
     <xsl:choose>
         <xsl:when test="not($recursive)">
             <!-- translate dots into directory separators, and replace illegal file path characters with underscores -->
- <xsl:value-of select="translate( $basename, '.&lt;&gt;\:*?&quot;|', '/_______' )"/>
+ <xsl:value-of select="translate(normalize-space(translate($basename, '.&lt;&gt;\:*?&quot;|', '/ ' )), ' ', '_')"/>
             <xsl:value-of select="$html.ext"/>
         </xsl:when>
         <xsl:otherwise>

Modified: branches/release/tools/boostbook/xsl/global.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/global.xsl (original)
+++ branches/release/tools/boostbook/xsl/global.xsl 2008-05-21 16:59:56 EDT (Wed, 21 May 2008)
@@ -68,9 +68,8 @@
     <xsl:text>;</xsl:text>
   </xsl:template>
   <xsl:template match="data-member" mode="generate.id">
- <xsl:call-template name="fully-qualified-name">
+ <xsl:call-template name="fully-qualified-id">
       <xsl:with-param name="node" select="."/>
- <xsl:with-param name="separator" select="'.'"/>
     </xsl:call-template>
   </xsl:template>
 </xsl:stylesheet>

Modified: branches/release/tools/boostbook/xsl/lookup.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/lookup.xsl (original)
+++ branches/release/tools/boostbook/xsl/lookup.xsl 2008-05-21 16:59:56 EDT (Wed, 21 May 2008)
@@ -15,12 +15,6 @@
   <xsl:template name="generate.id">
     <xsl:param name="node" select="."/>
     <xsl:apply-templates select="$node" mode="generate.id"/>
- <xsl:if test="$node/ancestor-or-self::class-specialization|
- $node/ancestor-or-self::struct-specialization|
- $node/ancestor-or-self::union-specialization">
- <xsl:text>_</xsl:text>
- <xsl:value-of select="generate-id($node)"/>
- </xsl:if>
   </xsl:template>
 
   <xsl:template match="*" mode="generate.id">
@@ -128,6 +122,23 @@
     </xsl:choose>
   </xsl:template>
 
+ <!-- Build the fully-qualified id of the given node -->
+ <xsl:template name="fully-qualified-id">
+ <xsl:param name="node"/>
+ <xsl:variable name="name">
+ <xsl:apply-templates select="$node" mode="fully-qualified-name">
+ <xsl:with-param name="separator" select="'@'"/>
+ </xsl:apply-templates>
+ </xsl:variable>
+ <xsl:value-of select="translate(normalize-space(translate($name, '.', ' ')), ' @', '_.')"/>
+ <xsl:if test="$node/ancestor-or-self::class-specialization|
+ $node/ancestor-or-self::struct-specialization|
+ $node/ancestor-or-self::union-specialization">
+ <xsl:text>_</xsl:text>
+ <xsl:value-of select="generate-id($node)"/>
+ </xsl:if>
+ </xsl:template>
+
   <!-- Build the fully-qualified name of the given node -->
   <xsl:template name="fully-qualified-name">
     <xsl:param name="node"/>

Modified: branches/release/tools/boostbook/xsl/macro.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/macro.xsl (original)
+++ branches/release/tools/boostbook/xsl/macro.xsl 2008-05-21 16:59:56 EDT (Wed, 21 May 2008)
@@ -73,5 +73,9 @@
 
   <xsl:template match="macro" mode="generate.id">
     <xsl:value-of select="@name"/>
+ <xsl:if test="count(key('named-entities', @name))!=1">
+ <xsl:text>_</xsl:text>
+ <xsl:value-of select="generate-id(.)"/>
+ </xsl:if>
   </xsl:template>
 </xsl:stylesheet>

Modified: branches/release/tools/boostbook/xsl/type.xsl
==============================================================================
--- branches/release/tools/boostbook/xsl/type.xsl (original)
+++ branches/release/tools/boostbook/xsl/type.xsl 2008-05-21 16:59:56 EDT (Wed, 21 May 2008)
@@ -27,51 +27,37 @@
   <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:call-template name="fully-qualified-id">
       <xsl:with-param name="node" select="."/>
- <xsl:with-param name="separator" select="'.'"/>
     </xsl:call-template>
   </xsl:template>
 
   <xsl:template match="class-specialization|struct-specialization|union-specialization" mode="generate.id">
- <xsl:call-template name="fully-qualified-name">
+ <xsl:call-template name="fully-qualified-id">
       <xsl:with-param name="node" select="."/>
- <xsl:with-param name="separator" select="'.'"/>
     </xsl:call-template>
   </xsl:template>
 
   <xsl:template match="typedef" mode="generate.id">
- <xsl:call-template name="fully-qualified-name">
+ <xsl:call-template name="fully-qualified-id">
       <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:call-template name="fully-qualified-id">
       <xsl:with-param name="node" select="."/>
- <xsl:with-param name="separator" select="'.'"/>
     </xsl:call-template>
   </xsl:template>
 
   <xsl:template match="enumvalue" mode="generate.id">
- <xsl:call-template name="fully-qualified-name">
+ <xsl:call-template name="fully-qualified-id">
       <xsl:with-param name="node" select="parent::enum"/>
- <xsl:with-param name="separator" select="'.'"/>
     </xsl:call-template>
     <xsl:text>.</xsl:text>
     <xsl:value-of select="@name"/>
   </xsl:template>
 
- <xsl:template match="function | overloaded-function" 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:text>_</xsl:text>
- <xsl:value-of select="generate-id(.)"/>
- </xsl:template>
-
   <!-- Display the full name of the current node, e.g., "Class
        template function". -->
   <xsl:template name="type.display.name">


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