Fix missing members and functions in named groups in Doxygen output.

Previously, class members and free functions in sectiondef with
kind="user-defined" would be stripped from HTML output, making function
grouping effectively non-functional. This commit fixes this by converting
such sectiondefs to either method-group or free-function-group in BoostBook
output, depending on whether the grouping is within a class or namespace.

Additionally, previously constructors, destructors and assignment operators
were not allowed to be inside method-groups, which were another reason for
these members to be stripped from the output. This commit allows these members
in member-groups and modifies DTD accordingly.

Also, this fixes duplicate constructors, destructors and assignment operators
generated after the sections for public, private and protected member
functions. This was due to applying XSL templates twice - once when generating
method-group, and then after the method-group.
This commit is contained in:
Andrey Semashev 2024-05-04 20:42:06 +03:00
parent 0b665ad198
commit 61ca6ef7d9
3 changed files with 37 additions and 18 deletions

View File

@ -240,7 +240,7 @@
<!ELEMENT postconditions ANY>
<!ATTLIST postconditions %boost.common.attrib;>
<!ELEMENT method-group (method|overloaded-method)*>
<!ELEMENT method-group (constructor|copy-assignment|destructor|method|overloaded-method)*>
<!ATTLIST method-group
name CDATA #REQUIRED
%boost.common.attrib;>

View File

@ -788,7 +788,6 @@
</xsl:apply-templates>
</method-group>
<xsl:text>&#10;</xsl:text><!-- Newline -->
<xsl:apply-templates/>
</xsl:if>
</xsl:when>
<xsl:when test="@kind='protected-func'">
@ -800,7 +799,6 @@
</xsl:apply-templates>
</method-group>
<xsl:text>&#10;</xsl:text><!-- Newline -->
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="@kind='private-func'">
<xsl:variable name="members" select="./memberdef"/>
@ -819,7 +817,6 @@
</method-group>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:if>
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="@kind='friend'">
<xsl:if test="./memberdef/detaileddescription/para or ./memberdef/briefdescription/para">
@ -870,9 +867,37 @@
</xsl:apply-templates>
</xsl:when>
<xsl:when test="@kind='user-defined'">
<xsl:choose>
<xsl:when test="not(string(./header/text()) = '')">
<xsl:variable name="group-type">
<xsl:choose>
<xsl:when test="ancestor::compounddef/attribute::kind='namespace'">
<xsl:value-of select="'free-function-group'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'method-group'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="{$group-type}">
<xsl:attribute name="name">
<xsl:value-of select="string(./header/text())"/>
</xsl:attribute>
<xsl:text>&#10;</xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:element>
<xsl:text>&#10;</xsl:text><!-- Newline -->
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@kind=''">
<xsl:apply-templates select="memberdef[generate-id() =
@ -937,19 +962,13 @@
<xsl:choose>
<xsl:when test="string(name/text())=$in-class">
<xsl:if test="not ($in-section)">
<xsl:call-template name="constructor"/>
</xsl:if>
</xsl:when>
<xsl:when test="string(name/text())=concat('~',$in-class)">
<xsl:if test="not ($in-section)">
<xsl:call-template name="destructor"/>
</xsl:if>
</xsl:when>
<xsl:when test="string(name/text())='operator='">
<xsl:if test="not ($in-section)">
<xsl:call-template name="copy-assignment"/>
</xsl:if>
</xsl:when>
<xsl:when test="normalize-space(string(type))=''
and contains(name/text(), 'operator ')">

View File

@ -1133,7 +1133,7 @@
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="method|overloaded-method"
<xsl:apply-templates select="constructor|copy-assignment|destructor|method|overloaded-method"
mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
@ -1161,7 +1161,7 @@
</xsl:with-param>
<xsl:with-param name="text">
<orderedlist>
<xsl:apply-templates select="method|overloaded-method"
<xsl:apply-templates select="constructor|copy-assignment|destructor|method|overloaded-method"
mode="reference"/>
</orderedlist>
</xsl:with-param>