emit documentation for namespace-scope objects

[SVN r31225]
This commit is contained in:
Eric Niebler 2005-10-07 17:51:29 +00:00
parent 50dc933ebf
commit aa84fd9b1e
4 changed files with 100 additions and 3 deletions

View File

@ -670,7 +670,9 @@ Cannot handle sectiondef with kind=<xsl:value-of select="@kind"/>
</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,8 @@ Cannot handle memberdef element with kind=<xsl:value-of select="@kind"/>
<!-- 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 +989,7 @@ Cannot handle memberdef element with kind=<xsl:value-of select="@kind"/>
<xsl:apply-templates select="briefdescription" mode="passthrough"/>
<xsl:apply-templates select="detaileddescription" mode="passthrough"/>
</data-member>
</xsl:if>
</xsl:template>
<!-- Things we ignore directly -->

66
xsl/global.xsl Executable file
View File

@ -0,0 +1,66 @@
<?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:if test="not(local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() &gt; 1)">
<xsl:text>&#10;</xsl:text>
</xsl:if>
<xsl:text>&#10;</xsl:text>
<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>

View File

@ -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>

View File

@ -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 @@ Unknown type element "<xsl:value-of select="local-name(.)"/>" in type.display.na
<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 @@ Unknown type element "<xsl:value-of select="local-name(.)"/>" in type.display.na
<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 -->