Merge pull request #24 from Lastique/feature/fix_doxygen_enum_initializers

Fix duplicate equal signs in Doxygen-generated enum value initializers
This commit is contained in:
Andrey Semashev 2024-05-13 15:31:28 +03:00 committed by GitHub
commit d5ac8b1cdd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -324,7 +324,8 @@
<xsl:if test="initializer"> <xsl:if test="initializer">
<default> <default>
<xsl:apply-templates select="initializer/*|initializer/text()" mode="passthrough"/> <xsl:apply-templates select="initializer/*|initializer/text()"
mode="enumvalue.initializer"/>
</default> </default>
</xsl:if> </xsl:if>
@ -336,6 +337,24 @@
</xsl:choose> </xsl:choose>
</xsl:template> </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:template name="doxygen.include.header.rec">
<xsl:param name="name"/> <xsl:param name="name"/>
<xsl:param name="header-list" select="$boost.doxygen.headers"/> <xsl:param name="header-list" select="$boost.doxygen.headers"/>