Eric Niebler wrote:
This has driven me batty for ages, so today I dug into it a bit. I can't
get Doxygen/BoostBook to emit any documentation about global objects.
<snip>
Hopefully, this is enough to prod an xsl guru in the right direction.
Alas, I was unable to prod someone else into action, so I gave it a shot
myself. My XLS skillz are weak, but the attached seems to work for me.
I'm including a patch for reference.xsl, type.xsl and
doxygen2boostbook.xsl, as well as a new file: globals.xsl. Should I submit?
Unfortunately, the doc build is broken right now, so I haven't tested it
on the full set of boost docs.
--
Eric Niebler
Boost Consulting
www.boost-consulting.com
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template name="global-synopsis">
<xsl:param name="indentation" select="0"/>
<xsl:text> </xsl:text>
<xsl:if
test="not(local-name(preceding-sibling::*[position()=1])=local-name(.))">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="global-synopsis-impl">
<xsl:with-param name="link-type" select="'link'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="global-reference">
<xsl:call-template name="reference-documentation">
<xsl:with-param name="refname">
<xsl:call-template name="fully-qualified-name">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
<xsl:apply-templates select="specialization"/>
</xsl:with-param>
<xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
<xsl:with-param name="anchor">
<xsl:call-template name="generate.id"/>
</xsl:with-param>
<xsl:with-param name="name">
<xsl:text>Global </xsl:text>
<xsl:call-template name="monospaced">
<xsl:with-param name="text" select="@name"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="synopsis">
<xsl:call-template name="global-synopsis-impl">
<xsl:with-param name="link-type" select="'none'"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="text">
<xsl:apply-templates select="description"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="global-synopsis-impl">
<xsl:param name="link-type"/>
<xsl:if test="@specifiers">
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="@specifiers"/>
</xsl:call-template>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates select="type/*|type/text()" mode="annotation"/>
<xsl:text> </xsl:text>
<xsl:call-template name="link-or-anchor">
<xsl:with-param name="to">
<xsl:call-template name="generate.id" select="."/>
</xsl:with-param>
<xsl:with-param name="text" select="@name"/>
<xsl:with-param name="link-type" select="$link-type"/>
</xsl:call-template>
<xsl:text>;</xsl:text>
</xsl:template>
<xsl:template match="data-member" mode="generate.id">
<xsl:value-of select="@name"/>
</xsl:template>
</xsl:stylesheet>
? global.xsl
? globals.patch
Index: reference.xsl
===================================================================
RCS file: /cvsroot/boost/boost/tools/boostbook/xsl/reference.xsl,v
retrieving revision 1.5
diff -b -d -u -r1.5 reference.xsl
--- reference.xsl 28 Jan 2004 02:46:07 -0000 1.5
+++ reference.xsl 6 Oct 2005 07:05:10 -0000
@@ -30,7 +30,7 @@
<xsl:apply-templates select="class|class-specialization|
struct|struct-specialization|
union|union-specialization|
- typedef|enum" mode="synopsis">
+ typedef|enum|data-member" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation + 2"/>
</xsl:apply-templates>
@@ -82,7 +82,7 @@
<xsl:apply-templates select="class|class-specialization|
struct|struct-specialization|
union|union-specialization|enum|function|
- overloaded-function"
+ overloaded-function|data-member"
mode="namespace-reference"/>
</xsl:template>
Index: type.xsl
===================================================================
RCS file: /cvsroot/boost/boost/tools/boostbook/xsl/type.xsl,v
retrieving revision 1.12
diff -b -d -u -r1.12 type.xsl
--- type.xsl 24 Sep 2004 14:54:35 -0000 1.12
+++ type.xsl 6 Oct 2005 07:05:10 -0000
@@ -2,6 +2,7 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
+ <xsl:include href="global.xsl"/>
<xsl:strip-space elements="inherit purpose"/>
<!-- When true, the stylesheet will emit compact definitions of
@@ -844,6 +845,11 @@
<xsl:template match="data-member" mode="synopsis">
<xsl:param name="indentation"/>
+ <xsl:choose>
+ <xsl:when test="ancestor::class|ancestor::class-specialization|
+ ancestor::struct|ancestor::struct-specialization|
+ ancestor::union|ancestor::union-specialization">
+
<!-- Spacing -->
<xsl:if
test="not(local-name(preceding-sibling::*[position()=1])=local-name(.))">
@@ -867,6 +873,26 @@
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>;</xsl:text>
+
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="global-synopsis">
+ <xsl:with-param name="indentation" select="$indentation"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Data member reference -->
+ <xsl:template match="data-member" mode="reference">
+ <xsl:choose>
+ <xsl:when test="ancestor::class|ancestor::class-specialization|
+ ancestor::struct|ancestor::struct-specialization|
+ ancestor::union|ancestor::union-specialization"/>
+ <xsl:otherwise>
+ <xsl:call-template name="global-reference"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<!-- Enumeration synopsis -->
Index: doxygen/doxygen2boostbook.xsl
===================================================================
RCS file:
/cvsroot/boost/boost/tools/boostbook/xsl/doxygen/doxygen2boostbook.xsl,v
retrieving revision 1.25
diff -b -d -u -r1.25 doxygen2boostbook.xsl
--- doxygen/doxygen2boostbook.xsl 23 Aug 2004 21:12:34 -0000 1.25
+++ doxygen/doxygen2boostbook.xsl 6 Oct 2005 07:05:10 -0000
@@ -670,7 +670,9 @@
</xsl:call-template>
</xsl:when>
<xsl:when test="@kind='variable'">
- <xsl:call-template name="variable"/>
+ <xsl:call-template name="variable">
+ <xsl:with-param name="in-file" select="$in-file"/>
+ </xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:message>
@@ -965,6 +967,9 @@
<!-- Handle member variables -->
<xsl:template name="variable">
+ <xsl:param name="in-file"/>
+
+ <xsl:if test="contains(string(location/attribute::file), $in-file)">
<data-member>
<xsl:attribute name="name">
<xsl:value-of select="name/text()"/>
@@ -985,6 +990,7 @@
<xsl:apply-templates select="briefdescription" mode="passthrough"/>
<xsl:apply-templates select="detaileddescription" mode="passthrough"/>
</data-member>
+ </xsl:if>
</xsl:template>
<!-- Things we ignore directly -->