2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:exsl="http://exslt.org/common"
4 xmlns:ng="http://docbook.org/docbook-ng"
5 xmlns:db="http://docbook.org/ns/docbook"
6 xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
7 exclude-result-prefixes="exsl"
10 <!-- ********************************************************************
11 $Id: other.xsl 8865 2010-08-20 18:22:06Z mzjn $
12 ********************************************************************
14 This file is part of the XSL DocBook Stylesheet distribution.
15 See ../README or http://docbook.sf.net/release/xsl/current/ for
16 copyright and other information.
18 ******************************************************************** -->
20 <!-- * This file contains named templates related to things other than -->
21 <!-- * just assembling the actual text of the main text flow of each man -->
22 <!-- * page. This "other" stuff currently amounts to these steps: -->
24 <!-- * - get contents of the "map" used to convert special characters -->
25 <!-- * - output boilerplate messages -->
26 <!-- * - escape backslash, dot, dash, and apostrophe characters -->
27 <!-- * - convert non-breaking spaces -->
28 <!-- * - add a comment to top part of roff source of each page -->
29 <!-- * - make a .TH title line (for controlling page header/footer) -->
30 <!-- * - set hyphenation, alignment, indent & line-breaking defaults -->
31 <!-- * - "prepare" the complete man page contents for final output -->
32 <!-- * - write the actual man file to the filesystem -->
33 <!-- * - write any "stub" pages to the filesystem -->
35 <!-- * The templates in this file are actually called only once per -->
36 <!-- * each Refentry; they are just in a separate file for the purpose -->
37 <!-- * of keeping things modular. -->
39 <!-- ==================================================================== -->
41 <xsl:preserve-space elements="*"/>
43 <xsl:strip-space elements="
44 abstract affiliation anchor answer appendix area areaset areaspec
45 artheader article audiodata audioobject author authorblurb authorgroup
46 beginpage bibliodiv biblioentry bibliography biblioset blockquote book
47 bookbiblio bookinfo callout calloutlist caption caution chapter
48 citerefentry cmdsynopsis co collab colophon colspec confgroup
49 copyright dedication docinfo editor entrytbl epigraph equation
50 example figure footnote footnoteref formalpara funcprototype
51 funcsynopsis glossary glossdef glossdiv glossentry glosslist graphicco
52 group highlights imagedata imageobject imageobjectco important index
53 indexdiv indexentry indexterm informalequation informalexample
54 informalfigure informaltable inlineequation inlinemediaobject
55 itemizedlist itermset keycombo keywordset legalnotice listitem lot
56 mediaobject mediaobjectco menuchoice msg msgentry msgexplan msginfo
57 msgmain msgrel msgset msgsub msgtext note objectinfo
58 orderedlist othercredit part partintro preface printhistory procedure
59 programlistingco publisher qandadiv qandaentry qandaset question
60 refentry reference refmeta refnamediv refsection refsect1 refsect1info refsect2
61 refsect2info refsect3 refsect3info refsynopsisdiv refsynopsisdivinfo
62 revhistory revision row sbr screenco screenshot sect1 sect1info sect2
63 sect2info sect3 sect3info sect4 sect4info sect5 sect5info section
64 sectioninfo seglistitem segmentedlist seriesinfo set setindex setinfo
65 shortcut sidebar simplelist simplesect spanspec step subject
66 subjectset substeps synopfragment table tbody textobject tfoot tgroup
67 thead tip toc tocchap toclevel1 toclevel2 toclevel3 toclevel4
68 toclevel5 tocpart varargs variablelist varlistentry videodata
69 videoobject void warning subjectset
84 <!-- ==================================================================== -->
85 <!-- * Get character map contents -->
86 <!-- ==================================================================== -->
88 <xsl:variable name="man.charmap.contents">
89 <xsl:if test="$man.charmap.enabled != 0">
90 <xsl:variable name="lang">
91 <xsl:call-template name="l10n.language">
92 <xsl:with-param name="target" select="//refentry[1]"/>
95 <xsl:call-template name="read-character-map">
96 <xsl:with-param name="use.subset" select="$man.charmap.use.subset"/>
97 <xsl:with-param name="subset.profile">
99 <xsl:when test="$lang = 'en'">
100 <xsl:value-of select="$man.charmap.subset.profile.english"/>
103 <xsl:value-of select="$man.charmap.subset.profile"/>
107 <xsl:with-param name="uri">
109 <xsl:when test="$man.charmap.uri != ''">
110 <xsl:value-of select="$man.charmap.uri"/>
113 <xsl:value-of select="'../manpages/charmap.groff.xsl'"/>
121 <!-- ==================================================================== -->
123 <xsl:template name="root.messages">
124 <xsl:param name="refname"/>
125 <!-- redefine this any way you'd like to output messages -->
126 <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
128 <xsl:if test="//foo">
129 <xsl:call-template name="log.message">
130 <xsl:with-param name="level">Warn</xsl:with-param>
131 <xsl:with-param name="source" select="$refname"/>
132 <xsl:with-param name="context-desc">
133 <xsl:text>limitation</xsl:text>
135 <xsl:with-param name="message">
136 <xsl:text>Output for foo element is not yet supported.</xsl:text>
143 <!-- ==================================================================== -->
144 <!-- * Escape roff special chars -->
145 <!-- ==================================================================== -->
147 <!-- ******************************************************************** -->
149 <!-- * The backslash, dot, dash, and apostrophe (\, ., -, ') characters -->
150 <!-- * have special meaning for roff, so before we do any other -->
151 <!-- * processing, we must escape those characters where they appear in -->
152 <!-- * the source content. -->
154 <!-- * Here we also deal with replacing U+00a0 (non-breaking space) with -->
155 <!-- * its roff equivalent -->
157 <!-- ******************************************************************** -->
159 <xsl:template match="//refentry//text()">
160 <xsl:call-template name="escape.roff.specials">
161 <xsl:with-param name="content">
162 <xsl:value-of select="."/>
167 <xsl:template name="escape.roff.specials">
168 <xsl:param name="content"/>
169 <xsl:call-template name="convert.nobreak-space">
170 <xsl:with-param name="content">
171 <xsl:call-template name="escape.apostrophe">
172 <xsl:with-param name="content">
173 <xsl:call-template name="escape.dash">
174 <xsl:with-param name="content">
175 <xsl:call-template name="escape.dot">
176 <xsl:with-param name="content">
177 <xsl:call-template name="escape.backslash">
178 <xsl:with-param name="content" select="$content"/>
190 <xsl:template name="escape.backslash">
191 <xsl:param name="content"/>
192 <xsl:call-template name="string.subst">
193 <xsl:with-param name="string" select="$content"/>
194 <xsl:with-param name="target">\</xsl:with-param>
195 <!-- * we use "\e" instead of "\\" because the groff docs say -->
196 <!-- * that's the correct thing to do; also because testing -->
197 <!-- * shows that "\\" doesn't always work as expected; for -->
198 <!-- * example, "\\" within a table seems to mess things up -->
199 <xsl:with-param name="replacement">\e</xsl:with-param>
203 <xsl:template name="escape.dot">
204 <xsl:param name="content"/>
205 <xsl:call-template name="string.subst">
206 <xsl:with-param name="string" select="$content"/>
207 <xsl:with-param name="target">.</xsl:with-param>
208 <xsl:with-param name="replacement">\&.</xsl:with-param>
212 <xsl:template name="escape.dash">
213 <xsl:param name="content"/>
214 <xsl:call-template name="string.subst">
215 <xsl:with-param name="string" select="$content"/>
216 <xsl:with-param name="target">-</xsl:with-param>
217 <xsl:with-param name="replacement">\-</xsl:with-param>
221 <xsl:template name="escape.apostrophe">
222 <xsl:param name="content"/>
223 <xsl:call-template name="string.subst">
224 <xsl:with-param name="string" select="$content"/>
225 <xsl:with-param name="target">'</xsl:with-param>
226 <xsl:with-param name="replacement">\*(Aq</xsl:with-param>
230 <xsl:template name="convert.nobreak-space">
231 <xsl:param name="content"/>
232 <xsl:call-template name="string.subst">
233 <xsl:with-param name="string" select="$content"/>
234 <xsl:with-param name="target"> </xsl:with-param>
235 <!-- * A no-break space can be written two ways in roff; the -->
236 <!-- * difference, according to the "Page Motions" node in the -->
237 <!-- * groff info page, is: -->
240 <!-- * An unbreakable and unpaddable (i.e. not expanded -->
241 <!-- * during filling) space. -->
244 <!-- * An unbreakable space that stretches like a normal -->
245 <!-- * inter-word space when a line is adjusted." -->
247 <!-- * Unfortunately, roff seems to do some weird things with -->
248 <!-- * long lines that only have words separated by "\~" -->
249 <!-- * spaces, so it's safer just to stick with the "\ " space -->
251 <!-- * We append a "\&" to handle the case of a no-break space that -->
252 <!-- * appears at the end of a line - because later processing will -->
253 <!-- * cause that space to get eaten otherwise. -->
254 <xsl:with-param name="replacement">\ \&</xsl:with-param>
258 <!-- ==================================================================== -->
260 <!-- * top.comment generates a comment containing metadata for the man -->
261 <!-- * page; for example, Author, Generator, and Date information -->
263 <xsl:template name="top.comment">
264 <xsl:param name="info"/>
265 <xsl:param name="date"/>
266 <xsl:param name="title"/>
267 <xsl:param name="manual"/>
268 <xsl:param name="source"/>
269 <xsl:param name="refname"/>
270 <xsl:text>.\" Title: </xsl:text>
271 <xsl:call-template name="replace.dots.and.dashes">
272 <xsl:with-param name="content" select="$title"/>
274 <xsl:text> </xsl:text>
275 <xsl:text>.\" Author: </xsl:text>
276 <xsl:call-template name="replace.dots.and.dashes">
277 <xsl:with-param name="content">
278 <xsl:call-template name="make.roff.metadata.author">
279 <xsl:with-param name="info" select="$info"/>
280 <xsl:with-param name="refname" select="$refname"/>
284 <xsl:text> </xsl:text>
285 <xsl:text>.\" Generator: DocBook </xsl:text>
286 <xsl:value-of select="$DistroTitle"/>
287 <xsl:text> v</xsl:text>
288 <xsl:call-template name="replace.dots.and.dashes">
289 <xsl:with-param name="content" select="$VERSION"/>
291 <xsl:text> <http://docbook.sf.net/></xsl:text>
292 <xsl:text> </xsl:text>
293 <xsl:text>.\" Date: </xsl:text>
294 <xsl:call-template name="replace.dots.and.dashes">
295 <xsl:with-param name="content" select="$date"/>
297 <xsl:text> </xsl:text>
298 <xsl:text>.\" Manual: </xsl:text>
299 <xsl:call-template name="replace.dots.and.dashes">
300 <xsl:with-param name="content" select="$manual"/>
302 <xsl:text> </xsl:text>
303 <xsl:text>.\" Source: </xsl:text>
304 <xsl:call-template name="replace.dots.and.dashes">
305 <xsl:with-param name="content" select="$source"/>
307 <xsl:text> </xsl:text>
308 <xsl:text>.\" Language: </xsl:text>
309 <xsl:call-template name="l10n.language.name"/>
310 <xsl:text> </xsl:text>
311 <xsl:text>.\"</xsl:text>
312 <xsl:text> </xsl:text>
315 <!-- ==================================================================== -->
317 <xsl:template name="TH.title.line">
319 <!-- * The exact way that .TH contents are displayed is system- -->
320 <!-- * dependent; it varies somewhat between OSes and roff -->
321 <!-- * versions. Below is a description of how Linux systems with -->
322 <!-- * a modern groff seem to render .TH contents. -->
324 <!-- * title(section) extra3 title(section) <- page header -->
325 <!-- * extra2 extra1 title(section) <- page footer-->
327 <!-- * Or, using the names with which the man(7) man page refers -->
328 <!-- * to the various fields: -->
330 <!-- * title(section) manual title(section) <- page header -->
331 <!-- * source date title(section) <- page footer-->
333 <!-- * Note that while extra1, extra2, and extra3 are all (nominally) -->
334 <!-- * optional, in practice almost all pages include an "extra1" -->
335 <!-- * field, which is, universally, a date (in some form), and it is -->
336 <!-- * always rendered in the same place (the middle footer position) -->
338 <!-- * Here are a couple of examples of real-world man pages that -->
339 <!-- * have somewhat useful page headers/footers: -->
341 <!-- * gtk-options(7) GTK+ User's Manual gtk-options(7) -->
342 <!-- * GTK+ 1.2 2003-10-20 gtk-options(7) -->
344 <!-- * svgalib(7) Svgalib User Manual svgalib(7) -->
345 <!-- * Svgalib 1.4.1 16 December 1999 svgalib(7) -->
347 <xsl:param name="title"/>
348 <xsl:param name="section"/>
349 <xsl:param name="extra1"/>
350 <xsl:param name="extra2"/>
351 <xsl:param name="extra3"/>
353 <xsl:call-template name="mark.subheading"/>
354 <!-- * Note that we generate quotes around _every_ field in the -->
355 <!-- * .TH title line, including the "title" and "section" -->
356 <!-- * fields. That is because we use the contents of those "as -->
357 <!-- * is", unchanged from the DocBook source; and DTD-based -->
358 <!-- * validation does not provide a way to constrain them to be -->
359 <!-- * "space free" -->
360 <xsl:text>.TH "</xsl:text>
361 <xsl:call-template name="string.upper">
362 <xsl:with-param name="string">
364 <xsl:when test="$man.th.title.max.length != ''">
366 select="normalize-space(substring($title, 1, $man.th.title.max.length))"/>
369 <xsl:value-of select="normalize-space($title)"/>
374 <xsl:text>" "</xsl:text>
375 <xsl:value-of select="normalize-space($section)"/>
376 <xsl:text>" "</xsl:text>
377 <xsl:if test="$man.th.extra1.suppress = 0">
378 <!-- * there is no max.length for the extra1 field; the reason -->
379 <!-- * is, it is almost always a date, and it is not possible -->
380 <!-- * to truncate dates without changing their meaning -->
381 <xsl:value-of select="normalize-space($extra1)"/>
383 <xsl:text>" "</xsl:text>
384 <xsl:if test="$man.th.extra2.suppress = 0">
386 <!-- * if max.length is non-empty, use value to truncate field -->
387 <xsl:when test="$man.th.extra2.max.length != ''">
389 select="normalize-space(substring($extra2, 1, $man.th.extra2.max.length))"/>
392 <xsl:value-of select="normalize-space($extra2)"/>
396 <xsl:text>" "</xsl:text>
397 <xsl:if test="$man.th.extra3.suppress = 0">
399 <!-- * if max.length is non-empty, use value to truncate field -->
400 <xsl:when test="$man.th.extra3.max.length != ''">
402 select="normalize-space(substring($extra3, 1, $man.th.extra3.max.length))"/>
405 <xsl:value-of select="normalize-space($extra3)"/>
409 <xsl:text>" </xsl:text>
410 <xsl:call-template name="mark.subheading"/>
413 <!-- ============================================================== -->
415 <xsl:template name="set.default.formatting">
416 <!-- * Set default hyphenation, justification, indentation and -->
417 <!-- * line-breaking -->
419 <!-- * If the value of man.hypenate is zero (the default), then -->
420 <!-- * disable hyphenation (".nh" = "no hyphenation") -->
421 <xsl:text>.\" ----------------------------------------------------------------- </xsl:text>
422 <xsl:text>.\" * set default formatting </xsl:text>
423 <xsl:text>.\" ----------------------------------------------------------------- </xsl:text>
424 <xsl:if test="$man.hyphenate = 0">
425 <xsl:text>.\" disable hyphenation </xsl:text>
426 <xsl:text>.nh </xsl:text>
428 <!-- * If the value of man.justify is zero (the default), then -->
429 <!-- * disable justification (".ad l" means "adjust to left only") -->
430 <xsl:if test="$man.justify = 0">
431 <xsl:text>.\" disable justification</xsl:text>
432 <xsl:text> (adjust text to left margin only) </xsl:text>
433 <xsl:text>.ad l </xsl:text>
435 <xsl:if test="not($man.indent.refsect = 0)">
436 <xsl:text>.\" store initial "default indentation value" </xsl:text>
437 <xsl:text>.nr zq \n(IN </xsl:text>
438 <xsl:text>.\" adjust default indentation </xsl:text>
439 <xsl:text>.nr IN </xsl:text>
440 <xsl:value-of select="$man.indent.width"/>
441 <xsl:text> </xsl:text>
442 <xsl:text>.\" adjust indentation of SS headings </xsl:text>
443 <xsl:text>.nr SN \n(IN </xsl:text>
445 <!-- * Unless the value of man.break.after.slash is zero (the -->
446 <!-- * default), tell groff that it is OK to break a line -->
447 <!-- * after a slash when needed. -->
448 <xsl:if test="$man.break.after.slash != 0">
449 <xsl:text>.\" enable line breaks after slashes </xsl:text>
450 <xsl:text>.cflags 4 / </xsl:text>
454 <!-- ================================================================== -->
456 <!-- * The prepare.manpage.contents template is called after all -->
457 <!-- * other processing has been done, before serializing the -->
458 <!-- * result of all the other processing. It basically works on -->
459 <!-- * the result as one big string. -->
460 <xsl:template name="prepare.manpage.contents">
461 <xsl:param name="content" select="''"/>
463 <!-- * If user has provided a "local" string-substitution map to -->
464 <!-- * be applied /before/ the standard string-substitution map, -->
466 <xsl:variable name="pre.adjusted.content">
468 <xsl:when test="$man.string.subst.map.local.pre">
469 <!-- * normalized value of man.string.subst.map.local.pre -->
470 <!-- * is non-empty, so get contents of map and apply them -->
471 <xsl:call-template name="apply-string-subst-map">
472 <xsl:with-param name="content" select="$content"/>
473 <xsl:with-param name="map.contents"
474 select="exsl:node-set($man.string.subst.map.local.pre)/*"/>
478 <!-- * value of man.string.subst.map.local.pre is empty, -->
479 <!-- * so just copy original contents -->
480 <xsl:value-of select="$content"/>
485 <!-- * Apply standard string-substitution map. The main purpose -->
486 <!-- * of this map is to escape certain characters that have -->
487 <!-- * special meaning in roff, and to replace certain characters -->
488 <!-- * used within the stylesheet internally to represent roff -->
489 <!-- * markup characters. -->
490 <xsl:variable name="adjusted.content">
491 <xsl:call-template name="apply-string-subst-map">
492 <xsl:with-param name="content" select="$pre.adjusted.content"/>
493 <xsl:with-param name="map.contents"
494 select="exsl:node-set($man.string.subst.map)/*"/>
498 <!-- * If user has provided a "local" string-substitution map to -->
499 <!-- * be applied /after/ the standard string-substitution map, -->
501 <xsl:variable name="post.adjusted.content">
503 <xsl:when test="$man.string.subst.map.local.post">
504 <!-- * normalized value of man.string.subst.map.local.post -->
505 <!-- * is non-empty, so get contents of map and apply them -->
506 <xsl:call-template name="apply-string-subst-map">
507 <xsl:with-param name="content" select="$adjusted.content"/>
508 <xsl:with-param name="map.contents"
509 select="exsl:node-set($man.string.subst.map.local.post)/*"/>
513 <!-- * value of man.string.subst.map.local.post is empty, -->
514 <!-- * so just copy original contents -->
515 <xsl:value-of select="$adjusted.content"/>
520 <!-- * Optionally, apply a character map to replace Unicode -->
521 <!-- * symbols and special characters. -->
523 <xsl:when test="$man.charmap.enabled != 0">
524 <xsl:call-template name="apply-character-map">
525 <xsl:with-param name="content" select="$post.adjusted.content"/>
526 <xsl:with-param name="map.contents"
527 select="exsl:node-set($man.charmap.contents)/*"/>
531 <!-- * if we reach here, value of $man.charmap.enabled is zero, -->
532 <!-- * so we just pass the adjusted contents through "as is" -->
533 <xsl:value-of select="$adjusted.content"/>
538 <!-- ================================================================== -->
540 <xsl:template name="write.man.file">
541 <xsl:param name="name"/>
542 <xsl:param name="section"/>
543 <xsl:param name="lang"/>
544 <xsl:param name="content"/>
545 <xsl:param name="filename">
546 <xsl:call-template name="make.adjusted.man.filename">
547 <xsl:with-param name="name" select="$name"/>
548 <xsl:with-param name="section" select="$section"/>
549 <xsl:with-param name="lang" select="$lang"/>
552 <xsl:call-template name="write.text.chunk">
553 <xsl:with-param name="filename" select="$filename"/>
554 <xsl:with-param name="suppress-context-node-name" select="1"/>
555 <xsl:with-param name="quiet" select="$man.output.quietly"/>
557 name="message-prolog"
558 >Note: </xsl:with-param>
559 <xsl:with-param name="encoding" select="$man.output.encoding"/>
560 <xsl:with-param name="content" select="$content"/>
564 <!-- ============================================================== -->
566 <!-- * A "stub" is sort of alias for another file, intended to be read -->
567 <!-- * and expanded by soelim(1); it's simply a file whose complete -->
568 <!-- * contents are just a single line of the following form: -->
570 <!-- * .so manX/realname.X -->
572 <!-- * "realname" is a name of another man-page file. That .so line is -->
573 <!-- * basically a roff "include" statement. When the man command finds -->
574 <!-- * it, it calls soelim(1) and includes and displays the contents of -->
575 <!-- * the manX/realqname.X file. -->
577 <!-- * If a refentry has multiple refnames, we generate a "stub" page for -->
578 <!-- * each refname found, except for the first one. -->
579 <xsl:template name="write.stubs">
580 <xsl:param name="first.refname"/>
581 <xsl:param name="section"/>
582 <xsl:param name="lang"/>
583 <xsl:for-each select="refnamediv/refname">
584 <xsl:if test=". != $first.refname">
585 <xsl:call-template name="write.text.chunk">
586 <xsl:with-param name="filename">
587 <xsl:call-template name="make.adjusted.man.filename">
588 <xsl:with-param name="name" select="."/>
589 <xsl:with-param name="section" select="$section"/>
590 <xsl:with-param name="lang" select="$lang"/>
593 <xsl:with-param name="quiet" select="$man.output.quietly"/>
594 <xsl:with-param name="suppress-context-node-name" select="1"/>
595 <xsl:with-param name="message-prolog">Note: </xsl:with-param>
596 <xsl:with-param name="message-epilog"> (soelim stub)</xsl:with-param>
597 <xsl:with-param name="content">
598 <xsl:value-of select="'.so '"/>
599 <xsl:call-template name="make.adjusted.man.filename">
600 <xsl:with-param name="name" select="$first.refname"/>
601 <xsl:with-param name="section" select="$section"/>
602 <xsl:with-param name="lang" select="$lang"/>
604 <xsl:text> </xsl:text>
611 <!-- ============================================================== -->
613 <!-- * A manifest file is useful for doing "make clean" during -->
614 <!-- * builds and for other purposes. When we make the manifest -->
615 <!-- * file, we need to include in it a filename for each man-page -->
616 <!-- * generated, including any "stub" pages. -->
617 <xsl:template name="generate.manifest">
618 <xsl:variable name="filelist">
619 <xsl:for-each select="//refentry">
620 <!-- * all refname instances in a Refentry inherit their section -->
621 <!-- * numbers from the parent Refentry; so we only need to get -->
622 <!-- * the section once per Refentry, not once per Refname -->
623 <xsl:variable name="section">
624 <xsl:call-template name="get.refentry.section">
625 <xsl:with-param name="quiet" select="1"/>
628 <xsl:variable name="lang">
629 <xsl:call-template name="l10n.language"/>
631 <xsl:for-each select="refnamediv/refname">
632 <xsl:call-template name="make.adjusted.man.filename">
633 <xsl:with-param name="name" select="."/>
634 <xsl:with-param name="section" select="$section"/>
635 <xsl:with-param name="lang" select="$lang"/>
637 <xsl:text> </xsl:text>
642 <!-- * we write the manifest file once per document, not once per -->
644 <xsl:call-template name="write.text.chunk">
645 <xsl:with-param name="filename">
646 <xsl:value-of select="$man.output.manifest.filename"/>
648 <xsl:with-param name="quiet" select="1"/>
649 <xsl:with-param name="message-prolog">Note: </xsl:with-param>
650 <xsl:with-param name="message-epilog"> (manifest file)</xsl:with-param>
651 <xsl:with-param name="content">
652 <xsl:value-of select="$filelist"/>
655 <xsl:if test="$man.output.quietly = 0">
656 <xsl:message><xsl:text> </xsl:text></xsl:message>
660 <!-- ============================================================== -->
662 <!-- There is some stuff, that is not portable between groff/troff. -->
663 <xsl:template name="define.portability.macros">
664 <xsl:text>.\" ----------------------------------------------------------------- </xsl:text>
665 <xsl:text>.\" * Define some portability stuff </xsl:text>
666 <xsl:text>.\" ----------------------------------------------------------------- </xsl:text>
667 <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </xsl:text>
668 <xsl:text>.\" http://bugs.debian.org/507673 </xsl:text>
669 <xsl:text>.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html </xsl:text>
670 <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </xsl:text>
671 <xsl:text> </xsl:text>
672 <xsl:text>.ie \n(.g .ds Aq \(aq</xsl:text>
673 <xsl:text> </xsl:text>
674 <xsl:text>.el .ds Aq '</xsl:text>
675 <xsl:text> </xsl:text>
678 <!-- ============================================================== -->
680 <xsl:template name="define.macros">
681 <xsl:text>.\" ----------------------------------------------------------------- </xsl:text>
682 <xsl:text>.\" * (re)Define some macros </xsl:text>
683 <xsl:text>.\" ----------------------------------------------------------------- </xsl:text>
684 <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </xsl:text>
685 <xsl:text>.\" toupper - uppercase a string (locale-aware) </xsl:text>
686 <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </xsl:text>
687 <xsl:text>.de toupper </xsl:text>
688 <xsl:text>.tr</xsl:text>
689 <xsl:text> </xsl:text>
690 <xsl:call-template name="make.tr.uppercase.arg"/>
691 <xsl:text>\\$* </xsl:text>
692 <xsl:text>.tr</xsl:text>
693 <xsl:text> </xsl:text>
694 <xsl:call-template name="make.tr.normalcase.arg"/>
695 <xsl:text>.. </xsl:text>
696 <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </xsl:text>
697 <xsl:text>.\" SH-xref - format a cross-reference to an SH section </xsl:text>
698 <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </xsl:text>
699 <xsl:text>.de SH-xref
707 <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </xsl:text>
708 <xsl:text>.\" SH - level-one heading that works better for non-TTY output </xsl:text>
709 <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </xsl:text>
710 <xsl:text>.de1 SH </xsl:text>
711 <xsl:text>.\" put an extra blank line of space above the head in non-TTY output </xsl:text>
712 <xsl:call-template name="roff-if-start">
713 <xsl:with-param name="condition">t</xsl:with-param>
715 <xsl:text>.sp 1 </xsl:text>
716 <xsl:call-template name="roff-if-end"/>
717 <xsl:text>.sp \\n[PD]u
720 .nr an-prevailing-indent \\n[IN]
724 .HTML-TAG ".NH \\n[an-level]"
726 .nr an-no-space-flag 1
728 \." make the size of the head bigger
733 .\" if n (TTY output), use uppercase
738 .\" if not n (not TTY), use normal case (not uppercase)
742 .\" if not n (not TTY), put a border/line under subheading
747 <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </xsl:text>
748 <xsl:text>.\" SS - level-two heading that works better for non-TTY output </xsl:text>
749 <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </xsl:text>
754 .nr an-prevailing-indent \\n[IN]
759 .nr an-no-space-flag 1
762 \." make the size of the head bigger
766 .if \\n[.$] \&\\$*
768 <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </xsl:text>
769 <xsl:text>.\" BB/EB - put background/screen (filled box) around block of text </xsl:text>
770 <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </xsl:text>
783 .if "\\$2"adjust-for-leading-newline" \{\
791 .nr BW \\n(.lu-\\n(.i
794 .ie "\\$2"adjust-for-leading-newline" \{\
795 \M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
798 \M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
809 <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </xsl:text>
810 <xsl:text>.\" BM/EM - put colored marker in margin next to block of text </xsl:text>
811 <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </xsl:text>
828 \M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
838 <xsl:template name="make.tr.uppercase.arg">
839 <xsl:call-template name="string.shuffle">
840 <xsl:with-param name="string1">
841 <xsl:call-template name="gentext">
842 <xsl:with-param name="key" select="'lowercase.alpha'"/>
845 <xsl:with-param name="string2">
846 <xsl:call-template name="gentext">
847 <xsl:with-param name="key" select="'uppercase.alpha'"/>
851 <xsl:text> </xsl:text>
854 <xsl:template name="make.tr.normalcase.arg">
855 <xsl:call-template name="string.shuffle">
856 <xsl:with-param name="string1">
857 <xsl:call-template name="gentext">
858 <xsl:with-param name="key" select="'lowercase.alpha'"/>
861 <xsl:with-param name="string2">
862 <xsl:call-template name="gentext">
863 <xsl:with-param name="key" select="'lowercase.alpha'"/>
867 <xsl:text> </xsl:text>
870 <xsl:template name="string.shuffle">
871 <!-- * given two strings, "shuffle" them together into one -->
872 <xsl:param name="string1"/>
873 <xsl:param name="string2"/>
874 <xsl:value-of select="substring($string1, 1, 1)"/>
875 <xsl:value-of select="substring($string2, 1, 1)"/>
876 <xsl:if test="string-length($string1) > 1">
877 <xsl:call-template name="string.shuffle">
878 <xsl:with-param name="string1">
879 <xsl:value-of select="substring($string1, 2)"/>
881 <xsl:with-param name="string2">
882 <xsl:value-of select="substring($string2, 2)"/>