aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_docgen
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2018-04-09 15:08:28 +0200
committerLukas Larsson <[email protected]>2018-04-10 14:08:00 +0200
commit70b94d93a425873d643b042d131603fea08e4ab3 (patch)
treed6f313ef9621b2aec8ee1c0227e51596d3b7db57 /lib/erl_docgen
parent91e1ba270bbaf8914a6ddbfbc9ce1b95d47b3443 (diff)
downloadotp-70b94d93a425873d643b042d131603fea08e4ab3.tar.gz
otp-70b94d93a425873d643b042d131603fea08e4ab3.tar.bz2
otp-70b94d93a425873d643b042d131603fea08e4ab3.zip
erl_docgen: Use name based anchors where possible
We don't want to use generate-id as it varies across builds so it becomes impossible to link permanently to specific sections.
Diffstat (limited to 'lib/erl_docgen')
-rw-r--r--lib/erl_docgen/priv/xsl/db_html.xsl12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl
index d92241277d..b6ebcc0c67 100644
--- a/lib/erl_docgen/priv/xsl/db_html.xsl
+++ b/lib/erl_docgen/priv/xsl/db_html.xsl
@@ -67,6 +67,11 @@
<func:result select="$result"/>
</func:function>
+ <func:function name="erl:to-link">
+ <xsl:param name="text"/>
+ <func:result select="translate(erl:lower-case($text),': /()&quot;&#10;','-------')"/>
+ </func:function>
+
<!-- Used from template menu.funcs to sort a module's functions for the lefthand index list,
from the module's .xml file. Returns a value on which to sort the entity in question
(a <name> element).
@@ -951,7 +956,6 @@
<xsl:call-template name="marker-before-title"/>
</xsl:for-each>
<xsl:call-template name="title_link">
- <xsl:with-param name="link" select="generate-id(title)"/>
<xsl:with-param name="title">
<xsl:value-of select="$chapnum"/>.<xsl:number/>&#160;
<xsl:value-of select="title"/>
@@ -1397,7 +1401,7 @@
<xsl:param name="chapter_file"/>
<xsl:for-each select="$entries">
<li title="{title}">
- <a href="{$chapter_file}.html#{generate-id(title)}">
+ <a href="{$chapter_file}.html#{erl:to-link(title)}">
<xsl:value-of select="title"/>
</a>
</li>
@@ -2202,14 +2206,14 @@
<h3>
<xsl:call-template name="title_link">
<xsl:with-param name="title" select="$title"/>
- <xsl:with-param name="link" select="translate(erl:lower-case($title),' ','-')"/>
+ <xsl:with-param name="link" select="erl:to-link($title)"/>
</xsl:call-template>
</h3>
</xsl:template>
<xsl:template name="title_link">
<xsl:param name="title"/>
- <xsl:param name="link" select="generate-id(title)"/>
+ <xsl:param name="link" select="erl:to-link(title)"/>
<xsl:param name="ghlink" select="ancestor-or-self::*[@ghlink][position() = 1]/@ghlink"/>
<xsl:variable name="id" select="concat(concat($link,'-'), generate-id(.))"/>
<span onMouseOver="document.getElementById('ghlink-{$id}').style.visibility = 'visible';"