Fix duplicate equal signs in Doxygen-generated enum value initializers.

Doxygen 1.9.1 generates enum <initializer> tags with text starting with
an equal sign ('=') followed by the enum value initializer. This sign
was copied under the BoostBook <default> tag, and BoostBook styleseets
add an equal sign of their own when converting this tag to HTML. This
resulted in duplicate equal signs in the HTML output.

This commit strips the leading equal sign from the initializer before
putting it into the <default> tag.
This commit is contained in:
Andrey Semashev 2024-04-28 15:18:27 +03:00
parent faacd1f26a
commit 5c1e683568

View File

@ -324,7 +324,8 @@
<xsl:if test="initializer">
<default>
<xsl:apply-templates select="initializer/*|initializer/text()" mode="passthrough"/>
<xsl:apply-templates select="initializer/*|initializer/text()"
mode="enumvalue.initializer"/>
</default>
</xsl:if>
@ -336,6 +337,24 @@
</xsl:choose>
</xsl:template>
<xsl:template match="text()" mode="enumvalue.initializer">
<!-- Remove the leading '=' sign from enum value initializers, the '='
character will be added later, by the templates processing <default>
tags. -->
<xsl:choose>
<xsl:when test="starts-with(normalize-space(string(.)), '=')">
<xsl:value-of select="normalize-space(substring-after(string(.), '='))"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*" mode="enumvalue.initializer">
<xsl:apply-templates mode="passthrough"/>
</xsl:template>
<xsl:template name="doxygen.include.header.rec">
<xsl:param name="name"/>
<xsl:param name="header-list" select="$boost.doxygen.headers"/>