Render alias templates instead of plain typedefs in the reference (#32)

Doxygen emits C++ alias templates ("template<...> using X = ...;") as
typedef memberdefs carrying a templateparamlist, but the conversion
dropped that list, so alias templates appeared as plain typedefs with
their template parameters lost.
- doxygen2boostbook.xsl: carry the templateparamlist through to a
  <template> child of the generated <typedef>.
- boostbook.dtd: allow an optional <template> inside <typedef>.
- type.xsl: when a typedef has a <template> child, render it as
  "template<...> using name = type;" and exclude it from typedef
  column alignment.
This commit is contained in:
Ion Gaztañaga
2026-07-02 02:02:19 +02:00
committed by GitHub
parent dfeb783496
commit ba221096aa
3 changed files with 52 additions and 2 deletions
+1 -1
View File
@@ -205,7 +205,7 @@
<!ELEMENT type ANY>
<!ATTLIST type %boost.common.attrib;>
<!ELEMENT typedef (type, purpose?, description?)>
<!ELEMENT typedef (template?, type, purpose?, description?)>
<!ATTLIST typedef
name CDATA #REQUIRED
%boost.common.attrib;>
+7 -1
View File
@@ -1152,7 +1152,13 @@
<xsl:attribute name="name">
<xsl:value-of select="name/text()"/>
</xsl:attribute>
<!-- Alias templates ("template<...> using X = ...;") are emitted by
Doxygen as typedef memberdefs carrying a templateparamlist. Keep
that information so the typedef is rendered as an alias template
instead of a plain typedef. -->
<xsl:apply-templates select="templateparamlist" mode="template"/>
<xsl:apply-templates select="briefdescription" mode="passthrough"/>
<xsl:apply-templates select="detaileddescription" mode="passthrough"/>
<xsl:apply-templates select="inbodydescription" mode="passthrough"/>
+44
View File
@@ -269,6 +269,45 @@ Unknown type element "<xsl:value-of select="local-name(.)"/>" in type.display.na
<xsl:text>&#10;</xsl:text>
<xsl:choose>
<!-- Alias template: render as "template<...> using name = type;" -->
<xsl:when test="template">
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:apply-templates select="template" mode="reference">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
<xsl:text>&#10;</xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="'using'"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:call-template name="link-or-anchor">
<xsl:with-param name="to" select="$link-to"/>
<xsl:with-param name="text" select="$typedef-name"/>
<xsl:with-param name="link-type" select="$link-type"/>
<xsl:with-param name="highlight" select="true()"/>
</xsl:call-template>
<xsl:call-template name="highlight-text">
<xsl:with-param name="text" select="' = '"/>
</xsl:call-template>
<xsl:apply-templates select="type/*|type/text()" mode="highlight"/>
<xsl:call-template name="highlight-special">
<xsl:with-param name="text" select="';'"/>
</xsl:call-template>
<xsl:if test="$compact and purpose">
<xsl:text> </xsl:text>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:text>// </xsl:text>
<xsl:apply-templates select="purpose" mode="comment"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:when>
<!-- Create a vertical ellipsis -->
<xsl:when test="@name = '...'">
<xsl:call-template name="indent">
@@ -683,6 +722,11 @@ Unknown type element "<xsl:value-of select="local-name(.)"/>" in type.display.na
<!-- Find the length of the type -->
<xsl:variable name="length">
<xsl:choose>
<!-- Alias templates are rendered on their own lines and do not
participate in column alignment. -->
<xsl:when test="$typedef/template">
<xsl:value-of select="0"/>
</xsl:when>
<xsl:when test="$typedef/@name != '...'">
<xsl:choose>
<xsl:when test="$want-name">