Fix markup problems reported by Eric Niebler.

[SVN r62894]
This commit is contained in:
Steven Watanabe 2010-06-13 03:08:36 +00:00
parent ff74c39518
commit bb67cd7547
5 changed files with 154 additions and 56 deletions

View File

@ -374,6 +374,14 @@
</xsl:choose>
</xsl:template>
<xsl:template match="programlisting" mode="annotation">
<programlisting>
<xsl:apply-templates mode="annotation">
<xsl:with-param name="highlight" select="true()"/>
</xsl:apply-templates>
</programlisting>
</xsl:template>
<xsl:template match="code" mode="annotation">
<computeroutput>
<xsl:apply-templates mode="annotation"/>

View File

@ -654,7 +654,8 @@
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<emphasis>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:text>// </xsl:text>
<xsl:call-template name="internal-link">
<xsl:with-param name="to">
@ -663,7 +664,8 @@
</xsl:with-param>
<xsl:with-param name="text" select="'construct/copy/destruct'"/>
</xsl:call-template>
</emphasis>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="constructor" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
@ -1083,7 +1085,8 @@
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<emphasis>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:text>// </xsl:text>
<xsl:call-template name="internal-link">
<xsl:with-param name="to">
@ -1091,7 +1094,8 @@
</xsl:with-param>
<xsl:with-param name="text" select="string(@name)"/>
</xsl:call-template>
</emphasis>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="method|overloaded-method"
mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
@ -1137,7 +1141,8 @@
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<emphasis>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:text>// </xsl:text>
<xsl:call-template name="internal-link">
<xsl:with-param name="to">
@ -1145,7 +1150,8 @@
</xsl:with-param>
<xsl:with-param name="text" select="string(@name)"/>
</xsl:call-template>
</emphasis>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="function|overloaded-function" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>

View File

@ -98,9 +98,71 @@
<xsl:template match="para|section" mode="synopsis"/>
<xsl:template match="para|section" mode="reference"/>
<xsl:template name="find-wrap-point">
<xsl:param name="text"/>
<xsl:param name="prefix"/>
<xsl:param name="result" select="0"/>
<xsl:param name="default" select="$max-columns - string-length($prefix)"/>
<xsl:variable name="s" select="substring($text, 2)"/>
<xsl:variable name="candidate">
<xsl:choose>
<xsl:when test="contains($s, ' ')">
<xsl:value-of select="string-length(substring-before($s, ' ')) + 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string-length($text)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($prefix) + $result + $candidate &lt;= $max-columns">
<xsl:call-template name="find-wrap-point">
<xsl:with-param name="text" select="substring($text, $candidate + 1)"/>
<xsl:with-param name="prefix" select="$prefix"/>
<xsl:with-param name="result" select="$result + $candidate"/>
<xsl:with-param name="default" select="$result + $candidate"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$default"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="wrap-comment">
<xsl:param name="prefix"/>
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="string-length($prefix) + string-length($text) &lt;= $max-columns">
<xsl:value-of select="$text"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="size">
<xsl:call-template name="find-wrap-point">
<xsl:with-param name="prefix" select="$prefix"/>
<xsl:with-param name="text" select="$text"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="substring($text, 1, $size)"/>
<xsl:text>&#10;</xsl:text>
<xsl:value-of select="$prefix"/>
<xsl:call-template name="wrap-comment">
<xsl:with-param name="prefix" select="$prefix"/>
<xsl:with-param name="text" select="normalize-space(substring($text, $size + 1))"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Comment mode tries to wipe out any extra spacing in the output -->
<xsl:template match="purpose" mode="comment">
<xsl:apply-templates mode="comment"/>
<xsl:param name="wrap" select="false()"/>
<xsl:param name="prefix"/>
<xsl:apply-templates mode="comment">
<xsl:with-param name="wrap"
select="$wrap and count(*) = 0 and count(text()) = 1"/>
<xsl:with-param name="prefix" select="$prefix"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="simpara|para" mode="comment">
@ -108,7 +170,20 @@
</xsl:template>
<xsl:template match="text()" mode="comment">
<xsl:param name="wrap" select="false()"/>
<xsl:param name="prefix"/>
<xsl:variable name="stripped" select="normalize-space(.)"/>
<xsl:choose>
<xsl:when test="$wrap">
<xsl:call-template name="wrap-comment">
<xsl:with-param name="prefix" select="$prefix"/>
<xsl:with-param name="text" select="$stripped"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*" mode="comment">

View File

@ -75,11 +75,11 @@
<xsl:choose>
<xsl:when test="$boost.syntax.highlight='1'">
<phrase role="comment">
<xsl:value-of select="$text"/>
<xsl:copy-of select="$text"/>
</phrase>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
<xsl:copy-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

View File

@ -764,7 +764,8 @@ Unknown type element "<xsl:value-of select="local-name(.)"/>" in type.display.na
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation + 2"/>
</xsl:call-template>
<emphasis>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:text>// </xsl:text>
<!-- True if there are any non-compacted typedefs -->
<xsl:variable name="have-typedef-references"
@ -783,7 +784,8 @@ Unknown type element "<xsl:value-of select="local-name(.)"/>" in type.display.na
<xsl:text>types</xsl:text>
</xsl:otherwise>
</xsl:choose>
</emphasis>
</xsl:with-param>
</xsl:call-template>
<xsl:variable name="max-type-length">
<xsl:call-template name="find-max-type-length"/>
@ -912,15 +914,22 @@ Unknown type element "<xsl:value-of select="local-name(.)"/>" in type.display.na
comment. -->
<xsl:if test="purpose">
<xsl:text>&#10;</xsl:text>
<xsl:variable name="spaces">
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
</xsl:variable>
<xsl:copy-of select="$spaces"/>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:text>// </xsl:text>
<xsl:apply-templates select="purpose" mode="comment"/>
<xsl:apply-templates select="purpose" mode="comment">
<xsl:with-param name="wrap" select="true()"/>
<xsl:with-param name="prefix" select="concat($spaces, '// ')"/>
</xsl:apply-templates>
</xsl:with-param>
</xsl:call-template>
<xsl:text>&#10;</xsl:text>
</xsl:if>
</xsl:if>