diff options
author | Hans Bolinder <[email protected]> | 2016-05-17 12:54:19 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-05-17 13:04:30 +0200 |
commit | 3aaf31e7a31fbdc12b5864fe3a208a5e721a2869 (patch) | |
tree | 3624607f63f8dd1d2cb1b0b865cd711858a955d3 | |
parent | a907e6e2fd708b809c45d9d9f963329bacfb1c82 (diff) | |
download | otp-3aaf31e7a31fbdc12b5864fe3a208a5e721a2869.tar.gz otp-3aaf31e7a31fbdc12b5864fe3a208a5e721a2869.tar.bz2 otp-3aaf31e7a31fbdc12b5864fe3a208a5e721a2869.zip |
erl_docgen: Add anchors to datatypes without name attribute
db_html.xsl generates anchors for data types referred to by strings
(instead of 'name' attributes). For example:
<datatype>
<name>edge()</name>
</datatype>
generates:
<p><a name="type-edge"><span class="bold_code">edge()</span></a><br></p>
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_html.xsl | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl index a3c71fea15..c2d7d40446 100644 --- a/lib/erl_docgen/priv/xsl/db_html.xsl +++ b/lib/erl_docgen/priv/xsl/db_html.xsl @@ -383,9 +383,7 @@ </xsl:choose> </xsl:when> <xsl:otherwise> <!-- <datatype> with <name> --> - <span class="bold_code"> - <xsl:apply-templates/> - </span> + <xsl:call-template name="name"/> </xsl:otherwise> </xsl:choose> </xsl:template> @@ -1855,6 +1853,7 @@ </xsl:choose> </xsl:template> + <!-- Used both in <datatype> and in <func>! --> <xsl:template name="name"> <xsl:variable name="tmpstring"> @@ -1911,7 +1910,14 @@ </xsl:otherwise> </xsl:choose> </xsl:variable> - <a name="{$fname}-{$arity}"><span class="bold_code"><xsl:value-of select="."/></span></a><br/> + <xsl:choose> + <xsl:when test="ancestor::datatype"> + <a name="type-{$fname}"><span class="bold_code"><xsl:value-of select="."/></span></a><br/> + </xsl:when> + <xsl:otherwise> + <a name="{$fname}-{$arity}"><span class="bold_code"><xsl:value-of select="."/></span></a><br/> + </xsl:otherwise> + </xsl:choose> </xsl:when> <xsl:otherwise> <span class="bold_code"><xsl:value-of select="."/></span> |