Debian Codegraph @

xslt/docbook/html/db2html-block.xsl

raw
1 <?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
2 <!--
3 This program is free software; you can redistribute it and/or modify it under
4 the terms of the GNU Lesser General Public License as published by the Free
5 Software Foundation; either version 2 of the License, or (at your option) any
6 later version.
7
8 This program is distributed in the hope that it will be useful, but WITHOUT
9 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 details.
12
13 You should have received a copy of the GNU Lesser General Public License
14 along with this program; see the file COPYING.LGPL. If not, see <http://www.gnu.org/licenses/>.
15 -->
16
17 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18 xmlns:db="http://docbook.org/ns/docbook"
19 xmlns:msg="http://projects.gnome.org/yelp/gettext/"
20 xmlns:set="http://exslt.org/sets"
21 xmlns="http://www.w3.org/1999/xhtml"
22 exclude-result-prefixes="db msg set"
23 version="1.0">
24
25 <!--!!==========================================================================
26 DocBook to HTML - Block Elements
27 @revision[version=3.4 date=2011-11-12 status=final]
28
29 This stylesheet handles most simple block-level elements, turning them into
30 the appropriate HTML tags. It does not handle tables, lists, and various other
31 complex block-level elements.
32 -->
33
34
35 <!--**==========================================================================
36 db2html.block
37 Output an HTML `div` element for a block-level element.
38 @revision[version=3.10 date=2013-08-09 status=final]
39
40 [xsl:params]
41 $node: The block-level element to render.
42 $class: The value of the HTML `class` attribute.
43
44 This template creates an HTML `div` element for the given DocBook element.
45 It passes the $class parameter to {html.class.attr}.
46 If the $class parameter is not provided, it uses the local name of $node.
47
48 This template handles conditional processing.
49 -->
50 <xsl:template name="db2html.block">
51 <xsl:param name="node" select="."/>
52 <xsl:param name="class" select="local-name($node)"/>
53 <xsl:variable name="if">
54 <xsl:call-template name="db.profile.test">
55 <xsl:with-param name="node" select="$node"/>
56 </xsl:call-template>
57 </xsl:variable>
58 <xsl:if test="$if != ''">
59 <div>
60 <xsl:call-template name="html.class.attr">
61 <xsl:with-param name="node" select="$node"/>
62 <xsl:with-param name="class" select="$class"/>
63 </xsl:call-template>
64 <xsl:call-template name="html.lang.attrs">
65 <xsl:with-param name="node" select="$node"/>
66 </xsl:call-template>
67 <xsl:call-template name="db2html.anchor">
68 <xsl:with-param name="node" select="$node"/>
69 </xsl:call-template>
70 <xsl:apply-templates select="$node/node()"/>
71 </div>
72 </xsl:if>
73 </xsl:template>
74
75
76 <!--**==========================================================================
77 db2html.block.formal
78 Output HTML for a block-level element with an optional title and caption.
79 @revision[version=3.10 date=2013-08-09 status=final]
80
81 [xsl:params]
82 $node: The block-level element to render.
83 $class: The value of the HTML `class` attribute.
84 $title: An element to use for the title.
85 $caption: An element to use for the caption.
86 $titleattr: An optional value for the HTML `title` attribute.
87 $icon: An icon for the block, as a copyable node set.
88
89 This template outputs HTML for a formal DocBook element, one that can have
90 a title or caption. It passes the $class parameter to {html.class.attr}.
91 If the $class parameter is not provided, it uses the local name of $node.
92 Even if $title and $caption are both empty, this template still outputs
93 the extra wrapper elements for formal elements. If $titleattr is provided,
94 it is used for the value of the HTML `title` attribute on the outermost
95 `div` element.
96
97 This template handles conditional processing.
98 -->
99 <xsl:template name="db2html.block.formal">
100 <xsl:param name="node" select="."/>
101 <xsl:param name="class" select="local-name($node)"/>
102 <xsl:param name="title" select="$node/title | $node/blockinfo/title |
103 $node/db:title | $node/db:info/db:title"/>
104 <xsl:param name="caption" select="$node/caption | $node/db:caption"/>
105 <xsl:param name="titleattr" select="''"/>
106 <xsl:param name="icon"/>
107
108 <xsl:variable name="if">
109 <xsl:call-template name="db.profile.test">
110 <xsl:with-param name="node" select="$node"/>
111 </xsl:call-template>
112 </xsl:variable>
113 <xsl:if test="$if != ''">
114 <div>
115 <xsl:call-template name="html.class.attr">
116 <xsl:with-param name="node" select="$node"/>
117 <xsl:with-param name="class" select="$class"/>
118 </xsl:call-template>
119 <xsl:if test="$titleattr != ''">
120 <xsl:attribute name="title">
121 <xsl:value-of select="$titleattr"/>
122 </xsl:attribute>
123 </xsl:if>
124 <xsl:call-template name="html.lang.attrs">
125 <xsl:with-param name="node" select="$node"/>
126 </xsl:call-template>
127 <xsl:call-template name="db2html.anchor">
128 <xsl:with-param name="node" select="$node"/>
129 </xsl:call-template>
130 <xsl:copy-of select="$icon"/>
131 <div class="inner">
132 <xsl:if test="$node/self::figure or $node/self::db:figure">
133 <a href="#" class="figure-zoom">
134 <xsl:attribute name="data-zoom-in-title">
135 <xsl:call-template name="l10n.gettext">
136 <xsl:with-param name="msgid" select="'View images at normal size'"/>
137 </xsl:call-template>
138 </xsl:attribute>
139 <xsl:attribute name="data-zoom-out-title">
140 <xsl:call-template name="l10n.gettext">
141 <xsl:with-param name="msgid" select="'Scale images down'"/>
142 </xsl:call-template>
143 </xsl:attribute>
144 <xsl:call-template name="icons.svg.figure.zoom.in"/>
145 <xsl:call-template name="icons.svg.figure.zoom.out"/>
146 </a>
147 </xsl:if>
148 <xsl:if test="$title">
149 <xsl:call-template name="db2html.block.title">
150 <xsl:with-param name="node" select="$node"/>
151 <xsl:with-param name="title" select="$title"/>
152 </xsl:call-template>
153 </xsl:if>
154 <div class="region">
155 <div class="contents">
156 <xsl:apply-templates select="$node/node()[not(set:has-same-node(., $title | $caption))]"/>
157 </div>
158 <xsl:apply-templates select="$caption"/>
159 </div>
160 </div>
161 </div>
162 </xsl:if>
163 </xsl:template>
164
165
166 <!--**==========================================================================
167 db2html.block.title
168 Output a formal title for a block-level element.
169 @revision[version=3.4 date=2011-11-12 status=final]
170
171 [xsl:params]
172 $node: The block-level element being processed.
173 $title: The element containing the title.
174
175 This template formats the contents of $title as a title for a block-level
176 element. It is called by {db2html.block.formal}.
177 -->
178 <xsl:template name="db2html.block.title">
179 <xsl:param name="node" select="."/>
180 <xsl:param name="title" select="$node/title | $node/db:title"/>
181 <xsl:variable name="depth">
182 <xsl:call-template name="db.chunk.depth-in-chunk">
183 <xsl:with-param name="node" select="$node"/>
184 </xsl:call-template>
185 </xsl:variable>
186 <xsl:variable name="depth_">
187 <xsl:choose>
188 <xsl:when test="number($depth) &lt; 6">
189 <xsl:value-of select="number($depth) + 1"/>
190 </xsl:when>
191 <xsl:otherwise>
192 <xsl:value-of select="6"/>
193 </xsl:otherwise>
194 </xsl:choose>
195 </xsl:variable>
196 <div>
197 <xsl:call-template name="html.class.attr">
198 <xsl:with-param name="node" select="$title"/>
199 <xsl:with-param name="class" select="'title'"/>
200 </xsl:call-template>
201 <xsl:call-template name="html.lang.attrs">
202 <xsl:with-param name="node" select="$title"/>
203 </xsl:call-template>
204 <xsl:call-template name="db2html.anchor">
205 <xsl:with-param name="node" select="$title"/>
206 </xsl:call-template>
207 <xsl:element name="{concat('h', $depth_)}" namespace="{$html.namespace}">
208 <span class="title">
209 <xsl:apply-templates select="$title/node()"/>
210 </span>
211 </xsl:element>
212 </div>
213 </xsl:template>
214
215
216 <!--**==========================================================================
217 db2html.blockquote
218 Output an HTML `blockquote` element.
219 @revision[version=3.10 date=2013-08-09 status=final]
220
221 [xsl:params]
222 $node: The DocBook element ot render as a quote.
223
224 This template creates an HTML `blockquote` element for the given DocBook
225 element. It's used for the DocBook `blockquote` and `epigraph` elements.
226
227 This template handles conditional processing.
228 -->
229 <xsl:template name="db2html.blockquote">
230 <xsl:param name="node" select="."/>
231 <xsl:variable name="if">
232 <xsl:call-template name="db.profile.test">
233 <xsl:with-param name="node" select="$node"/>
234 </xsl:call-template>
235 </xsl:variable>
236 <xsl:if test="$if != ''">
237 <div>
238 <xsl:call-template name="html.class.attr">
239 <xsl:with-param name="node" select="$node"/>
240 <xsl:with-param name="class">
241 <xsl:text>quote </xsl:text>
242 <xsl:value-of select="local-name($node)"/>
243 </xsl:with-param>
244 </xsl:call-template>
245 <xsl:call-template name="html.lang.attrs">
246 <xsl:with-param name="node" select="$node"/>
247 </xsl:call-template>
248 <xsl:call-template name="db2html.anchor">
249 <xsl:with-param name="node" select="$node"/>
250 </xsl:call-template>
251 <div class="inner">
252 <xsl:apply-templates select="$node/title | $node/db:title |
253 $node/db:info/db:title"/>
254 <div class="region">
255 <blockquote class="{local-name($node)}">
256 <xsl:apply-templates select="$node/node()[not(self::title) and not(self::attribution) and
257 not(self::db:title) and not(self::db:attribution)]"/>
258 </blockquote>
259 <xsl:apply-templates select="$node/attribution | $node/db:attribution"/>
260 </div>
261 </div>
262 </div>
263 </xsl:if>
264 </xsl:template>
265
266
267 <!--**==========================================================================
268 db2html.para
269 Output an HTML `p` element for a block-level element.
270 @revision[version=3.10 date=2013-08-09 status=final]
271
272 [xsl:params]
273 $node: The block-level element to render.
274 $class: The value of the HTML `class` attribute.
275
276 This template creates an HTML `p` element for the given DocBook element.
277 It passes the $class parameter to {html.class.attr}.
278 If the $class parameter is not provided, it uses the local name of $node.
279
280 This template handles conditional processing.
281 -->
282 <xsl:template name="db2html.para">
283 <xsl:param name="node" select="."/>
284 <xsl:param name="class" select="local-name($node)"/>
285 <xsl:variable name="if">
286 <xsl:call-template name="db.profile.test">
287 <xsl:with-param name="node" select="$node"/>
288 </xsl:call-template>
289 </xsl:variable>
290 <xsl:if test="$if != ''">
291 <p>
292 <xsl:call-template name="html.class.attr">
293 <xsl:with-param name="node" select="$node"/>
294 <xsl:with-param name="class">
295 <xsl:value-of select="$class"/>
296 <xsl:if test="contains(concat(' ', $node/@role, ' '), ' lead ')">
297 <xsl:text> lead</xsl:text>
298 </xsl:if>
299 </xsl:with-param>
300 </xsl:call-template>
301 <xsl:call-template name="html.lang.attrs">
302 <xsl:with-param name="node" select="$node"/>
303 </xsl:call-template>
304 <xsl:call-template name="db2html.anchor">
305 <xsl:with-param name="node" select="$node"/>
306 </xsl:call-template>
307 <xsl:apply-templates select="$node/node()"/>
308 </p>
309 </xsl:if>
310 </xsl:template>
311
312
313 <!--**==========================================================================
314 db2html.pre
315 Output an HTML `pre` element for a block-level element.
316 @revision[version=3.12 date=2013-11-02 status=final]
317
318 [xsl:params]
319 $node: The block-level element to render.
320 $class: The value of the HTML `class` attribute.
321 $children: The child elements to process.
322
323 This template creates an HTML `pre` element for the given DocBook element.
324 It passes the $class parameter to {html.class.attr}.
325 If the $class parameter is not provided, it uses the local name of $node.
326
327 If $node has the `linenumbering` attribute set to `"numbered"`, then this
328 template will create line numbers for each line, using the {utils.linenumbering}
329 template.
330
331 By default, this template applies templates to all child nodes. Pass child
332 nodes in the $children parameter to override this behavior.
333
334 If {html.syntax.highlight} is `true`, this template automatically outputs
335 syntax highlighting support based on the `language` attribute of $node,
336 using {html.syntax.class} to determine the correct highlighter.
337
338 This template handles conditional processing.
339 -->
340 <xsl:template name="db2html.pre">
341 <xsl:param name="node" select="."/>
342 <xsl:param name="class" select="local-name($node)"/>
343 <xsl:param name="children" select="$node/node()"/>
344 <xsl:variable name="if">
345 <xsl:call-template name="db.profile.test">
346 <xsl:with-param name="node" select="$node"/>
347 </xsl:call-template>
348 </xsl:variable>
349 <xsl:if test="$if != ''">
350 <div>
351 <xsl:call-template name="html.class.attr">
352 <xsl:with-param name="node" select="$node"/>
353 <xsl:with-param name="class" select="$class"/>
354 </xsl:call-template>
355 <xsl:call-template name="html.lang.attrs">
356 <xsl:with-param name="node" select="$node"/>
357 </xsl:call-template>
358 <xsl:call-template name="db2html.anchor">
359 <xsl:with-param name="node" select="$node"/>
360 </xsl:call-template>
361 <xsl:if test="$node/@linenumbering = 'numbered'">
362 <xsl:variable name="number">
363 <xsl:choose>
364 <xsl:when test="@startinglinenumber">
365 <xsl:value-of select="@startinglinenumber"/>
366 </xsl:when>
367 <xsl:when test="@continuation">
368 <xsl:call-template name="db.linenumbering.start">
369 <xsl:with-param name="node" select="$node"/>
370 </xsl:call-template>
371 </xsl:when>
372 <xsl:otherwise>1</xsl:otherwise>
373 </xsl:choose>
374 </xsl:variable>
375 <pre class="numbered"><xsl:call-template name="utils.linenumbering">
376 <xsl:with-param name="node" select="$node"/>
377 <xsl:with-param name="number" select="$number"/>
378 </xsl:call-template></pre>
379 </xsl:if>
380 <pre class="contents"><code>
381 <xsl:if test="$html.syntax.highlight and $node/@language">
382 <xsl:attribute name="class">
383 <xsl:call-template name="html.syntax.class">
384 <xsl:with-param name="node" select="$node"/>
385 </xsl:call-template>
386 </xsl:attribute>
387 </xsl:if>
388 <!-- Strip off a leading newline -->
389 <xsl:if test="$children[1]/self::text()">
390 <xsl:choose>
391 <xsl:when test="starts-with($node/text()[1], '&#x000A;')">
392 <xsl:value-of select="substring-after($node/text()[1], '&#x000A;')"/>
393 </xsl:when>
394 <xsl:otherwise>
395 <xsl:value-of select="$node/text()[1]"/>
396 </xsl:otherwise>
397 </xsl:choose>
398 </xsl:if>
399 <xsl:apply-templates select="$children[not(position() = 1 and self::text())]"/>
400 </code></pre>
401 </div>
402 </xsl:if>
403 </xsl:template>
404
405
406 <!-- == Matched Templates == -->
407
408 <!-- = abstract = -->
409 <xsl:template match="abstract | db:abstract">
410 <xsl:call-template name="db2html.block"/>
411 </xsl:template>
412
413 <!-- = ackno = -->
414 <xsl:template match="ackno">
415 <xsl:call-template name="db2html.para"/>
416 </xsl:template>
417
418 <!-- = acknowledgements = -->
419 <xsl:template match="db:acknowledgements">
420 <xsl:call-template name="db2html.block"/>
421 </xsl:template>
422
423 <!-- = address = -->
424 <xsl:template match="address | db:address">
425 <xsl:call-template name="db2html.block"/>
426 </xsl:template>
427
428 <!-- = attribution = -->
429 <xsl:template match="attribution | db:attribution">
430 <xsl:call-template name="db2html.block">
431 <xsl:with-param name="class" select="'cite'"/>
432 </xsl:call-template>
433 </xsl:template>
434
435 <!-- = blockquote = -->
436 <xsl:template match="blockquote | db:blockquote">
437 <xsl:call-template name="db2html.blockquote"/>
438 </xsl:template>
439
440 <!-- == bridgehead = -->
441 <xsl:template match="bridgehead | db:bridgehead">
442 <xsl:param name="depth_in_chunk">
443 <xsl:call-template name="db.chunk.depth-in-chunk"/>
444 </xsl:param>
445 <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
446 <xsl:if test="$if != ''">
447 <xsl:variable name="render">
448 <xsl:choose>
449 <xsl:when test="starts-with(@renderas, 'sect')">
450 <xsl:value-of select="substring-after(@renderas, 'sect')"/>
451 </xsl:when>
452 <xsl:otherwise>
453 <xsl:text>6</xsl:text>
454 </xsl:otherwise>
455 </xsl:choose>
456 </xsl:variable>
457 <xsl:variable name="level" select="number($depth_in_chunk) + number($render) - 1"/>
458 <xsl:variable name="title_h">
459 <xsl:choose>
460 <xsl:when test="$depth_in_chunk &lt; 6">
461 <xsl:value-of select="concat('h', $level)"/>
462 </xsl:when>
463 <xsl:otherwise>
464 <xsl:text>h6</xsl:text>
465 </xsl:otherwise>
466 </xsl:choose>
467 </xsl:variable>
468 <div>
469 <xsl:call-template name="html.class.attr">
470 <xsl:with-param name="class" select="'hgroup bridgehead'"/>
471 </xsl:call-template>
472 <xsl:element name="{$title_h}" namespace="{$html.namespace}">
473 <xsl:apply-templates/>
474 </xsl:element>
475 </div>
476 </xsl:if>
477 </xsl:template>
478
479 <!-- = caption = -->
480 <xsl:template match="caption | db:caption">
481 <xsl:call-template name="db2html.block">
482 <xsl:with-param name="class" select="'desc'"/>
483 </xsl:call-template>
484 </xsl:template>
485
486 <!-- = caution = -->
487 <xsl:template match="caution | db:caution">
488 <xsl:call-template name="db2html.block.formal">
489 <xsl:with-param name="class">
490 <xsl:text>note note-</xsl:text>
491 <xsl:choose>
492 <xsl:when test="@role = 'danger'">
493 <xsl:text>danger</xsl:text>
494 </xsl:when>
495 <xsl:otherwise>
496 <xsl:text>caution</xsl:text>
497 </xsl:otherwise>
498 </xsl:choose>
499 </xsl:with-param>
500 <xsl:with-param name="titleattr">
501 <xsl:call-template name="l10n.gettext">
502 <xsl:with-param name="msgid">
503 <xsl:choose>
504 <xsl:when test="@role = 'danger'">
505 <xsl:text>Danger</xsl:text>
506 </xsl:when>
507 <xsl:otherwise>
508 <xsl:text>Caution</xsl:text>
509 </xsl:otherwise>
510 </xsl:choose>
511 </xsl:with-param>
512 </xsl:call-template>
513 </xsl:with-param>
514 <xsl:with-param name="icon">
515 <xsl:choose>
516 <xsl:when test="@role = 'danger'">
517 <xsl:call-template name="icons.svg.note.danger"/>
518 </xsl:when>
519 <xsl:otherwise>
520 <xsl:call-template name="icons.svg.note.caution"/>
521 </xsl:otherwise>
522 </xsl:choose>
523 </xsl:with-param>
524 </xsl:call-template>
525 </xsl:template>
526
527 <!-- = epigraph = -->
528 <xsl:template match="epigraph | db:epigraph">
529 <xsl:call-template name="db2html.blockquote"/>
530 </xsl:template>
531
532 <!-- = equation = -->
533 <xsl:template match="equation | db:equation">
534 <xsl:call-template name="db2html.block.formal"/>
535 </xsl:template>
536
537 <!-- = example = -->
538 <xsl:template match="example | db:example">
539 <xsl:call-template name="db2html.block.formal"/>
540 </xsl:template>
541
542 <!-- = figure = -->
543 <xsl:template match="figure | informalfigure | db:figure | db:informalfigure">
544 <xsl:call-template name="db2html.block.formal">
545 <xsl:with-param name="class" select="'figure'"/>
546 <!-- When a figure contains only a single mediaobject, it eats the caption -->
547 <xsl:with-param name="caption"
548 select="*[not(self::blockinfo) and not(self::title) and not(self::titleabbrev)]
549 [last() = 1]/self::mediaobject/caption |
550 *[not(self::db:info) and not(self::db:title) and not(self::db:titleabbrev)]
551 [last() = 1]/self::db:mediaobject/db:caption"/>
552 </xsl:call-template>
553 </xsl:template>
554
555 <!-- = formalpara = -->
556 <xsl:template match="formalpara | db:formalpara">
557 <xsl:call-template name="db2html.block.formal"/>
558 </xsl:template>
559
560 <!-- = highlights = -->
561 <xsl:template match="highlights">
562 <xsl:call-template name="db2html.block"/>
563 </xsl:template>
564
565 <!-- = important = -->
566 <xsl:template match="important | db:important">
567 <xsl:call-template name="db2html.block.formal">
568 <xsl:with-param name="class" select="'note note-important'"/>
569 <xsl:with-param name="titleattr">
570 <xsl:call-template name="l10n.gettext">
571 <xsl:with-param name="msgid" select="'Important'"/>
572 </xsl:call-template>
573 </xsl:with-param>
574 <xsl:with-param name="icon">
575 <xsl:call-template name="icons.svg.note.important"/>
576 </xsl:with-param>
577 </xsl:call-template>
578 </xsl:template>
579
580 <!-- = informalequation = -->
581 <xsl:template match="informalequation | db:informalequation">
582 <xsl:call-template name="db2html.block"/>
583 </xsl:template>
584
585 <!-- = informalexample = -->
586 <xsl:template match="informalexample | db:informalexample">
587 <xsl:call-template name="db2html.block">
588 <xsl:with-param name="class" select="'example informalexample'"/>
589 </xsl:call-template>
590 </xsl:template>
591
592 <!-- = literallayout = -->
593 <xsl:template match="literallayout | db:literallayout">
594 <xsl:choose>
595 <xsl:when test="@class = 'monospaced'">
596 <xsl:call-template name="db2html.pre"/>
597 </xsl:when>
598 <xsl:otherwise>
599 <xsl:call-template name="db2html.block"/>
600 </xsl:otherwise>
601 </xsl:choose>
602 </xsl:template>
603
604 <!-- = note = -->
605 <xsl:template match="note | db:note">
606 <xsl:call-template name="db2html.block.formal">
607 <xsl:with-param name="class">
608 <xsl:text>note</xsl:text>
609 <xsl:if test="@role = 'bug'">
610 <xsl:text> note-bug</xsl:text>
611 </xsl:if>
612 </xsl:with-param>
613 <xsl:with-param name="titleattr">
614 <xsl:choose>
615 <xsl:when test="@role = 'bug'">
616 <xsl:call-template name="l10n.gettext">
617 <xsl:with-param name="msgid" select="'Bug'"/>
618 </xsl:call-template>
619 </xsl:when>
620 <xsl:otherwise>
621 <xsl:call-template name="l10n.gettext">
622 <xsl:with-param name="msgid" select="'Note'"/>
623 </xsl:call-template>
624 </xsl:otherwise>
625 </xsl:choose>
626 </xsl:with-param>
627 <xsl:with-param name="icon">
628 <xsl:call-template name="icons.svg.note">
629 <xsl:with-param name="style" select="@role"/>
630 </xsl:call-template>
631 </xsl:with-param>
632 </xsl:call-template>
633 </xsl:template>
634
635 <!-- = para = -->
636 <xsl:template match="para | db:para">
637 <xsl:call-template name="db2html.para"/>
638 </xsl:template>
639
640 <!-- = programlisting = -->
641 <xsl:template match="programlisting | db:programlisting">
642 <xsl:call-template name="db2html.pre">
643 <xsl:with-param name="class" select="'code'"/>
644 </xsl:call-template>
645 </xsl:template>
646
647 <xsl:template mode="html.syntax.class.mode"
648 match="programlisting | db:programlisting | screen | db:screen">
649 <xsl:param name="language" select="translate(@language,
650 'ABCDEFGHIJKLMNOPQRSTUVWXYX',
651 'abcdefghijklmnopqrstuvwxyz')"/>
652 <!-- Try to accept the same values as xslthl -->
653 <xsl:choose>
654 <!-- ActionScript -->
655 <xsl:when test="$language = 'actionscript'">
656 <xsl:text>actionscript</xsl:text>
657 </xsl:when>
658 <!-- Apache -->
659 <xsl:when test="$language = 'apache'">
660 <xsl:text>apache</xsl:text>
661 </xsl:when>
662 <!-- AsciiDoc -->
663 <xsl:when test="$language = 'asciidoc' or $language = 'adoc'">
664 <xsl:text>asciidoc</xsl:text>
665 </xsl:when>
666 <!-- Awk -->
667 <xsl:when test="$language = 'awk'">
668 <xsl:text>awk</xsl:text>
669 </xsl:when>
670 <!-- Bash -->
671 <xsl:when test="$language = 'sh' or $language = 'bash' or
672 $language = 'csh' or $language = 'bourne'">
673 <xsl:text>bash</xsl:text>
674 </xsl:when>
675 <!-- C -->
676 <xsl:when test="$language = 'c'">
677 <xsl:text>c</xsl:text>
678 </xsl:when>
679 <!-- C# -->
680 <xsl:when test="$language = 'cs' or $language = 'csharp'">
681 <xsl:text>csharp</xsl:text>
682 </xsl:when>
683 <!-- C++ -->
684 <xsl:when test="$language = 'cpp' or $language = 'c++'">
685 <xsl:text>cpp</xsl:text>
686 </xsl:when>
687 <!-- Clojure -->
688 <xsl:when test="$language = 'clojure' or $language = 'clj'">
689 <xsl:text>clojure</xsl:text>
690 </xsl:when>
691 <!-- CMake -->
692 <xsl:when test="$language = 'cmake'">
693 <xsl:text>cmake</xsl:text>
694 </xsl:when>
695 <!-- CSS -->
696 <xsl:when test="$language = 'css' or $language = 'css21'">
697 <xsl:text>css</xsl:text>
698 </xsl:when>
699 <!-- D -->
700 <xsl:when test="$language = 'd'">
701 <xsl:text>d</xsl:text>
702 </xsl:when>
703 <!-- Diff -->
704 <xsl:when test="$language = 'diff' or $language = 'patch'">
705 <xsl:text>diff</xsl:text>
706 </xsl:when>
707 <!-- Django -->
708 <xsl:when test="$language = 'django'">
709 <xsl:text>django</xsl:text>
710 </xsl:when>
711 <!-- Dockerfile -->
712 <xsl:when test="$language = 'dockerfile'">
713 <xsl:text>dockerfile</xsl:text>
714 </xsl:when>
715 <!-- DOS -->
716 <xsl:when test="$language = 'dos'">
717 <xsl:text>dos</xsl:text>
718 </xsl:when>
719 <!-- Ducktype -->
720 <xsl:when test="$language = 'ducktype'">
721 <xsl:text>ducktype</xsl:text>
722 </xsl:when>
723 <!-- Embedded Ruby -->
724 <xsl:when test="$language = 'erb'">
725 <xsl:text>erb</xsl:text>
726 </xsl:when>
727 <!-- F# -->
728 <xsl:when test="$language = 'fsharp'">
729 <xsl:text>fsharp</xsl:text>
730 </xsl:when>
731 <!-- Go -->
732 <xsl:when test="$language = 'go'">
733 <xsl:text>go</xsl:text>
734 </xsl:when>
735 <!-- Haml -->
736 <xsl:when test="$language = 'haml'">
737 <xsl:text>haml</xsl:text>
738 </xsl:when>
739 <!-- Haskell -->
740 <xsl:when test="$language = 'haskell' or $language = 'hs'">
741 <xsl:text>hs</xsl:text>
742 </xsl:when>
743 <!-- HTML -->
744 <xsl:when test="$language = 'html' or $language = 'xhtml'">
745 <xsl:text>html</xsl:text>
746 </xsl:when>
747 <!-- HTTP -->
748 <xsl:when test="$language = 'http'">
749 <xsl:text>http</xsl:text>
750 </xsl:when>
751 <!-- INI -->
752 <xsl:when test="$language = 'ini'">
753 <xsl:text>ini</xsl:text>
754 </xsl:when>
755 <!-- Java -->
756 <xsl:when test="$language = 'java'">
757 <xsl:text>java</xsl:text>
758 </xsl:when>
759 <!-- Javascript -->
760 <xsl:when test="$language = 'js' or $language = 'javascript'">
761 <xsl:text>javascript</xsl:text>
762 </xsl:when>
763 <!-- JSON -->
764 <xsl:when test="$language = 'json'">
765 <xsl:text>json</xsl:text>
766 </xsl:when>
767 <!-- LISP -->
768 <xsl:when test="$language = 'lisp' or $language = 'el' or
769 $language = 'cl' or $language = 'lsp'">
770 <xsl:text>lisp</xsl:text>
771 </xsl:when>
772 <!-- Lua -->
773 <xsl:when test="$language = 'lua'">
774 <xsl:text>lua</xsl:text>
775 </xsl:when>
776 <!-- Makefile -->
777 <xsl:when test="$language = 'makefile' or $language = 'make'">
778 <xsl:text>makefile</xsl:text>
779 </xsl:when>
780 <!-- Markdown -->
781 <xsl:when test="$language = 'markdown' or $language = 'md'">
782 <xsl:text>markdown</xsl:text>
783 </xsl:when>
784 <!-- MATLAB/Octave -->
785 <xsl:when test="$language = 'matlab' or $language = 'octave'">
786 <xsl:text>matlab</xsl:text>
787 </xsl:when>
788 <!-- Nginx -->
789 <xsl:when test="$language = 'nginx'">
790 <xsl:text>nginx</xsl:text>
791 </xsl:when>
792 <!-- Objective C -->
793 <xsl:when test="$language = 'objc' or $language = 'm'">
794 <xsl:text>objectivec</xsl:text>
795 </xsl:when>
796 <!-- Perl -->
797 <xsl:when test="$language = 'perl' or
798 $language = 'pl' or $language = 'pm'">
799 <xsl:text>perl</xsl:text>
800 </xsl:when>
801 <!-- PHP -->
802 <xsl:when test="$language = 'php'">
803 <xsl:text>php</xsl:text>
804 </xsl:when>
805 <!-- Python -->
806 <xsl:when test="$language = 'py' or $language = 'python'">
807 <xsl:text>python</xsl:text>
808 </xsl:when>
809 <!-- R/S -->
810 <xsl:when test="$language = 'r' or $language = 's'">
811 <xsl:text>r</xsl:text>
812 </xsl:when>
813 <!-- Ruby -->
814 <xsl:when test="$language = 'ruby' or $language = 'rb'">
815 <xsl:text>ruby</xsl:text>
816 </xsl:when>
817 <!-- Rust -->
818 <xsl:when test="$language = 'rust'">
819 <xsl:text>rust</xsl:text>
820 </xsl:when>
821 <!-- Scala -->
822 <xsl:when test="$language = 'scala'">
823 <xsl:text>scala</xsl:text>
824 </xsl:when>
825 <!-- Scheme -->
826 <xsl:when test="$language = 'scheme' or $language = 'scm'">
827 <xsl:text>scheme</xsl:text>
828 </xsl:when>
829 <!-- Shell -->
830 <xsl:when test="$language = 'shell'">
831 <xsl:text>shell</xsl:text>
832 </xsl:when>
833 <!-- Smalltalk -->
834 <xsl:when test="$language = 'smalltalk'">
835 <xsl:text>smalltalk</xsl:text>
836 </xsl:when>
837 <!-- SML -->
838 <xsl:when test="$language = 'sml'">
839 <xsl:text>sml</xsl:text>
840 </xsl:when>
841 <!-- SQL -->
842 <xsl:when test="$language = 'sql' or $language = 'sql92' or
843 $language = 'sql1999' or $language = 'sql2003'">
844 <xsl:text>sql</xsl:text>
845 </xsl:when>
846 <!-- TCL -->
847 <xsl:when test="$language = 'tcl'">
848 <xsl:text>tcl</xsl:text>
849 </xsl:when>
850 <!-- TeX -->
851 <xsl:when test="$language = 'tex' or $language = 'latex'">
852 <xsl:text>latex</xsl:text>
853 </xsl:when>
854 <!-- Vala -->
855 <xsl:when test="$language = 'vala'">
856 <xsl:text>vala</xsl:text>
857 </xsl:when>
858 <!-- XML -->
859 <xsl:when test="$language = 'xml' or $language = 'myxml'">
860 <xsl:text>xml</xsl:text>
861 </xsl:when>
862 <!-- XQuery -->
863 <xsl:when test="$language = 'xq' or $language = 'xquery'">
864 <xsl:text>xquery</xsl:text>
865 </xsl:when>
866 <!-- YAML -->
867 <xsl:when test="$language = 'yaml'">
868 <xsl:text>yaml</xsl:text>
869 </xsl:when>
870 </xsl:choose>
871 </xsl:template>
872
873 <!-- = screen = -->
874 <xsl:template match="screen | db:screen">
875 <xsl:call-template name="db2html.pre"/>
876 </xsl:template>
877
878 <!-- = screenshot = -->
879 <xsl:template match="screenshot | db:screenshot">
880 <xsl:call-template name="db2html.block"/>
881 </xsl:template>
882
883 <!-- = sidebar = -->
884 <xsl:template match="sidebar | db:sidebar">
885 <xsl:call-template name="db2html.block.formal">
886 <xsl:with-param name="class" select="'note note-sidebar'"/>
887 <xsl:with-param name="titleattr">
888 <xsl:call-template name="l10n.gettext">
889 <xsl:with-param name="msgid" select="'Sidebar'"/>
890 </xsl:call-template>
891 </xsl:with-param>
892 </xsl:call-template>
893 </xsl:template>
894
895 <!-- = simpara = -->
896 <xsl:template match="simpara | db:simpara">
897 <xsl:call-template name="db2html.para"/>
898 </xsl:template>
899
900 <!-- = synopsis = -->
901 <xsl:template match="synopsis | db:synopsis">
902 <xsl:call-template name="db2html.pre"/>
903 </xsl:template>
904
905 <!-- = task = -->
906 <xsl:template match="task | db:task">
907 <xsl:call-template name="db2html.block.formal"/>
908 </xsl:template>
909
910 <!-- = taskprerequisites = -->
911 <xsl:template match="taskprerequisites | db:taskprerequisites">
912 <xsl:call-template name="db2html.block.formal"/>
913 </xsl:template>
914
915 <!-- = taskrelated = -->
916 <xsl:template match="taskrelated | db:taskrelated">
917 <xsl:call-template name="db2html.block.formal"/>
918 </xsl:template>
919
920 <!-- = tasksummary = -->
921 <xsl:template match="tasksummary | db:tasksummary">
922 <xsl:call-template name="db2html.block.formal"/>
923 </xsl:template>
924
925 <!-- = tip = -->
926 <xsl:template match="tip | db:tip">
927 <xsl:call-template name="db2html.block.formal">
928 <xsl:with-param name="class" select="'note note-tip'"/>
929 <xsl:with-param name="titleattr">
930 <xsl:call-template name="l10n.gettext">
931 <xsl:with-param name="msgid" select="'Tip'"/>
932 </xsl:call-template>
933 </xsl:with-param>
934 <xsl:with-param name="icon">
935 <xsl:call-template name="icons.svg.note.tip"/>
936 </xsl:with-param>
937 </xsl:call-template>
938 </xsl:template>
939
940 <!-- = title = -->
941 <xsl:template match="title | db:title">
942 <xsl:call-template name="db2html.block.title">
943 <xsl:with-param name="node" select=".."/>
944 <xsl:with-param name="title" select="."/>
945 </xsl:call-template>
946 </xsl:template>
947
948 <!-- = warning = -->
949 <xsl:template match="warning | db:warning">
950 <xsl:call-template name="db2html.block.formal">
951 <xsl:with-param name="class">
952 <xsl:text>note note-</xsl:text>
953 <xsl:choose>
954 <xsl:when test="@role = 'danger'">
955 <xsl:text>danger</xsl:text>
956 </xsl:when>
957 <xsl:otherwise>
958 <xsl:text>warning</xsl:text>
959 </xsl:otherwise>
960 </xsl:choose>
961 </xsl:with-param>
962 <xsl:with-param name="titleattr">
963 <xsl:call-template name="l10n.gettext">
964 <xsl:with-param name="msgid">
965 <xsl:choose>
966 <xsl:when test="@role = 'danger'">
967 <xsl:text>Danger</xsl:text>
968 </xsl:when>
969 <xsl:otherwise>
970 <xsl:text>Warning</xsl:text>
971 </xsl:otherwise>
972 </xsl:choose>
973 </xsl:with-param>
974 </xsl:call-template>
975 </xsl:with-param>
976 <xsl:with-param name="icon">
977 <xsl:choose>
978 <xsl:when test="@role = 'danger'">
979 <xsl:call-template name="icons.svg.note.danger"/>
980 </xsl:when>
981 <xsl:otherwise>
982 <xsl:call-template name="icons.svg.note.warning"/>
983 </xsl:otherwise>
984 </xsl:choose>
985 </xsl:with-param>
986 </xsl:call-template>
987 </xsl:template>
988
989 </xsl:stylesheet>