diff options
Diffstat (limited to 'lib/erl_docgen/priv/xsl')
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_eix.xsl | 10 | ||||
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_html.xsl | 92 | ||||
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_man.xsl | 29 | ||||
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_pdf.xsl | 2 |
4 files changed, 88 insertions, 45 deletions
diff --git a/lib/erl_docgen/priv/xsl/db_eix.xsl b/lib/erl_docgen/priv/xsl/db_eix.xsl index 7a648ddfd7..249e6950f7 100644 --- a/lib/erl_docgen/priv/xsl/db_eix.xsl +++ b/lib/erl_docgen/priv/xsl/db_eix.xsl @@ -106,10 +106,14 @@ <xsl:choose> <!-- @arity is mandatory when referring to a specification --> <xsl:when test="string-length(@arity) > 0"> - <xsl:call-template name="spec_name"/> + <xsl:call-template name="spec_name"> + <xsl:with-param name="lastfuncsblock" select="$lastfuncsblock"/> + </xsl:call-template> </xsl:when> <xsl:otherwise> - <xsl:call-template name="name"/> + <xsl:call-template name="name"> + <xsl:with-param name="lastfuncsblock" select="$lastfuncsblock"/> + </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> @@ -324,7 +328,7 @@ <xsl:choose> <xsl:when test="string-length($tmp1) > 0 or starts-with($string, $start)"> <xsl:variable name="tmp2"> - <xsl:value-of select="substring-after($string, $end)"/> + <xsl:value-of select="substring-after(substring-after($string, $start), $end)"/> </xsl:variable> <xsl:variable name="retstring"> <xsl:call-template name="remove-paren"> diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl index a9052f29e5..4f6c758e7b 100644 --- a/lib/erl_docgen/priv/xsl/db_html.xsl +++ b/lib/erl_docgen/priv/xsl/db_html.xsl @@ -3,7 +3,7 @@ # # %CopyrightBegin% # - # Copyright Ericsson AB 2009-2011. All Rights Reserved. + # Copyright Ericsson AB 2009-2012. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in @@ -40,6 +40,11 @@ <xsl:variable name="m2a" select="document($mod2app_file)"></xsl:variable> <xsl:key name="mod2app" match="module" use="@name"/> + <xsl:key + name="mfa" + match="func/name[string-length(@arity) > 0 and ancestor::erlref]" + use="concat(ancestor::erlref/module,':',@name, '/', @arity)"/> + <xsl:template name="err"> <xsl:param name="f"/> <xsl:param name="m"/> @@ -101,10 +106,14 @@ </xsl:message> </xsl:when> <xsl:when test="ancestor::erlref"> + <!-- Do not to use preceding since it is very slow! --> + <xsl:variable name="curModule" select="ancestor::erlref/module"/> + <xsl:variable name="mfas" + select="key('mfa', + concat($curModule,':',$name,'/',$arity))"/> <xsl:choose> - <xsl:when test="preceding-sibling::name[position() = 1 - and @name = $name and @arity = $arity]"> - <!-- Avoid duplicated anchors.--> + <xsl:when test="generate-id($mfas[1]) != generate-id(.)"> + <!-- Avoid duplicated anchors. See also menu.funcs. --> </xsl:when> <xsl:otherwise> <a name="{$name}-{$arity}"></a> @@ -1319,6 +1328,7 @@ <xsl:with-param name="entries" select="funcs/func/name"/> <xsl:with-param name="basename"><xsl:value-of select="$link_cval"/></xsl:with-param> + <xsl:with-param name="cval" select="$cval"/> </xsl:call-template> </ul> </li> @@ -1349,6 +1359,7 @@ <xsl:template name="menu.funcs"> <xsl:param name="entries"/> <xsl:param name="basename"/> + <xsl:param name="cval"/> <xsl:for-each select="$entries"> @@ -1434,9 +1445,14 @@ </xsl:choose> </xsl:variable> + <!-- Avoid duplicated entries. See also template "spec_name" --> + <!-- Do not to use preceding since it is very slow! --> + <xsl:variable name="mfas" + select="key('mfa', + concat($cval,':',$fname,'/',$arity))"/> <xsl:choose> - <xsl:when test="preceding-sibling::name[position() = 1 - and @name = $fname and @arity = $arity]"> + <xsl:when test="string-length(@name) > 0 and + generate-id($mfas[1]) != generate-id(.)"> <!-- Skip. Only works for Dialyzer specs. --> </xsl:when> <xsl:otherwise> @@ -1854,18 +1870,24 @@ <xsl:choose> <xsl:when test="string-length($filepart) > 0"> - <xsl:variable name="modulepart"><xsl:value-of select="substring-before($filepart, ':')"/></xsl:variable> + <!-- "Filepart#Linkpart" (or "Filepart#") --> + <xsl:variable name="app_part"><xsl:value-of select="substring-before($filepart, ':')"/></xsl:variable> <xsl:choose> - <xsl:when test="string-length($modulepart) > 0"> - <xsl:variable name="filepart1"><xsl:value-of select="substring-after($filepart, ':')"/></xsl:variable> - <span class="bold_code"><a href="javascript:erlhref('{$topdocdir}/../','{$modulepart}','{$filepart1}.html#{$linkpart}');"><xsl:apply-templates/></a></span> + <xsl:when test="string-length($app_part) > 0"> + <!-- "AppPart:ModPart#Linkpart" --> + <xsl:variable name="mod_part"><xsl:value-of select="substring-after($filepart, ':')"/></xsl:variable> + <span class="bold_code"><a href="javascript:erlhref('{$topdocdir}/../','{$app_part}','{$mod_part}.html#{$linkpart}');"><xsl:apply-templates/></a></span> </xsl:when> <xsl:otherwise> + <!-- "Filepart#Linkpart (there is no ':' in Filepart) --> + <xsl:variable name="minus_prefix" + select="substring-before($linkpart, '-')"/> <xsl:choose> - <!-- Dialyzer seealso (the application is unknown) --> - <xsl:when test="string-length($specs_file) > 0 + <xsl:when test="$minus_prefix = 'type' + and string-length($specs_file) > 0 and count($i/specs/module[@name=$filepart]) = 0"> - <!-- Deemed to slow; use key() instead + <!-- Dialyzer seealso (the application is unknown) --> + <!-- Following code deemed too slow; use key() instead <xsl:variable name="app" select="$m2a/mod2app/module[@name=$filepart]"/> --> @@ -1877,41 +1899,45 @@ <span class="bold_code"><a href="javascript:erlhref('{$topdocdir}/../','{$app}','{$filepart}.html#{$linkpart}');"><xsl:value-of select="$this"/></a></span> </xsl:when> <xsl:otherwise> - <!-- Unknown application; no link --> - <xsl:value-of select="$this"/> + <!-- Unknown application --> + <xsl:message terminate="yes"> + Error <xsl:value-of select="$filepart"/>: cannot find module exporting type + </xsl:message> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:when> <xsl:when test="string-length($linkpart) > 0"> + <!-- Still Filepart#Linkpart (there is no ':' in Filepart --> <span class="bold_code"><a href="{$filepart}.html#{$linkpart}"><xsl:apply-templates/></a></span> </xsl:when> <xsl:otherwise> + <!-- "Filepart#" (there is no ':' in Filepart --> <span class="bold_code"><a href="{$filepart}.html"><xsl:apply-templates/></a></span> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> + </xsl:when> <!-- string-length($filepart) > 0 --> + <xsl:when test="string-length($linkpart) > 0"> + <!-- "#Linkpart" --> + <span class="bold_code"><a href="#{$linkpart}"><xsl:apply-templates/></a></span> </xsl:when> <xsl:otherwise> - <xsl:choose> - <xsl:when test="string-length($linkpart) > 0"> - <span class="bold_code"><a href="#{$linkpart}"><xsl:apply-templates/></a></span> - </xsl:when> - <xsl:otherwise> - <xsl:variable name="modulepart"><xsl:value-of select="substring-before(@marker, ':')"/></xsl:variable> + <!-- "AppPart:Mod" or "Mod" (there is no '#') --> + <xsl:variable name="app_part"><xsl:value-of select="substring-before(@marker, ':')"/></xsl:variable> - <xsl:choose> - <xsl:when test="string-length($modulepart) > 0"> - <xsl:variable name="filepart1"><xsl:value-of select="substring-after(@marker, ':')"/></xsl:variable> - <span class="bold_code"><a href="javascript:erlhref('{$topdocdir}/../','{$modulepart}','{$filepart1}.html');"><xsl:apply-templates/></a></span> - </xsl:when> - <xsl:otherwise> - <span class="bold_code"><a href="{@marker}.html"><xsl:apply-templates/></a></span> - </xsl:otherwise> - </xsl:choose> - </xsl:otherwise> - </xsl:choose> + <xsl:choose> + <xsl:when test="string-length($app_part) > 0"> + <!-- "App:Mod" --> + <xsl:variable name="mod_part"><xsl:value-of select="substring-after(@marker, ':')"/></xsl:variable> + <span class="bold_code"><a href="javascript:erlhref('{$topdocdir}/../','{$app_part}','{$mod_part}.html');"><xsl:apply-templates/></a></span> + </xsl:when> + <xsl:otherwise> + <!-- "Mod" --> + <span class="bold_code"><a href="{@marker}.html"><xsl:apply-templates/></a></span> + </xsl:otherwise> + </xsl:choose> </xsl:otherwise> </xsl:choose> @@ -2184,7 +2210,7 @@ <xsl:choose> <xsl:when test="string-length($tmp1) > 0 or starts-with($string, $start)"> <xsl:variable name="tmp2"> - <xsl:value-of select="substring-after($string, $end)"/> + <xsl:value-of select="substring-after(substring-after($string, $start), $end)"/> </xsl:variable> <xsl:variable name="retstring"> <xsl:call-template name="remove-paren"> diff --git a/lib/erl_docgen/priv/xsl/db_man.xsl b/lib/erl_docgen/priv/xsl/db_man.xsl index 1df96caa36..5234ba6bd0 100644 --- a/lib/erl_docgen/priv/xsl/db_man.xsl +++ b/lib/erl_docgen/priv/xsl/db_man.xsl @@ -137,8 +137,9 @@ (there is no spec with more than one clause) --> <xsl:if test="count($clause/guard) > 0 or count($type) > 0"> <xsl:text> .RS</xsl:text> - <xsl:text> .TP 3</xsl:text> + <xsl:text> .LP</xsl:text> <xsl:text> Types: </xsl:text> + <xsl:text> .RS 3</xsl:text> <xsl:choose> <xsl:when test="$output_subtypes"> @@ -164,6 +165,8 @@ <xsl:with-param name="type_desc" select="$type_desc"/> <xsl:with-param name="local_types" select="$local_types"/> </xsl:call-template> + <xsl:text> .RE</xsl:text> + <xsl:text> .RE</xsl:text> </xsl:if> @@ -257,8 +260,8 @@ <!-- Similar to <d> --> <xsl:template match="type_desc"> - <xsl:text> </xsl:text><xsl:apply-templates/> - <xsl:text> .br</xsl:text> + <xsl:text> .RS 2 </xsl:text><xsl:apply-templates/> + <xsl:text> .RE</xsl:text> </xsl:template> <!-- Datatypes --> @@ -583,7 +586,15 @@ </xsl:template> <xsl:template match="seealso"> - <xsl:text>\fB</xsl:text><xsl:apply-templates/><xsl:text>\fR\&</xsl:text> + <xsl:choose> + <xsl:when test="ancestor::head"> + <!-- The header of Dialyzer specs --> + <xsl:apply-templates/> + </xsl:when> + <xsl:otherwise> + <xsl:text>\fB</xsl:text><xsl:apply-templates/><xsl:text>\fR\&</xsl:text> + </xsl:otherwise> + </xsl:choose> </xsl:template> <!-- Code --> @@ -757,24 +768,26 @@ <!-- The case where @name != 0 is taken care of in "type_name" --> <xsl:if test="string-length(@name) = 0 and string-length(@variable) = 0"> <xsl:text> .RS</xsl:text> - <xsl:text> .TP 3</xsl:text> + <xsl:text> .LP</xsl:text> <xsl:text> Types: </xsl:text> + <xsl:text> .RS 3</xsl:text> <xsl:apply-templates/> <xsl:text> .RE</xsl:text> + <xsl:text> .RE</xsl:text> </xsl:if> </xsl:template> <!-- V --> <xsl:template match="v"> - <xsl:text> </xsl:text><xsl:value-of select="normalize-space(text())"/> + <xsl:text> </xsl:text><xsl:apply-templates/> <xsl:text> .br</xsl:text> </xsl:template> <!-- D --> <xsl:template match="d"> - <xsl:text> </xsl:text><xsl:apply-templates/> - <xsl:text> .br</xsl:text> + <xsl:text> .RS 2 </xsl:text><xsl:apply-templates/> + <xsl:text> .RE</xsl:text> </xsl:template> <!-- Desc --> diff --git a/lib/erl_docgen/priv/xsl/db_pdf.xsl b/lib/erl_docgen/priv/xsl/db_pdf.xsl index 48a7a026c1..4ed4fa14c4 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf.xsl @@ -1680,7 +1680,7 @@ <xsl:choose> <xsl:when test="string-length($tmp1) > 0 or starts-with($string, $start)"> <xsl:variable name="tmp2"> - <xsl:value-of select="substring-after($string, $end)"/> + <xsl:value-of select="substring-after(substring-after($string, $start), $end)"/> </xsl:variable> <xsl:variable name="retstring"> <xsl:call-template name="remove-paren"> |