aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2017-10-23 15:49:54 +0200
committerHans Bolinder <[email protected]>2017-10-27 14:24:54 +0200
commitfb5bed5e5021841f67450f5ab911c13f184d0dbc (patch)
treed6093f24bea199b851c9fbfd00719f039f9cec25
parent1f34276d88c1bbbff29fbd0e38210608e17cc0be (diff)
downloadotp-fb5bed5e5021841f67450f5ab911c13f184d0dbc.tar.gz
otp-fb5bed5e5021841f67450f5ab911c13f184d0dbc.tar.bz2
otp-fb5bed5e5021841f67450f5ab911c13f184d0dbc.zip
erl_docgen: Insert an anchor for "anchor" attribute
Certain functions, particularly in erlang(3), have specs with many clauses, some of which are documented separately. No anchors were inserted automatically for clauses (as is the case for functions), why manually written anchors had to be added to the XML files. However, these anchors had to be placed inside the description, and the links would point into the text, not into the name of the function/clause. The new "anchor" attribute is to be used where manually written anchors have hitherto been used. The "anchor" attribute can also be used without the "clause_i" attribute.
-rw-r--r--lib/erl_docgen/priv/dtd/erlref.dtd1
-rw-r--r--lib/erl_docgen/priv/xsl/db_html.xsl6
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/erl_docgen/priv/dtd/erlref.dtd b/lib/erl_docgen/priv/dtd/erlref.dtd
index 615b88b61a..78d6771f52 100644
--- a/lib/erl_docgen/priv/dtd/erlref.dtd
+++ b/lib/erl_docgen/priv/dtd/erlref.dtd
@@ -33,4 +33,5 @@
<!ATTLIST name name CDATA #IMPLIED
arity CDATA #IMPLIED
clause_i CDATA #IMPLIED
+ anchor CDATA #IMPLIED
n_vars CDATA #IMPLIED>
diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl
index 75614392fb..5b7eae4f73 100644
--- a/lib/erl_docgen/priv/xsl/db_html.xsl
+++ b/lib/erl_docgen/priv/xsl/db_html.xsl
@@ -172,6 +172,7 @@
<xsl:template name="spec_name">
<xsl:variable name="name" select="@name"/>
<xsl:variable name="arity" select="@arity"/>
+ <xsl:variable name="anchor" select="@anchor"/>
<xsl:variable name="spec0">
<xsl:call-template name="find_spec"/>
</xsl:variable>
@@ -198,6 +199,11 @@
</xsl:otherwise>
</xsl:choose>
+ <!-- Insert an anchor for "anchor" attribute -->
+ <xsl:if test="string-length($anchor) > 0">
+ <a name="{$anchor}"></a>
+ </xsl:if>
+
<xsl:variable name="global_types" select="ancestor::erlref/datatypes"/>
<xsl:variable name="local_types"
select="../type[string-length(@name) > 0]"/>