mirror of
https://github.com/boostorg/boostbook.git
synced 2025-05-09 23:13:58 +00:00
Limit generated ID lengths to 26 characters
[SVN r25396]
This commit is contained in:
parent
39e30a1c99
commit
8e045fb1b3
@ -7,6 +7,7 @@
|
|||||||
<xsl:key name="libraries" match="library" use="@name"/>
|
<xsl:key name="libraries" match="library" use="@name"/>
|
||||||
<xsl:key name="macros" match="macro" use="@name"/>
|
<xsl:key name="macros" match="macro" use="@name"/>
|
||||||
<xsl:key name="headers" match="header" use="@name"/>
|
<xsl:key name="headers" match="header" use="@name"/>
|
||||||
|
<xsl:key name="named-entities" match="class|struct|union|function|overloaded-function|macro|library|*[attribute::id]" use="@name|@id"/>
|
||||||
|
|
||||||
<xsl:template match="function|overloaded-function" mode="generate.id">
|
<xsl:template match="function|overloaded-function" mode="generate.id">
|
||||||
<xsl:variable name="name" select="normalize-space(@name)"/>
|
<xsl:variable name="name" select="normalize-space(@name)"/>
|
||||||
@ -16,7 +17,7 @@
|
|||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')"/>
|
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')"/>
|
||||||
|
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="count(key('functions', $name))=1
|
<xsl:when test="count(key('named-entities', $name))=1
|
||||||
and ($translated-name=$name)">
|
and ($translated-name=$name)">
|
||||||
<xsl:value-of select="$name"/>
|
<xsl:value-of select="$name"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
@ -2,10 +2,22 @@
|
|||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
version="1.0">
|
version="1.0">
|
||||||
|
|
||||||
|
<xsl:param name="boost.max.id.length">26</xsl:param>
|
||||||
|
|
||||||
<!-- Generate an ID for the entity referenced -->
|
<!-- Generate an ID for the entity referenced -->
|
||||||
<xsl:template name="generate.id">
|
<xsl:template name="generate.id">
|
||||||
<xsl:param name="node" select="."/>
|
<xsl:param name="node" select="."/>
|
||||||
<xsl:apply-templates select="$node" mode="generate.id"/>
|
<xsl:variable name="id">
|
||||||
|
<xsl:apply-templates select="$node" mode="generate.id"/>
|
||||||
|
</xsl:variable>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="string-length($id) > $boost.max.id.length">
|
||||||
|
<xsl:value-of select="generate-id($node)"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="string($id)"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="*" mode="generate.id">
|
<xsl:template match="*" mode="generate.id">
|
||||||
|
17
xsl/type.xsl
17
xsl/type.xsl
@ -13,12 +13,17 @@
|
|||||||
<xsl:param name="boost.compact.enum">1</xsl:param>
|
<xsl:param name="boost.compact.enum">1</xsl:param>
|
||||||
|
|
||||||
<xsl:template match="class|struct|union" mode="generate.id">
|
<xsl:template match="class|struct|union" mode="generate.id">
|
||||||
<xsl:value-of select="local-name(.)"/>
|
<xsl:choose>
|
||||||
<xsl:text>.</xsl:text>
|
<xsl:when test="count(key('named-entities', @name))=1">
|
||||||
<xsl:call-template name="fully-qualified-name">
|
<xsl:value-of select="@name"/>
|
||||||
<xsl:with-param name="node" select="."/>
|
</xsl:when>
|
||||||
<xsl:with-param name="separator" select="'.'"/>
|
<xsl:otherwise>
|
||||||
</xsl:call-template>
|
<xsl:call-template name="fully-qualified-name">
|
||||||
|
<xsl:with-param name="node" select="."/>
|
||||||
|
<xsl:with-param name="separator" select="'.'"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="enum" mode="generate.id">
|
<xsl:template match="enum" mode="generate.id">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user