diff options
Diffstat (limited to 'lib/erl_docgen/priv/xsl/db_man.xsl')
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_man.xsl | 242 |
1 files changed, 157 insertions, 85 deletions
diff --git a/lib/erl_docgen/priv/xsl/db_man.xsl b/lib/erl_docgen/priv/xsl/db_man.xsl index c759a77496..a9a2781a8a 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,84 +51,76 @@ <!-- 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"> <xsl:text> .TP 2 </xsl:text> <xsl:text>* </xsl:text> - <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:apply-templates/> + <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="taglist/item"> + <xsl:apply-templates/> </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:template> - - - <xsl:template match="taglist/item"> - <xsl:text> </xsl:text> - <xsl:apply-templates/> + <xsl:choose> + <xsl:when test="position() = 1"> + <xsl:value-of select="$content"/> + </xsl:when> + <xsl:otherwise> + <xsl:text> .RS 2</xsl:text> + <xsl:text> .LP .LP </xsl:text> + <xsl:value-of select="$content"/> + <xsl:text> .RE</xsl:text> + </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:value-of select="normalize-space($content)"/> + <xsl:apply-templates/> </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 +128,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 +149,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 +160,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> @@ -191,42 +174,72 @@ <!-- 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:value-of select="module"/><xsl:text> \- </xsl:text><xsl:value-of select="modulesummary"/><xsl:text> </xsl:text> - <xsl:apply-templates/> + <xsl:variable name="companyname"> + <xsl:choose> + <xsl:when test="$company = ''"><xsl:value-of select="header/holder"/></xsl:when> + <xsl:otherwise><xsl:value-of select="$company"/></xsl:otherwise> + </xsl:choose> + </xsl:variable> + <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>" "</xsl:text><xsl:value-of select="$companyname"/><xsl:text>" "Erlang Module Definition" </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> <!-- Comref --> <xsl:template match="/comref"> - <xsl:text>.TH </xsl:text><xsl:value-of select="com"/><xsl:text> 1 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "Ericsson AB" "User Commands" </xsl:text> - <xsl:text>.SH NAME </xsl:text> - <xsl:value-of select="com"/><xsl:text> \- </xsl:text><xsl:value-of select="comsummary"/><xsl:text> </xsl:text> - <xsl:apply-templates/> + <xsl:variable name="companyname"> + <xsl:choose> + <xsl:when test="$company = ''"><xsl:value-of select="header/holder"/></xsl:when> + <xsl:otherwise><xsl:value-of select="$company"/></xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:text>.TH </xsl:text><xsl:value-of select="com"/><xsl:text> 1 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "</xsl:text><xsl:value-of select="$companyname"/><xsl:text>" "User Commands" </xsl:text> + <xsl:text>.SH NAME </xsl:text> + <xsl:value-of select="com"/><xsl:text> \- </xsl:text><xsl:value-of select="comsummary"/><xsl:text> </xsl:text> + <xsl:apply-templates/> </xsl:template> <!-- Cref --> <xsl:template match="/cref"> - <xsl:text>.TH </xsl:text><xsl:value-of select="lib"/><xsl:text> 3 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "Ericsson AB" "C Library Functions" </xsl:text> - <xsl:text>.SH NAME </xsl:text> - <xsl:value-of select="lib"/><xsl:text> \- </xsl:text><xsl:value-of select="libsummary"/><xsl:text> </xsl:text> - <xsl:apply-templates/> + <xsl:variable name="companyname"> + <xsl:choose> + <xsl:when test="$company = ''"><xsl:value-of select="header/holder"/></xsl:when> + <xsl:otherwise><xsl:value-of select="$company"/></xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:text>.TH </xsl:text><xsl:value-of select="lib"/><xsl:text> 3 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "</xsl:text><xsl:value-of select="$companyname"/><xsl:text>" "C Library Functions" </xsl:text> + <xsl:text>.SH NAME </xsl:text> + <xsl:value-of select="lib"/><xsl:text> \- </xsl:text><xsl:value-of select="libsummary"/><xsl:text> </xsl:text> + <xsl:apply-templates/> </xsl:template> <!-- Fileref --> <xsl:template match="/fileref"> - <xsl:text>.TH </xsl:text><xsl:value-of select="file"/><xsl:text> 4 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "Ericsson AB" "Files" </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:apply-templates/> + <xsl:variable name="companyname"> + <xsl:choose> + <xsl:when test="$company = ''"><xsl:value-of select="header/holder"/></xsl:when> + <xsl:otherwise><xsl:value-of select="$company"/></xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:text>.TH </xsl:text><xsl:value-of select="file"/><xsl:text> 5 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "</xsl:text><xsl:value-of select="$companyname"/><xsl:text>" "Files" </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:apply-templates/> </xsl:template> <!-- Appref --> <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:apply-templates/> + <xsl:variable name="companyname"> + <xsl:choose> + <xsl:when test="$company = ''"><xsl:value-of select="header/holder"/></xsl:when> + <xsl:otherwise><xsl:value-of select="$company"/></xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:text>.TH </xsl:text><xsl:value-of select="app"/><xsl:text> 7 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "</xsl:text><xsl:value-of select="$companyname"/><xsl:text>" "Erlang Application Definition" </xsl:text> + <xsl:text>.SH NAME </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> <!-- Module|Com|Lib|File|App--> @@ -297,12 +310,71 @@ <!-- 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> - <xsl:template match="d/text()"> - <xsl:value-of select="normalize-space()"/> + <!-- 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="startstring"> + <xsl:value-of select="normalize-space()"/><xsl:text> </xsl:text> + </xsl:variable> + <xsl:variable name="rep1"> + <xsl:call-template name="replace-string"> + <xsl:with-param name="text" select="$startstring" /> + <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:stylesheet> |