diff options
Diffstat (limited to 'lib/erl_docgen/priv/xsl')
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_eix.xsl | 68 | ||||
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_html.xsl | 251 | ||||
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_man.xsl | 180 | ||||
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_pdf.xsl | 99 | ||||
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_pdf_params.xsl | 26 |
5 files changed, 465 insertions, 159 deletions
diff --git a/lib/erl_docgen/priv/xsl/db_eix.xsl b/lib/erl_docgen/priv/xsl/db_eix.xsl index 929272256a..970b85ccb9 100644 --- a/lib/erl_docgen/priv/xsl/db_eix.xsl +++ b/lib/erl_docgen/priv/xsl/db_eix.xsl @@ -137,7 +137,20 @@ <xsl:value-of select="substring-before(nametext, '(')"/> </xsl:when> <xsl:when test="ancestor::erlref"> - <xsl:value-of select="substring-before(., '(')"/> + <xsl:variable name="fname1"> + <xsl:value-of select="substring-before(., '(')"/> + </xsl:variable> + <xsl:variable name="fname2"> + <xsl:value-of select="substring-after($fname1, 'erlang:')"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($fname2) > 0"> + <xsl:value-of select="$fname2"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$fname1"/> + </xsl:otherwise> + </xsl:choose> </xsl:when> </xsl:choose> </xsl:variable> @@ -178,26 +191,63 @@ </xsl:template> <xsl:template name="remove-paren"> - <xsl:param name="string"/> - <xsl:variable name="bstring"> - <xsl:value-of select="substring-before($string, '(')"/> + <xsl:param name="string"/> + + <xsl:variable name="str1"> + <xsl:call-template name="remove-paren-1"> + <xsl:with-param name="string" select="$string"/> + <xsl:with-param name="start">(</xsl:with-param> + <xsl:with-param name="end">)</xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="str2"> + <xsl:call-template name="remove-paren-1"> + <xsl:with-param name="string" select="$str1"/> + <xsl:with-param name="start">{</xsl:with-param> + <xsl:with-param name="end">}</xsl:with-param> + </xsl:call-template> </xsl:variable> + + <xsl:variable name="str3"> + <xsl:call-template name="remove-paren-1"> + <xsl:with-param name="string" select="$str2"/> + <xsl:with-param name="start">[</xsl:with-param> + <xsl:with-param name="end">]</xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:value-of select="$str3"/> + + </xsl:template> + + + <xsl:template name="remove-paren-1"> + <xsl:param name="string"/> + <xsl:param name="start"/> + <xsl:param name="end"/> + + <xsl:variable name="tmp1"> + <xsl:value-of select="substring-before($string, $start)"/> + </xsl:variable> + <xsl:choose> - <xsl:when test="string-length($bstring) > 0"> - <xsl:variable name="astring"> - <xsl:value-of select="substring-after($string, ')')"/> + <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:variable> <xsl:variable name="retstring"> <xsl:call-template name="remove-paren"> - <xsl:with-param name="string" select="$astring"/> + <xsl:with-param name="string" select="$tmp2"/> </xsl:call-template> </xsl:variable> - <xsl:value-of select="concat($bstring, $retstring)"/> + <xsl:value-of select="concat(concat($tmp1, 'x'), $retstring)"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$string"/> </xsl:otherwise> </xsl:choose> + </xsl:template> <!-- default content handling --> diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl index 984655fc26..c2b58e48ec 100644 --- a/lib/erl_docgen/priv/xsl/db_html.xsl +++ b/lib/erl_docgen/priv/xsl/db_html.xsl @@ -2,20 +2,20 @@ <!-- # # %CopyrightBegin% - # - # Copyright Ericsson AB 2009. All Rights Reserved. - # + # + # Copyright Ericsson AB 2009-2010. 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 # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. - # + # # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. - # + # # %CopyrightEnd% --> @@ -40,6 +40,46 @@ <div id="container"> <script id="js" type="text/javascript" language="JavaScript" src="{$topdocdir}/js/flipmenu/flipmenu.js"/> <script id="js2" type="text/javascript" src="{$topdocdir}/js/erlresolvelinks.js"></script> + <script language="JavaScript" type="text/javascript"> + <xsl:text disable-output-escaping="yes"><![CDATA[ + <!-- + function getWinHeight() { + var myHeight = 0; + if( typeof( window.innerHeight ) == 'number' ) { + //Non-IE + myHeight = window.innerHeight; + } else if( document.documentElement && ( document.documentElement.clientWidth || + document.documentElement.clientHeight ) ) { + //IE 6+ in 'standards compliant mode' + myHeight = document.documentElement.clientHeight; + } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { + //IE 4 compatible + myHeight = document.body.clientHeight; + } + return myHeight; + } + + function setscrollpos() { + var objf=document.getElementById('loadscrollpos'); + document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2; + } + + function addEvent(obj, evType, fn){ + if (obj.addEventListener){ + obj.addEventListener(evType, fn, true); + return true; + } else if (obj.attachEvent){ + var r = obj.attachEvent("on"+evType, fn); + return r; + } else { + return false; + } + } + + addEvent(window, 'load', setscrollpos); + + //-->]]></xsl:text> + </script> <!-- Generate menu --> <xsl:call-template name="menu"> <xsl:with-param name="chapnum" select="$chapnum"/> @@ -543,7 +583,13 @@ <xsl:otherwise>false</xsl:otherwise> </xsl:choose> </xsl:variable> - <li title="{header/title}" expanded="{$expanded}"> + <xsl:variable name="loadscrollpos"> + <xsl:choose> + <xsl:when test="$chapnum = $curchapnum">loadscrollpos</xsl:when> + <xsl:otherwise>no</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <li id="{$loadscrollpos}" title="{header/title}" expanded="{$expanded}"> <xsl:value-of select="header/title"/> <ul> <li> @@ -731,12 +777,19 @@ </xsl:choose> </xsl:variable> + <xsl:variable name="loadscrollpos"> + <xsl:choose> + <xsl:when test="$curModule = $cval">loadscrollpos</xsl:when> + <xsl:otherwise>no</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="link_cval"><xsl:value-of select="translate($cval, '­', '')"/></xsl:variable> <xsl:choose> <xsl:when test="$genFuncMenu = 'true'"> - <li title="{$cval} " expanded="{$expanded}"> + <li id="{$loadscrollpos}" title="{$cval} " expanded="{$expanded}"> <xsl:value-of select="$cval"/> <ul> <li> @@ -788,58 +841,73 @@ <xsl:when test="string-length($fname) > 0"> <li title="{$fname}"> <a href="{$basename}.html#{$fname}"> - <xsl:value-of select="$fname"/>() - </a> - </li> - </xsl:when> - <xsl:otherwise> - <li title="{name/nametext}"> - <a href="{$basename}.html#{name/nametext}"> - <xsl:value-of select="nametext"/>() - </a> - </li> - </xsl:otherwise> - </xsl:choose> - </xsl:when> - - <xsl:when test="ancestor::erlref"> - - <xsl:variable name="tmpstring"> - <xsl:value-of select="substring-before(substring-after(., '('), '->')"/> - </xsl:variable> - - <xsl:variable name="ustring"> - <xsl:choose> - <xsl:when test="string-length($tmpstring) > 0"> - <xsl:call-template name="remove-paren"> - <xsl:with-param name="string" select="$tmpstring"/> - </xsl:call-template> + <xsl:value-of select="$fname"/>() + </a> + </li> </xsl:when> <xsl:otherwise> - <xsl:call-template name="remove-paren"> - <xsl:with-param name="string" select="substring-after(., '(')"/> - </xsl:call-template> + <li title="{name/nametext}"> + <a href="{$basename}.html#{name/nametext}"> + <xsl:value-of select="nametext"/>() + </a> + </li> </xsl:otherwise> - </xsl:choose> - </xsl:variable> - - <xsl:variable name="arity"> - <xsl:call-template name="calc-arity"> - <xsl:with-param name="string" select="substring-before($ustring, ')')"/> - <xsl:with-param name="no-of-pars" select="0"/> - </xsl:call-template> - </xsl:variable> - <xsl:variable name="fname"> - <xsl:value-of select="substring-before(., '(')"/> - </xsl:variable> - <li title="{$fname}-{$arity}"> - <a href="{$basename}.html#{$fname}-{$arity}"> - <xsl:value-of select="$fname"/>/<xsl:value-of select="$arity"/> - </a> - </li> - </xsl:when> - </xsl:choose> - + </xsl:choose> + </xsl:when> + + <xsl:when test="ancestor::erlref"> + + <xsl:variable name="tmpstring"> + <xsl:value-of select="substring-before(substring-after(., '('), '->')"/> + </xsl:variable> + + <xsl:variable name="ustring"> + <xsl:choose> + <xsl:when test="string-length($tmpstring) > 0"> + <xsl:call-template name="remove-paren"> + <xsl:with-param name="string" select="$tmpstring"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="remove-paren"> + <xsl:with-param name="string" select="substring-after(., '(')"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="arity"> + <xsl:call-template name="calc-arity"> + <xsl:with-param name="string" select="substring-before($ustring, ')')"/> + <xsl:with-param name="no-of-pars" select="0"/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="fname"> + <xsl:variable name="fname1"> + <xsl:value-of select="substring-before(., '(')"/> + </xsl:variable> + <xsl:variable name="fname2"> + <xsl:value-of select="substring-after($fname1, 'erlang:')"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($fname2) > 0"> + <xsl:value-of select="$fname2"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$fname1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <li title="{$fname}-{$arity}"> + <a href="{$basename}.html#{$fname}-{$arity}"> + <xsl:value-of select="$fname"/>/<xsl:value-of select="$arity"/> + </a> + </li> + </xsl:when> + </xsl:choose> + </xsl:for-each> </xsl:template> @@ -1065,6 +1133,7 @@ <!-- Funcs --> <xsl:template match="funcs"> + <xsl:param name="partnum"/> <h3> <xsl:text>EXPORTS</xsl:text> @@ -1121,11 +1190,26 @@ <a name="{substring-before(nametext, '(')}"><span class="bold_code"><xsl:value-of select="ret"/><xsl:text> </xsl:text><xsl:value-of select="nametext"/></span></a><br/> </xsl:when> <xsl:when test="ancestor::erlref"> - <a name="{substring-before(., '(')}-{$arity}"><span class="bold_code"><xsl:value-of select="."/></span></a><br/> + <xsl:variable name="fname"> + <xsl:variable name="fname1"> + <xsl:value-of select="substring-before(., '(')"/> + </xsl:variable> + <xsl:variable name="fname2"> + <xsl:value-of select="substring-after($fname1, 'erlang:')"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($fname2) > 0"> + <xsl:value-of select="$fname2"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$fname1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <a name="{$fname}-{$arity}"><span class="bold_code"><xsl:value-of select="."/></span></a><br/> </xsl:when> </xsl:choose> - </xsl:template> @@ -1167,6 +1251,7 @@ <!-- Desc --> <xsl:template match="desc"> + <xsl:param name="partnum"/> <div class="REFBODY"> <p> <xsl:apply-templates> @@ -1458,29 +1543,65 @@ </xsl:choose> </xsl:template> + <xsl:template name="remove-paren"> <xsl:param name="string"/> + + <xsl:variable name="str1"> + <xsl:call-template name="remove-paren-1"> + <xsl:with-param name="string" select="$string"/> + <xsl:with-param name="start">(</xsl:with-param> + <xsl:with-param name="end">)</xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="str2"> + <xsl:call-template name="remove-paren-1"> + <xsl:with-param name="string" select="$str1"/> + <xsl:with-param name="start">{</xsl:with-param> + <xsl:with-param name="end">}</xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="str3"> + <xsl:call-template name="remove-paren-1"> + <xsl:with-param name="string" select="$str2"/> + <xsl:with-param name="start">[</xsl:with-param> + <xsl:with-param name="end">]</xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:value-of select="$str3"/> + + </xsl:template> + + + <xsl:template name="remove-paren-1"> + <xsl:param name="string"/> + <xsl:param name="start"/> + <xsl:param name="end"/> - <xsl:variable name="bstring"> - <xsl:value-of select="substring-before($string, '(')"/> + <xsl:variable name="tmp1"> + <xsl:value-of select="substring-before($string, $start)"/> </xsl:variable> <xsl:choose> - <xsl:when test="string-length($bstring) > 0"> - <xsl:variable name="astring"> - <xsl:value-of select="substring-after($string, ')')"/> + <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:variable> <xsl:variable name="retstring"> <xsl:call-template name="remove-paren"> - <xsl:with-param name="string" select="$astring"/> + <xsl:with-param name="string" select="$tmp2"/> </xsl:call-template> </xsl:variable> - <xsl:value-of select="concat($bstring, $retstring)"/> + <xsl:value-of select="concat(concat($tmp1, 'x'), $retstring)"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$string"/> </xsl:otherwise> </xsl:choose> + </xsl:template> </xsl:stylesheet> diff --git a/lib/erl_docgen/priv/xsl/db_man.xsl b/lib/erl_docgen/priv/xsl/db_man.xsl index c759a77496..300d1ed362 100644 --- a/lib/erl_docgen/priv/xsl/db_man.xsl +++ b/lib/erl_docgen/priv/xsl/db_man.xsl @@ -2,20 +2,20 @@ <!-- # # %CopyrightBegin% - # - # Copyright Ericsson AB 2009. All Rights Reserved. - # + # + # Copyright Ericsson AB 2009-2010. 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 # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. - # + # # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. - # + # # %CopyrightEnd% --> @@ -37,14 +37,12 @@ <!-- *ref/Section --> <xsl:template match="erlref/section|comref/section|cref/section|fileref/section|appref/section"> - <xsl:text> .RE </xsl:text> <xsl:text> .SH "</xsl:text><xsl:value-of select="translate(title, 'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/><xsl:text>" </xsl:text> <xsl:apply-templates/> </xsl:template> <!-- *ref/Subsection --> - <xsl:template match="erlref/section/section|comref/section/section|cref/section/section|fileref/section/section|appref/section/section"> - <xsl:text> .RE </xsl:text> + <xsl:template match="section/section"> <xsl:text> .SS "</xsl:text><xsl:value-of select="title"/><xsl:text>" </xsl:text> <xsl:apply-templates/> </xsl:template> @@ -53,9 +51,9 @@ <!-- Lists --> <xsl:template match="list"> - <xsl:text> .RS 2 </xsl:text> + <xsl:text> .RS 2</xsl:text> <xsl:apply-templates/> - <xsl:text> .RE </xsl:text> + <xsl:text> .RE</xsl:text> </xsl:template> <xsl:template match="list/item"> @@ -65,72 +63,80 @@ <xsl:apply-templates/> </xsl:variable> <xsl:value-of select="normalize-space($content)"/> - <xsl:text> .br </xsl:text> - <xsl:text> .br </xsl:text> + <xsl:text> .LP </xsl:text> </xsl:template> <xsl:template match="taglist"> - <xsl:text> .RS 2 </xsl:text> - <xsl:apply-templates/> - <xsl:text> .RE </xsl:text> + <xsl:text> .RS 2</xsl:text> + <xsl:apply-templates select="tag|item"/> + <xsl:text> .RE</xsl:text> </xsl:template> <xsl:template match="taglist/tag"> - <xsl:text> .TP 4 </xsl:text> + <xsl:text> .TP 2 </xsl:text> <xsl:text>.B </xsl:text> - <xsl:apply-templates/> + <xsl:apply-templates/><xsl:text>: </xsl:text> </xsl:template> <xsl:template match="item/p"> <xsl:variable name="content"> <xsl:apply-templates/> </xsl:variable> - <xsl:value-of select="normalize-space($content)"/> - <xsl:text> .br </xsl:text> - <xsl:text> .br </xsl:text> + <xsl:choose> + <xsl:when test="position() = 1"> + <xsl:value-of select="normalize-space($content)"/> + </xsl:when> + <xsl:otherwise> + <xsl:text> .RS 2</xsl:text> + <xsl:text> .LP .LP </xsl:text> + <xsl:value-of select="normalize-space($content)"/> + <xsl:text> .RE</xsl:text> + </xsl:otherwise> + </xsl:choose> </xsl:template> - <xsl:template match="taglist/item"> - <xsl:text> </xsl:text> - <xsl:apply-templates/> + <xsl:choose> + <xsl:when test="child::p"> + <xsl:apply-templates/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="content"> + <xsl:apply-templates/> + </xsl:variable> + <xsl:value-of select="normalize-space($content)"/> + </xsl:otherwise> + </xsl:choose> </xsl:template> <!-- Note --> <xsl:template match="note"> - <xsl:text> .TP 4 .B Note: </xsl:text> + <xsl:text> .SS Note:</xsl:text> <xsl:apply-templates/> + <xsl:text> </xsl:text> </xsl:template> <!-- Warning --> <xsl:template match="warning"> - <xsl:text> .TP 4 .B Warning: </xsl:text> + <xsl:text> .SS Warning:</xsl:text> <xsl:apply-templates/> + <xsl:text> </xsl:text> </xsl:template> - <xsl:template match="warning/p|note/p"> - <xsl:variable name="content"> - <xsl:apply-templates/> - </xsl:variable> - <xsl:value-of select="normalize-space($content)"/> - <xsl:text> .LP </xsl:text> - </xsl:template> - - <!-- Paragraph --> <xsl:template match="p"> - <xsl:text> .LP </xsl:text> <xsl:variable name="content"> <xsl:apply-templates/> </xsl:variable> + <xsl:text> .LP </xsl:text> <xsl:value-of select="normalize-space($content)"/> </xsl:template> <!-- Inline elements --> <xsl:template match="b"> - <xsl:text> \fB</xsl:text> + <xsl:text>\fB</xsl:text> <xsl:apply-templates/> - <xsl:text>\fR\&</xsl:text> + <xsl:text>\fR\& </xsl:text> </xsl:template> <xsl:template match="br"> @@ -138,19 +144,20 @@ </xsl:template> <xsl:template match="c"> - <xsl:text> \fI</xsl:text><xsl:value-of select="text()"/><xsl:text>\fR\&</xsl:text> + <xsl:text>\fI</xsl:text><xsl:apply-templates/><xsl:text>\fR\&</xsl:text> </xsl:template> <xsl:template match="em"> - <xsl:text> \fI</xsl:text><xsl:value-of select="text()"/><xsl:text>\fR\&</xsl:text> + <xsl:text>\fI</xsl:text> <xsl:apply-templates/><xsl:text>\fR\&</xsl:text> </xsl:template> <xsl:template match="seealso"> - <xsl:text> \fB</xsl:text><xsl:apply-templates/><xsl:text>\fR\&</xsl:text> + <xsl:text>\fB</xsl:text><xsl:apply-templates/><xsl:text>\fR\&</xsl:text> </xsl:template> <!-- Code --> <xsl:template match="code"> + <xsl:text> .LP </xsl:text> <xsl:text> .nf </xsl:text> <xsl:apply-templates/> <xsl:text> .fi </xsl:text> @@ -158,6 +165,7 @@ <!-- Pre --> <xsl:template match="pre"> + <xsl:text> .LP </xsl:text> <xsl:text> .nf </xsl:text> <xsl:apply-templates/> <xsl:text> .fi </xsl:text> @@ -168,16 +176,7 @@ <xsl:template match="table"> </xsl:template> - <!--xsl:template match="row"> - <xsl:apply-templates/> - </xsl:template> - - <xsl:template match="cell"> - <xsl:apply-templates/> - </xsl:template --> - - - <!-- Image --> + <!-- Image --> <xsl:template match="image"> </xsl:template> @@ -192,7 +191,7 @@ <!-- Erlref --> <xsl:template match="/erlref"> <xsl:text>.TH </xsl:text><xsl:value-of select="module"/><xsl:text> 3 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "Ericsson AB" "Erlang Module Definition" </xsl:text> - <xsl:text>.SH MODULE </xsl:text> + <xsl:text>.SH NAME </xsl:text> <xsl:value-of select="module"/><xsl:text> \- </xsl:text><xsl:value-of select="modulesummary"/><xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:template> @@ -225,7 +224,7 @@ <xsl:template match="/appref"> <xsl:text>.TH </xsl:text><xsl:value-of select="app"/><xsl:text> 6 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "Ericsson AB" "Erlang Application Definition" </xsl:text> <xsl:text>.SH NAME </xsl:text> - <xsl:value-of select="file"/><xsl:text> \- </xsl:text><xsl:value-of select="filesummary"/><xsl:text> </xsl:text> + <xsl:value-of select="app"/><xsl:text> \- </xsl:text><xsl:value-of select="appsummary"/><xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:template> @@ -297,9 +296,80 @@ <!-- This tag is skipped for now. --> </xsl:template> - <!-- xsl:template match="p/text()"> - <xsl:value-of select="normalize-space()"/> - </xsl:template--> + + <!-- Authors --> + <xsl:template match="authors"> + <xsl:text> .SH AUTHORS</xsl:text> + <xsl:apply-templates/> + </xsl:template> + + <!-- Aname --> + <xsl:template match="authors/aname"> + <xsl:text> .LP </xsl:text> + <xsl:apply-templates/> + </xsl:template> + + <!-- Email --> + <xsl:template match="authors/email"> + <xsl:text> .I <</xsl:text> + <xsl:apply-templates/> + <xsl:text>></xsl:text> + </xsl:template> + + <!-- Replace ' by \&' ans . by \&. --> + <xsl:template match="text()"> + <!-- xsl:variable name="content"> + <xsl:choose> + <xsl:when test="ancestor::code or ancestor::c"> + <xsl:value-of select="."/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="normalize-space()"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable--> + + <xsl:variable name="rep1"> + <xsl:call-template name="replace-string"> + <xsl:with-param name="text" select="." /> + <xsl:with-param name="replace" select=""\"" /> + <xsl:with-param name="with" select=""\\"" /> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="rep2"> + <xsl:call-template name="replace-string"> + <xsl:with-param name="text" select="$rep1" /> + <xsl:with-param name="replace" select=""'"" /> + <xsl:with-param name="with" select=""\&'"" /> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="replace-string"> + <xsl:with-param name="text" select="$rep2" /> + <xsl:with-param name="replace" select=""."" /> + <xsl:with-param name="with" select=""\&."" /> + </xsl:call-template> + </xsl:template> + + <!-- Template replace-string is borrowed at http://www.dpawson.co.uk/xsl/sect2/replace.html --> + <xsl:template name="replace-string"> + <xsl:param name="text"/> + <xsl:param name="replace"/> + <xsl:param name="with"/> + <xsl:choose> + <xsl:when test="contains($text,$replace)"> + <xsl:value-of select="substring-before($text,$replace)"/> + <xsl:value-of select="$with"/> + <xsl:call-template name="replace-string"> + <xsl:with-param name="text" select="substring-after($text,$replace)"/> + <xsl:with-param name="replace" select="$replace"/> + <xsl:with-param name="with" select="$with"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> <xsl:template match="d/text()"> <xsl:value-of select="normalize-space()"/> diff --git a/lib/erl_docgen/priv/xsl/db_pdf.xsl b/lib/erl_docgen/priv/xsl/db_pdf.xsl index bef86277ea..e12b4d219a 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf.xsl @@ -2,20 +2,20 @@ <!-- # # %CopyrightBegin% - # - # Copyright Ericsson AB 2009. All Rights Reserved. - # + # + # Copyright Ericsson AB 2009-2010. 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 # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. - # + # # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. - # + # # %CopyrightEnd% --> @@ -229,7 +229,9 @@ <xsl:value-of select="$companyname"/> </fo:block> <fo:block xsl:use-attribute-sets="cover.inner.copyrightnotice"> - The contents of this file are subject to the Erlang Public License, + <xsl:value-of select="/book/header/legalnotice"/> + + <!-- 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 compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be @@ -241,6 +243,7 @@ under the License. The Initial Developer of the Original Code is +--> <xsl:value-of select="$companyname"/>. </fo:block> <fo:block xsl:use-attribute-sets="cover.inner.date"> @@ -382,7 +385,9 @@ <xsl:choose> <xsl:when test="ancestor::cref"> <fo:bookmark internal-destination="{generate-id(nametext)}" starting-state="hide"> - <xsl:variable name="fname"><xsl:value-of select="substring-before(nametext, '(')"/></xsl:variable> + <xsl:variable name="fname"> + <xsl:value-of select="substring-before(nametext, '(')"/> + </xsl:variable> <fo:bookmark-title> <xsl:choose> <xsl:when test="string-length($fname) > 0"> @@ -422,8 +427,26 @@ <xsl:with-param name="no-of-pars" select="0"/> </xsl:call-template> </xsl:variable> + + <xsl:variable name="fname"> + <xsl:variable name="fname1"> + <xsl:value-of select="substring-before(., '(')"/> + </xsl:variable> + <xsl:variable name="fname2"> + <xsl:value-of select="substring-after($fname1, 'erlang:')"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($fname2) > 0"> + <xsl:value-of select="$fname2"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$fname1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <fo:bookmark-title> - <xsl:value-of select="substring-before(., '(')"/>/<xsl:value-of select="$arity"/> + <xsl:value-of select="$fname"/>/<xsl:value-of select="$arity"/> </fo:bookmark-title> </fo:bookmark> </xsl:when> @@ -668,12 +691,12 @@ <xsl:number level="any" from="part" count="code"/> </xsl:variable> - <fo:block xsl:use-attribute-sets="code" margin-left="1.5em"> + <fo:block xsl:use-attribute-sets="code"> <xsl:apply-templates select="text()"/> </fo:block> <xsl:if test="@caption"> - <fo:block xsl:use-attribute-sets="caption" margin-left="1.5em"> + <fo:block xsl:use-attribute-sets="caption"> Code listing <xsl:value-of select="$partnum"/>.<xsl:value-of select="$codenum"/>:  <xsl:value-of select="@caption"/> </fo:block> @@ -687,12 +710,12 @@ <xsl:number level="any" from="part" count="code"/> </xsl:variable> - <fo:block xsl:use-attribute-sets="code" margin-left="1.5em"> + <fo:block xsl:use-attribute-sets="code"> <xsl:apply-templates/> </fo:block> <xsl:if test="@caption"> - <fo:block xsl:use-attribute-sets="caption" margin-left="1.5em"> + <fo:block xsl:use-attribute-sets="caption"> Code listing <xsl:value-of select="$partnum"/>.<xsl:value-of select="$codenum"/>:  <xsl:value-of select="@caption"/> </fo:block> @@ -862,7 +885,7 @@ <!-- Funcs --> <xsl:template match="funcs"> - + <xsl:param name="partnum"/> <fo:block xsl:use-attribute-sets="h3"> <xsl:text>Exports</xsl:text> </fo:block> @@ -958,6 +981,7 @@ <!-- Desc --> <xsl:template match="desc"> + <xsl:param name="partnum"/> <xsl:apply-templates> <xsl:with-param name="partnum" select="$partnum"/> @@ -1103,27 +1127,62 @@ <xsl:template name="remove-paren"> <xsl:param name="string"/> + + <xsl:variable name="str1"> + <xsl:call-template name="remove-paren-1"> + <xsl:with-param name="string" select="$string"/> + <xsl:with-param name="start">(</xsl:with-param> + <xsl:with-param name="end">)</xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="str2"> + <xsl:call-template name="remove-paren-1"> + <xsl:with-param name="string" select="$str1"/> + <xsl:with-param name="start">{</xsl:with-param> + <xsl:with-param name="end">}</xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="str3"> + <xsl:call-template name="remove-paren-1"> + <xsl:with-param name="string" select="$str2"/> + <xsl:with-param name="start">[</xsl:with-param> + <xsl:with-param name="end">]</xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:value-of select="$str3"/> + + </xsl:template> + + + <xsl:template name="remove-paren-1"> + <xsl:param name="string"/> + <xsl:param name="start"/> + <xsl:param name="end"/> - <xsl:variable name="bstring"> - <xsl:value-of select="substring-before($string, '(')"/> + <xsl:variable name="tmp1"> + <xsl:value-of select="substring-before($string, $start)"/> </xsl:variable> <xsl:choose> - <xsl:when test="string-length($bstring) > 0"> - <xsl:variable name="astring"> - <xsl:value-of select="substring-after($string, ')')"/> + <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:variable> <xsl:variable name="retstring"> <xsl:call-template name="remove-paren"> - <xsl:with-param name="string" select="$astring"/> + <xsl:with-param name="string" select="$tmp2"/> </xsl:call-template> </xsl:variable> - <xsl:value-of select="concat($bstring, $retstring)"/> + <xsl:value-of select="concat(concat($tmp1, 'x'), $retstring)"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$string"/> </xsl:otherwise> </xsl:choose> + </xsl:template> </xsl:stylesheet> diff --git a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl index e2e264b90a..7de20f2092 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl @@ -2,20 +2,20 @@ <!-- # # %CopyrightBegin% - # - # Copyright Ericsson AB 2009. All Rights Reserved. - # + # + # Copyright Ericsson AB 2009-2010. 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 # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. - # + # # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. - # + # # %CopyrightEnd% --> @@ -110,7 +110,7 @@ <xsl:attribute-set name="cover.inner.copyrightnotice"> <xsl:attribute name="font-size">0.9em</xsl:attribute> - <xsl:attribute name="font-weight">bold</xsl:attribute> + <!-- xsl:attribute name="font-weight">bold</xsl:attribute --> </xsl:attribute-set> <xsl:attribute-set name="cover.inner.date"> @@ -248,6 +248,8 @@ <xsl:attribute name="padding-after">1em</xsl:attribute> <xsl:attribute name="space-after">1em</xsl:attribute> <xsl:attribute name="space-before">2em</xsl:attribute> + <xsl:attribute name="margin-left">0.5em</xsl:attribute> + <xsl:attribute name="margin-right">0.5em</xsl:attribute> <xsl:attribute name="white-space-collapse">false</xsl:attribute> <xsl:attribute name="white-space-treatment">preserve</xsl:attribute> <xsl:attribute name="wrap-option">no-wrap</xsl:attribute> @@ -266,8 +268,10 @@ <xsl:attribute name="text-align">justify</xsl:attribute> <xsl:attribute name="padding-before">1em</xsl:attribute> <xsl:attribute name="padding-after">0.3em</xsl:attribute> - <xsl:attribute name="padding-left">1em</xsl:attribute> - <xsl:attribute name="padding-right">1em</xsl:attribute> + <xsl:attribute name="padding-left">0.5em</xsl:attribute> + <xsl:attribute name="padding-right">0.5em</xsl:attribute> + <xsl:attribute name="margin-left">0.5em</xsl:attribute> + <xsl:attribute name="margin-right">0.5em</xsl:attribute> <xsl:attribute name="keep-together.within-page">always</xsl:attribute> </xsl:attribute-set> @@ -278,8 +282,10 @@ <xsl:attribute name="text-align">justify</xsl:attribute> <xsl:attribute name="padding-before">1em</xsl:attribute> <xsl:attribute name="padding-after">0.3em</xsl:attribute> - <xsl:attribute name="padding-left">1em</xsl:attribute> - <xsl:attribute name="padding-right">1em</xsl:attribute> + <xsl:attribute name="padding-left">0.5em</xsl:attribute> + <xsl:attribute name="padding-right">0.5em</xsl:attribute> + <xsl:attribute name="margin-left">0.5em</xsl:attribute> + <xsl:attribute name="margin-right">0.5em</xsl:attribute> <xsl:attribute name="keep-together.within-page">always</xsl:attribute> </xsl:attribute-set> |