6
# Copyright Ericsson AB 2009. All Rights Reserved.
6
# Copyright Ericsson AB 2009-2010. All Rights Reserved.
8
8
# The contents of this file are subject to the Erlang Public License,
9
9
# Version 1.1, (the "License"); you may not use this file except in
10
10
# compliance with the License. You should have received a copy of the
11
11
# Erlang Public License along with this software. If not, it can be
12
12
# retrieved online at http://www.erlang.org/.
14
14
# Software distributed under the License is distributed on an "AS IS"
15
15
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
16
16
# the License for the specific language governing rights and limitations
17
17
# under the License.
55
53
<xsl:template match="list">
56
<xsl:text> .RS 2 </xsl:text>
54
<xsl:text> .RS 2</xsl:text>
57
55
<xsl:apply-templates/>
58
<xsl:text> .RE </xsl:text>
56
<xsl:text> .RE</xsl:text>
61
59
<xsl:template match="list/item">
62
60
<xsl:text> .TP 2 </xsl:text>
63
61
<xsl:text>* </xsl:text>
64
<xsl:variable name="content">
65
<xsl:apply-templates/>
67
<xsl:value-of select="normalize-space($content)"/>
68
<xsl:text> .br </xsl:text>
69
<xsl:text> .br </xsl:text>
62
<xsl:apply-templates/>
63
<xsl:text> .LP </xsl:text>
72
66
<xsl:template match="taglist">
73
<xsl:text> .RS 2 </xsl:text>
74
<xsl:apply-templates/>
75
<xsl:text> .RE </xsl:text>
67
<xsl:text> .RS 2</xsl:text>
68
<xsl:apply-templates select="tag|item"/>
69
<xsl:text> .RE</xsl:text>
78
72
<xsl:template match="taglist/tag">
79
<xsl:text> .TP 4 </xsl:text>
73
<xsl:text> .TP 2 </xsl:text>
80
74
<xsl:text>.B </xsl:text>
81
<xsl:apply-templates/>
75
<xsl:apply-templates/><xsl:text>: </xsl:text>
78
<xsl:template match="taglist/item">
79
<xsl:apply-templates/>
84
82
<xsl:template match="item/p">
85
83
<xsl:variable name="content">
86
84
<xsl:apply-templates/>
88
<xsl:value-of select="normalize-space($content)"/>
89
<xsl:text> .br </xsl:text>
90
<xsl:text> .br </xsl:text>
94
<xsl:template match="taglist/item">
95
<xsl:text> </xsl:text>
96
<xsl:apply-templates/>
87
<xsl:when test="position() = 1">
88
<xsl:value-of select="$content"/>
91
<xsl:text> .RS 2</xsl:text>
92
<xsl:text> .LP .LP </xsl:text>
93
<xsl:value-of select="$content"/>
94
<xsl:text> .RE</xsl:text>
100
100
<xsl:template match="note">
101
<xsl:text> .TP 4 .B Note: </xsl:text>
101
<xsl:text> .SS Note:</xsl:text>
102
102
<xsl:apply-templates/>
103
<xsl:text> </xsl:text>
106
107
<xsl:template match="warning">
107
<xsl:text> .TP 4 .B Warning: </xsl:text>
108
<xsl:text> .SS Warning:</xsl:text>
108
109
<xsl:apply-templates/>
111
<xsl:template match="warning/p|note/p">
112
<xsl:variable name="content">
113
<xsl:apply-templates/>
115
<xsl:value-of select="normalize-space($content)"/>
116
<xsl:text> .LP </xsl:text>
110
<xsl:text> </xsl:text>
120
113
<!-- Paragraph -->
121
114
<xsl:template match="p">
122
115
<xsl:text> .LP </xsl:text>
123
<xsl:variable name="content">
124
<xsl:apply-templates/>
126
<xsl:value-of select="normalize-space($content)"/>
116
<xsl:apply-templates/>
129
119
<!-- Inline elements -->
130
120
<xsl:template match="b">
131
<xsl:text> \fB</xsl:text>
121
<xsl:text>\fB</xsl:text>
132
122
<xsl:apply-templates/>
133
<xsl:text>\fR\&</xsl:text>
123
<xsl:text>\fR\& </xsl:text>
136
126
<xsl:template match="br">
140
130
<xsl:template match="c">
141
<xsl:text> \fI</xsl:text><xsl:value-of select="text()"/><xsl:text>\fR\&</xsl:text>
131
<xsl:text>\fI</xsl:text><xsl:apply-templates/><xsl:text>\fR\&</xsl:text>
144
134
<xsl:template match="em">
145
<xsl:text> \fI</xsl:text><xsl:value-of select="text()"/><xsl:text>\fR\&</xsl:text>
135
<xsl:text>\fI</xsl:text> <xsl:apply-templates/><xsl:text>\fR\&</xsl:text>
148
138
<xsl:template match="seealso">
149
<xsl:text> \fB</xsl:text><xsl:apply-templates/><xsl:text>\fR\&</xsl:text>
139
<xsl:text>\fB</xsl:text><xsl:apply-templates/><xsl:text>\fR\&</xsl:text>
153
143
<xsl:template match="code">
144
<xsl:text> .LP </xsl:text>
154
145
<xsl:text> .nf </xsl:text>
155
146
<xsl:apply-templates/>
156
147
<xsl:text> .fi </xsl:text>
193
176
<xsl:template match="/erlref">
194
<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>
195
<xsl:text>.SH MODULE </xsl:text>
196
<xsl:value-of select="module"/><xsl:text> \- </xsl:text><xsl:value-of select="modulesummary"/><xsl:text> </xsl:text>
197
<xsl:apply-templates/>
177
<xsl:variable name="companyname">
179
<!-- Workaround until all of OTP's .../holder contents are correct. -->
180
<xsl:when test="starts-with(header/copyright/holder,'Ericsson AB')"><xsl:text>Ericsson AB</xsl:text></xsl:when>
181
<xsl:otherwise><xsl:value-of select="header/copyright/holder"/></xsl:otherwise>
185
<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>
186
<xsl:text>.SH NAME </xsl:text>
187
<xsl:value-of select="module"/><xsl:text> \- </xsl:text><xsl:value-of select="modulesummary"/><xsl:text> </xsl:text>
188
<xsl:apply-templates/>
201
192
<xsl:template match="/comref">
202
<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>
203
<xsl:text>.SH NAME </xsl:text>
204
<xsl:value-of select="com"/><xsl:text> \- </xsl:text><xsl:value-of select="comsummary"/><xsl:text> </xsl:text>
205
<xsl:apply-templates/>
193
<xsl:variable name="companyname">
195
<!-- Workaround until all of OTP's .../holder contents are correct. -->
196
<xsl:when test="starts-with(header/copyright/holder,'Ericsson AB')"><xsl:text>Ericsson AB</xsl:text></xsl:when>
197
<xsl:otherwise><xsl:value-of select="header/copyright/holder"/></xsl:otherwise>
200
<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>
201
<xsl:text>.SH NAME </xsl:text>
202
<xsl:value-of select="com"/><xsl:text> \- </xsl:text><xsl:value-of select="comsummary"/><xsl:text> </xsl:text>
203
<xsl:apply-templates/>
209
207
<xsl:template match="/cref">
210
<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>
211
<xsl:text>.SH NAME </xsl:text>
212
<xsl:value-of select="lib"/><xsl:text> \- </xsl:text><xsl:value-of select="libsummary"/><xsl:text> </xsl:text>
213
<xsl:apply-templates/>
208
<xsl:variable name="companyname">
210
<!-- Workaround until all of OTP's .../holder contents are correct. -->
211
<xsl:when test="starts-with(header/copyright/holder,'Ericsson AB')"><xsl:text>Ericsson AB</xsl:text></xsl:when>
212
<xsl:otherwise><xsl:value-of select="header/copyright/holder"/></xsl:otherwise>
215
<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>
216
<xsl:text>.SH NAME </xsl:text>
217
<xsl:value-of select="lib"/><xsl:text> \- </xsl:text><xsl:value-of select="libsummary"/><xsl:text> </xsl:text>
218
<xsl:apply-templates/>
217
222
<xsl:template match="/fileref">
218
<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>
219
<xsl:text>.SH NAME </xsl:text>
220
<xsl:value-of select="file"/><xsl:text> \- </xsl:text><xsl:value-of select="filesummary"/><xsl:text> </xsl:text>
221
<xsl:apply-templates/>
223
<xsl:variable name="companyname">
225
<!-- Workaround until all of OTP's .../holder contents are correct. -->
226
<xsl:when test="starts-with(header/copyright/holder,'Ericsson AB')"><xsl:text>Ericsson AB</xsl:text></xsl:when>
227
<xsl:otherwise><xsl:value-of select="header/copyright/holder"/></xsl:otherwise>
230
<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>
231
<xsl:text>.SH NAME </xsl:text>
232
<xsl:value-of select="file"/><xsl:text> \- </xsl:text><xsl:value-of select="filesummary"/><xsl:text> </xsl:text>
233
<xsl:apply-templates/>
225
237
<xsl:template match="/appref">
226
<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>
227
<xsl:text>.SH NAME </xsl:text>
228
<xsl:value-of select="file"/><xsl:text> \- </xsl:text><xsl:value-of select="filesummary"/><xsl:text> </xsl:text>
229
<xsl:apply-templates/>
238
<xsl:variable name="companyname">
240
<!-- Workaround until all of OTP's .../holder contents are correct. -->
241
<xsl:when test="starts-with(header/copyright/holder,'Ericsson AB')"><xsl:text>Ericsson AB</xsl:text></xsl:when>
242
<xsl:otherwise><xsl:value-of select="header/copyright/holder"/></xsl:otherwise>
245
<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>
246
<xsl:text>.SH NAME </xsl:text>
247
<xsl:value-of select="app"/><xsl:text> \- </xsl:text><xsl:value-of select="appsummary"/><xsl:text> </xsl:text>
248
<xsl:apply-templates/>
232
251
<!-- Module|Com|Lib|File|App-->
297
316
<!-- This tag is skipped for now. -->
300
<!-- xsl:template match="p/text()">
301
<xsl:value-of select="normalize-space()"/>
304
<xsl:template match="d/text()">
305
<xsl:value-of select="normalize-space()"/>
321
<xsl:template match="authors">
322
<xsl:text> .SH AUTHORS</xsl:text>
323
<xsl:apply-templates/>
327
<xsl:template match="authors/aname">
328
<xsl:text> .LP </xsl:text>
329
<xsl:apply-templates/>
333
<xsl:template match="authors/email">
334
<xsl:text> .I <</xsl:text>
335
<xsl:apply-templates/>
336
<xsl:text>></xsl:text>
339
<!-- Replace ' by \&' ans . by \&. -->
340
<xsl:template match="text()">
341
<xsl:variable name="startstring">
342
<xsl:value-of select="normalize-space()"/><xsl:text> </xsl:text>
344
<xsl:variable name="rep1">
345
<xsl:call-template name="replace-string">
346
<xsl:with-param name="text" select="$startstring" />
347
<xsl:with-param name="replace" select=""\"" />
348
<xsl:with-param name="with" select=""\\"" />
351
<xsl:variable name="rep2">
352
<xsl:call-template name="replace-string">
353
<xsl:with-param name="text" select="$rep1" />
354
<xsl:with-param name="replace" select=""'"" />
355
<xsl:with-param name="with" select=""\&'"" />
358
<xsl:call-template name="replace-string">
359
<xsl:with-param name="text" select="$rep2" />
360
<xsl:with-param name="replace" select=""."" />
361
<xsl:with-param name="with" select=""\&."" />
365
<!-- Template replace-string is borrowed at http://www.dpawson.co.uk/xsl/sect2/replace.html -->
366
<xsl:template name="replace-string">
367
<xsl:param name="text"/>
368
<xsl:param name="replace"/>
369
<xsl:param name="with"/>
371
<xsl:when test="contains($text,$replace)">
372
<xsl:value-of select="substring-before($text,$replace)"/>
373
<xsl:value-of select="$with"/>
374
<xsl:call-template name="replace-string">
375
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
376
<xsl:with-param name="replace" select="$replace"/>
377
<xsl:with-param name="with" select="$with"/>
381
<xsl:value-of select="$text"/>
308
386
</xsl:stylesheet>