diff options
author | Lukas Larsson <lukas@erlang.org> | 2021-09-15 17:12:27 +0200 |
---|---|---|
committer | Lukas Larsson <lukas@erlang.org> | 2021-10-07 16:51:44 +0200 |
commit | 6e6775b22b0ab1efd181ae04423a0ab0f9b473fe (patch) | |
tree | 5b4989d4d961cf881a132200620a32c0ac8a225b | |
parent | 58a5e8d43c90abd276d1e318cebf9774588daa3b (diff) | |
download | erlang-6e6775b22b0ab1efd181ae04423a0ab0f9b473fe.tar.gz |
docgen: Restrict title-name class to only be name and not erlang prefix
We do this in order to ease parsing of the content of webcrawlers.
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_html.xsl | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl index 1fedb53fea..dce99474d3 100644 --- a/lib/erl_docgen/priv/xsl/db_html.xsl +++ b/lib/erl_docgen/priv/xsl/db_html.xsl @@ -266,12 +266,34 @@ <xsl:with-param name="id" select="$id"/> </xsl:call-template> </div> - <div class="title-name"> + <xsl:variable name="name"> <xsl:apply-templates mode="local_type"> <xsl:with-param name="local_types" select="$local_types"/> <xsl:with-param name="global_types" select="$global_types"/> </xsl:apply-templates> - </div> + </xsl:variable> + <!-- We do not include the erlang: prefix in what is selected by + .title-name. This is so that webcrawlers can select the true + function name, i.e. decode_packet instead of erlang:decode_packet. + --> + <xsl:variable name="head" select="exsl:node-set($name)/text()[1]"/> + <xsl:variable name="tail" select="exsl:node-set($name)/node()[position() > 1]"/> + <xsl:choose> + <xsl:when test="substring($head,1,7) = 'erlang:'"> + <div> + <xsl:text>erlang:</xsl:text> + <span class="title-name"> + <xsl:value-of select="substring-after($head,':')"/> + <xsl:copy-of select="$tail"/> + </span> + </div> + </xsl:when> + <xsl:otherwise> + <span class="title-name"> + <xsl:copy-of select="$name"/> + </span> + </xsl:otherwise> + </xsl:choose> <xsl:if test="string-length($since) > 0"> <div class="title-since"> <span class="since"><xsl:value-of select="$since"/> |