diff options
Diffstat (limited to 'lib/erl_docgen/priv/xsl')
-rw-r--r-- | lib/erl_docgen/priv/xsl/Makefile | 2 | ||||
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_eix.xsl | 2 | ||||
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_html.xsl | 192 | ||||
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_html_params.xsl | 2 | ||||
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_man.xsl | 14 | ||||
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_pdf.xsl | 28 | ||||
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_pdf_params.xsl | 2 |
7 files changed, 184 insertions, 58 deletions
diff --git a/lib/erl_docgen/priv/xsl/Makefile b/lib/erl_docgen/priv/xsl/Makefile index 80b3a59592..d0dd227169 100644 --- a/lib/erl_docgen/priv/xsl/Makefile +++ b/lib/erl_docgen/priv/xsl/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2009-2012. All Rights Reserved. +# Copyright Ericsson AB 2009-2016. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/erl_docgen/priv/xsl/db_eix.xsl b/lib/erl_docgen/priv/xsl/db_eix.xsl index 3ca6f73bd6..b496614854 100644 --- a/lib/erl_docgen/priv/xsl/db_eix.xsl +++ b/lib/erl_docgen/priv/xsl/db_eix.xsl @@ -3,7 +3,7 @@ # # %CopyrightBegin% # - # Copyright Ericsson AB 2009-2011. All Rights Reserved. + # Copyright Ericsson AB 2009-2016. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl index c2325fbee9..edab8e1c7e 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-2012. All Rights Reserved. + # Copyright Ericsson AB 2009-2016. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,11 +24,76 @@ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" - extension-element-prefixes="exsl" + xmlns:func="http://exslt.org/functions" + xmlns:erl="http://erlang.org" + extension-element-prefixes="exsl func" xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <xsl:include href="db_html_params.xsl"/> + <func:function name="erl:flip_first_char"> + <xsl:param name="in"/> + + <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> + <xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'"/> + + <xsl:variable name="first-char" select="substring($in, 1, 1)"/> + + <xsl:variable name="result"> + <xsl:choose> + <xsl:when test="contains($uppercase, $first-char)"> + <xsl:value-of select="concat(translate($first-char, $uppercase, $lowercase), substring($in, 2))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat(translate($first-char, $lowercase, $uppercase), substring($in, 2))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <func:result select="$result"/> + </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). + + Some functions are listed with the name as an attribute, as in string.xml: + <name name="join" arity="2"/> + + Others use the element value for the name, as in gen_server.xml: + <name>start_link(Module, Args, Options) -> Result</name> + + Additionally, callbacks may be included, as in gen_server.xml: + <name>Module:handle_call(Request, From, State) -> Result</name> + + So first, get the name from either the attribute or the element value. + Then, reverse the case of the first character. This is because xsltproc, used for processing, + orders uppercase before lowercase (even when the 'case-order="lower-first"' option + is given). But we want the Module callback functions listed after a module's regular + functions, as they are now. This doesn't affect the actual value used in the output, but + just the value used as a sort key. To then ensure that uppercase is indeed sorted before + lower, as we now want it to be, the 'case-order="upper-first"' option is used. + + This processing only affect the lefthand index list- the body of the doc page is not + affected. + --> + <func:function name="erl:get_sort_field"> + <xsl:param name="elem"/> + + <xsl:variable name="base"> + <xsl:choose> + <xsl:when test="string-length($elem/@name) > 0"> + <xsl:value-of select="$elem/@name"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$elem"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <func:result select="erl:flip_first_char($base)"/> + </func:function> + <!-- Start of Dialyzer type/spec tags. See also the templates matching "name" and "seealso" as well as the template "menu.funcs" @@ -383,9 +448,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> @@ -787,39 +850,36 @@ <!-- Book --> <xsl:template match="/book"> - - <xsl:apply-templates name="parts"/> - <xsl:apply-templates name="applications"/> - + <xsl:apply-templates select="parts"/> + <xsl:apply-templates select="applications"/> + <xsl:apply-templates select="releasenotes"/> </xsl:template> <!-- Parts --> <xsl:template match="parts"> - <xsl:apply-templates name="part"/> + <xsl:apply-templates select="part"/> </xsl:template> <!-- Applications --> <xsl:template match="applications"> - <xsl:apply-templates name="application"/> + <xsl:apply-templates select="application"/> </xsl:template> - <!-- Header --> - <xsl:template match="header"> - </xsl:template> - - <!-- Section/Title --> - <xsl:template match="section/title"> - </xsl:template> - - <xsl:template match="pagetext"> - </xsl:template> + <xsl:template match="header"/> + + <!-- Section/Title --> + <xsl:template match="section/title"/> + <xsl:template match="pagetext"/> - <!-- Chapter/Section --> + <!-- Chapter/Section, subsection level 1--> <xsl:template match="chapter/section"> <xsl:param name="chapnum"/> <h3> + <xsl:for-each select="marker"> + <xsl:call-template name="marker-before-title"/> + </xsl:for-each> <a name="{generate-id(title)}"> <xsl:value-of select="$chapnum"/>.<xsl:number/>  <xsl:value-of select="title"/> @@ -831,11 +891,14 @@ </xsl:apply-templates> </xsl:template> - <!-- Subsections lvl 3 and ... --> + <!-- Subsections lvl 2 --> <xsl:template match="section/section"> <xsl:param name="chapnum"/> <xsl:param name="sectnum"/> <h4> + <xsl:for-each select="marker"> + <xsl:call-template name="marker-before-title"/> + </xsl:for-each> <!-- xsl:value-of select="$partnum"/>.<xsl:value-of select="$chapnum"/>.<xsl:value-of select="$sectnum"/>.<xsl:number/ --> <xsl:value-of select="title"/> </h4> @@ -844,10 +907,29 @@ </xsl:apply-templates> </xsl:template> + <!-- Subsections lvl 3 and ... --> + <xsl:template match="section/section/section"> + <xsl:param name="chapnum"/> + <xsl:param name="sectnum"/> + <h5> + <xsl:for-each select="marker"> + <xsl:call-template name="marker-before-title"/> + </xsl:for-each> + <!-- xsl:value-of select="$partnum"/>.<xsl:value-of select="$chapnum"/>.<xsl:value-of select="$sectnum"/>.<xsl:number/ --> + <xsl:value-of select="title"/> + </h5> + <xsl:apply-templates> + <xsl:with-param name="chapnum" select="$chapnum"/> + </xsl:apply-templates> + </xsl:template> + <!-- *ref/Section --> <xsl:template match="erlref/section|cref/section|comref/section|fileref/section|appref/section"> <xsl:param name="chapnum"/> <h3> + <xsl:for-each select="marker"> + <xsl:call-template name="marker-before-title"/> + </xsl:for-each> <a name="{generate-id(title)}"> <xsl:value-of select="title"/> </a> @@ -875,7 +957,6 @@ <!-- Lists --> - <xsl:template match="list"> <xsl:param name="chapnum"/> <ul> @@ -983,6 +1064,18 @@ </div> </xsl:template> + <!-- Quote --> + <xsl:template match="quote"> + <xsl:param name="chapnum"/> + <div class="quote"> + <p> + <xsl:apply-templates> + <xsl:with-param name="chapnum" select="$chapnum"/> + </xsl:apply-templates> + </p> + </div> + </xsl:template> + <!-- Paragraph --> <xsl:template match="p"> <p> @@ -991,10 +1084,6 @@ </xsl:template> <!-- Inline elements --> - <xsl:template match="b"> - <strong><xsl:apply-templates/></strong> - </xsl:template> - <xsl:template match="i"> <i><xsl:apply-templates/></i> </xsl:template> @@ -1011,6 +1100,10 @@ <strong><xsl:apply-templates/></strong> </xsl:template> + <xsl:template match="strong"> + <strong><xsl:apply-templates/></strong> + </xsl:template> + <!-- Code --> <xsl:template match="code"> <xsl:param name="chapnum"/> @@ -1097,11 +1190,11 @@ <xsl:param name="chapnum"/> <xsl:param name="fignum"/> - <em>Figure + <p><em>Figure <xsl:value-of select="$chapnum"/>.<xsl:value-of select="$fignum"/>:   <xsl:apply-templates/> - </em> + </em></p> </xsl:template> @@ -1288,9 +1381,7 @@ <xsl:with-param name="type">ref_man</xsl:with-param> </xsl:call-template--> - <xsl:document href="{$outdir}/index.html" method="html" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"> - <xsl:call-template name="pagelayout"/> </xsl:document> </xsl:template> @@ -1460,6 +1551,8 @@ <xsl:param name="cval"/> <xsl:for-each select="$entries"> + <!-- Sort on function name, so the index list in lefthand frame is ordered. --> + <xsl:sort select="erl:get_sort_field(.)" data-type="text" case-order="upper-first"/> <xsl:choose> <xsl:when test="ancestor::cref"> @@ -1855,6 +1948,7 @@ </xsl:choose> </xsl:template> + <!-- Used both in <datatype> and in <func>! --> <xsl:template name="name"> <xsl:variable name="tmpstring"> @@ -1911,7 +2005,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}"></a><span class="bold_code"><xsl:apply-templates/></span><br/> + </xsl:when> + <xsl:otherwise> + <a name="{$fname}-{$arity}"></a><span class="bold_code"><xsl:apply-templates/></span><br/> + </xsl:otherwise> + </xsl:choose> </xsl:when> <xsl:otherwise> <span class="bold_code"><xsl:value-of select="."/></span> @@ -1997,7 +2098,7 @@ </xsl:template> <xsl:template match="seealso"> - <xsl:call-template name="seealso"/> + <xsl:call-template name="seealso"/> </xsl:template> <xsl:template name="seealso"> @@ -2079,16 +2180,27 @@ </xsl:template> - <xsl:template match="url"> <span class="bold_code"><a href="{@href}"><xsl:apply-templates/></a></span> </xsl:template> - <xsl:template match="marker"> - <a name="{@id}"><xsl:apply-templates/></a> + <xsl:choose> + <xsl:when test="not(parent::section and following-sibling::title)"> + <a name="{@id}"><xsl:apply-templates/></a> + </xsl:when> + </xsl:choose> </xsl:template> + <xsl:template name="marker-before-title"> + <xsl:choose> + <xsl:when test="self::marker and parent::section and following-sibling::title"> + <a name="{@id}"><xsl:apply-templates/></a> + </xsl:when> + </xsl:choose> + </xsl:template> + + <xsl:template match="term"> <xsl:value-of select="@id"/> <!-- xsl:choose> @@ -2367,7 +2479,11 @@ <xsl:template name="nl"> <xsl:text> -</xsl:text> + </xsl:text> + </xsl:template> + + <xsl:template match="seealso//text()"> + <xsl:value-of select="normalize-space(.)"/> </xsl:template> </xsl:stylesheet> diff --git a/lib/erl_docgen/priv/xsl/db_html_params.xsl b/lib/erl_docgen/priv/xsl/db_html_params.xsl index 2949dbfef0..41ca26af21 100644 --- a/lib/erl_docgen/priv/xsl/db_html_params.xsl +++ b/lib/erl_docgen/priv/xsl/db_html_params.xsl @@ -3,7 +3,7 @@ # # %CopyrightBegin% # - # Copyright Ericsson AB 2009. All Rights Reserved. + # Copyright Ericsson AB 2009-2016. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/erl_docgen/priv/xsl/db_man.xsl b/lib/erl_docgen/priv/xsl/db_man.xsl index 5201465e42..03b6b0691d 100644 --- a/lib/erl_docgen/priv/xsl/db_man.xsl +++ b/lib/erl_docgen/priv/xsl/db_man.xsl @@ -3,7 +3,7 @@ # # %CopyrightBegin% # - # Copyright Ericsson AB 2009-2012. All Rights Reserved. + # Copyright Ericsson AB 2009-2016. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -589,12 +589,6 @@ </xsl:template> <!-- Inline elements --> - <xsl:template match="b"> - <xsl:text>\fB</xsl:text> - <xsl:apply-templates/> - <xsl:text>\fR\& </xsl:text> - </xsl:template> - <xsl:template match="i"> <xsl:text>\fI</xsl:text> <xsl:apply-templates/> @@ -622,6 +616,12 @@ <xsl:text>\fI</xsl:text> <xsl:apply-templates/><xsl:text>\fR\&</xsl:text> </xsl:template> + <xsl:template match="strong"> + <xsl:text>\fB</xsl:text> + <xsl:apply-templates/> + <xsl:text>\fR\& </xsl:text> + </xsl:template> + <xsl:template match="seealso"> <xsl:choose> <xsl:when test="ancestor::head"> diff --git a/lib/erl_docgen/priv/xsl/db_pdf.xsl b/lib/erl_docgen/priv/xsl/db_pdf.xsl index 37a2d55274..99263847fb 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf.xsl @@ -3,7 +3,7 @@ # # %CopyrightBegin% # - # Copyright Ericsson AB 2009-2013. All Rights Reserved. + # Copyright Ericsson AB 2009-2016. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -1171,6 +1171,16 @@ </fo:block> </xsl:template> + <!-- Quote --> + <xsl:template match="quote"> + <xsl:param name="chapnum"/> + <fo:block font-style="italic"> + <xsl:apply-templates> + <xsl:with-param name="chapnum" select="$chapnum"/> + </xsl:apply-templates> + </fo:block> + </xsl:template> + <!-- Paragraph --> <xsl:template match="p"> <fo:block xsl:use-attribute-sets="p"> @@ -1180,14 +1190,8 @@ <!-- Inline elements --> - <xsl:template match="b"> - <fo:inline font-weight="bold"> - <xsl:apply-templates/> - </fo:inline> - </xsl:template> - <xsl:template match="i"> - <fo:inline font-weight="italic"> + <fo:inline font-style="italic"> <xsl:apply-templates/> </fo:inline> </xsl:template> @@ -1203,7 +1207,13 @@ </xsl:template> <xsl:template match="em"> - <fo:inline font-style="italic"> + <fo:inline font-weight="bold"> + <xsl:apply-templates/> + </fo:inline> + </xsl:template> + + <xsl:template match="strong"> + <fo:inline font-weight="bold"> <xsl:apply-templates/> </fo:inline> </xsl:template> diff --git a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl index 61c8ff75aa..d9a150d2d9 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl @@ -3,7 +3,7 @@ # # %CopyrightBegin% # - # Copyright Ericsson AB 2009-2012. All Rights Reserved. + # Copyright Ericsson AB 2009-2016. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. |