| 1 |
<?xml version='1.0'?> |
| 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 |
exclude-result-prefixes="exsl" |
| 7 |
version='1.0'> |
| 8 |
|
| 9 |
<!-- ******************************************************************** |
| 10 |
$Id: other.xsl 6863 2007-06-23 09:08:06Z xmldoc $ |
| 11 |
******************************************************************** |
| 12 |
|
| 13 |
This file is part of the XSL DocBook Stylesheet distribution. |
| 14 |
See ../README or http://docbook.sf.net/release/xsl/current/ for |
| 15 |
copyright and other information. |
| 16 |
|
| 17 |
******************************************************************** --> |
| 18 |
|
| 19 |
<!-- * This file contains named templates related to things other than --> |
| 20 |
<!-- * just assembling the actual text of the main text flow of each man --> |
| 21 |
<!-- * page. This "other" stuff currently amounts to these steps: --> |
| 22 |
<!-- * --> |
| 23 |
<!-- * - get contents of the "map" used to convert special characters --> |
| 24 |
<!-- * - output boilerplate messages --> |
| 25 |
<!-- * - escape backslash, dot, dash, and apostrophe characters --> |
| 26 |
<!-- * - convert non-breaking spaces --> |
| 27 |
<!-- * - add a comment to top part of roff source of each page --> |
| 28 |
<!-- * - make a .TH title line (for controlling page header/footer) --> |
| 29 |
<!-- * - set hyphenation, alignment, indent & line-breaking defaults --> |
| 30 |
<!-- * - "prepare" the complete man page contents for final output --> |
| 31 |
<!-- * - write the actual man file to the filesystem --> |
| 32 |
<!-- * - write any "stub" pages to the filesystem --> |
| 33 |
<!-- * --> |
| 34 |
<!-- * The templates in this file are actually called only once per --> |
| 35 |
<!-- * each Refentry; they are just in a separate file for the purpose --> |
| 36 |
<!-- * of keeping things modular. --> |
| 37 |
|
| 38 |
<!-- ==================================================================== --> |
| 39 |
|
| 40 |
<xsl:preserve-space elements="*"/> |
| 41 |
|
| 42 |
<xsl:strip-space elements=" |
| 43 |
abstract affiliation anchor answer appendix area areaset areaspec |
| 44 |
artheader article audiodata audioobject author authorblurb authorgroup |
| 45 |
beginpage bibliodiv biblioentry bibliography biblioset blockquote book |
| 46 |
bookbiblio bookinfo callout calloutlist caption caution chapter |
| 47 |
citerefentry cmdsynopsis co collab colophon colspec confgroup |
| 48 |
copyright dedication docinfo editor entrytbl epigraph equation |
| 49 |
example figure footnote footnoteref formalpara funcprototype |
| 50 |
funcsynopsis glossary glossdef glossdiv glossentry glosslist graphicco |
| 51 |
group highlights imagedata imageobject imageobjectco important index |
| 52 |
indexdiv indexentry indexterm informalequation informalexample |
| 53 |
informalfigure informaltable inlineequation inlinemediaobject |
| 54 |
itemizedlist itermset keycombo keywordset legalnotice listitem lot |
| 55 |
mediaobject mediaobjectco menuchoice msg msgentry msgexplan msginfo |
| 56 |
msgmain msgrel msgset msgsub msgtext note objectinfo |
| 57 |
orderedlist othercredit part partintro preface printhistory procedure |
| 58 |
programlistingco publisher qandadiv qandaentry qandaset question |
| 59 |
refentry reference refmeta refnamediv refsection refsect1 refsect1info refsect2 |
| 60 |
refsect2info refsect3 refsect3info refsynopsisdiv refsynopsisdivinfo |
| 61 |
revhistory revision row sbr screenco screenshot sect1 sect1info sect2 |
| 62 |
sect2info sect3 sect3info sect4 sect4info sect5 sect5info section |
| 63 |
sectioninfo seglistitem segmentedlist seriesinfo set setindex setinfo |
| 64 |
shortcut sidebar simplelist simplesect spanspec step subject |
| 65 |
subjectset substeps synopfragment table tbody textobject tfoot tgroup |
| 66 |
thead tip toc tocchap toclevel1 toclevel2 toclevel3 toclevel4 |
| 67 |
toclevel5 tocpart varargs variablelist varlistentry videodata |
| 68 |
videoobject void warning subjectset |
| 69 |
|
| 70 |
classsynopsis |
| 71 |
constructorsynopsis |
| 72 |
destructorsynopsis |
| 73 |
fieldsynopsis |
| 74 |
methodparam |
| 75 |
methodsynopsis |
| 76 |
ooclass |
| 77 |
ooexception |
| 78 |
oointerface |
| 79 |
simplemsgentry |
| 80 |
manvolnum |
| 81 |
|
| 82 |
db:abstract db:affiliation db:anchor db:answer db:appendix db:area db:areaset db:areaspec |
| 83 |
db:artheader db:article db:audiodata db:audioobject db:author db:authorblurb db:authorgroup |
| 84 |
db:beginpage db:bibliodiv db:biblioentry db:bibliography db:biblioset db:blockquote db:book |
| 85 |
db:bookbiblio db:bookinfo db:callout db:calloutlist db:caption db:caution db:chapter |
| 86 |
db:citerefentry db:cmdsynopsis db:co db:collab db:colophon db:colspec db:confgroup |
| 87 |
db:copyright db:dedication db:docinfo db:editor db:entrytbl db:epigraph db:equation |
| 88 |
db:example db:figure db:footnote db:footnoteref db:formalpara db:funcprototype |
| 89 |
db:funcsynopsis db:glossary db:glossdef db:glossdiv db:glossentry db:glosslist db:graphicco |
| 90 |
db:group db:highlights db:imagedata db:imageobject db:imageobjectco db:important db:index |
| 91 |
db:indexdiv db:indexentry db:indexterm db:informalequation db:informalexample |
| 92 |
db:informalfigure db:informaltable db:inlineequation db:inlinemediaobject |
| 93 |
db:itemizedlist db:itermset db:keycombo db:keywordset db:legalnotice db:listitem db:lot |
| 94 |
db:mediaobject db:mediaobjectco db:menuchoice db:msg db:msgentry db:msgexplan db:msginfo |
| 95 |
db:msgmain db:msgrel db:msgset db:msgsub db:msgtext db:note db:objectinfo |
| 96 |
db:orderedlist db:othercredit db:part db:partintro db:preface db:printhistory db:procedure |
| 97 |
db:programlistingco db:publisher db:qandadiv db:qandaentry db:qandaset db:question |
| 98 |
db:refentry db:reference db:refmeta db:refnamediv db:refsection db:refsect1 db:refsect1info |
| 99 |
db:refsect2 |
| 100 |
db:refsect2info db:refsect3 db:refsect3info db:refsynopsisdiv db:refsynopsisdivinfo |
| 101 |
db:revhistory db:revision db:row db:sbr db:screenco db:screenshot db:sect1 db:sect1info db:sect2 |
| 102 |
db:sect2info db:sect3 db:sect3info db:sect4 db:sect4info db:sect5 db:sect5info db:section |
| 103 |
db:sectioninfo db:seglistitem db:segmentedlist db:seriesinfo db:set db:setindex db:setinfo |
| 104 |
db:shortcut db:sidebar db:simplelist db:simplesect db:spanspec db:step db:subject |
| 105 |
db:subjectset db:substeps db:synopfragment db:table db:tbody db:textobject db:tfoot db:tgroup |
| 106 |
db:thead db:tip db:toc db:tocchap db:toclevel1 db:toclevel2 db:toclevel3 db:toclevel4 |
| 107 |
db:toclevel5 db:tocpart db:varargs db:variablelist db:varlistentry db:videodata |
| 108 |
db:videoobject db:void db:warning db:subjectset |
| 109 |
|
| 110 |
db:classsynopsis |
| 111 |
db:constructorsynopsis |
| 112 |
db:destructorsynopsis |
| 113 |
db:fieldsynopsis |
| 114 |
db:methodparam |
| 115 |
db:methodsynopsis |
| 116 |
db:ooclass |
| 117 |
db:ooexception |
| 118 |
db:oointerface |
| 119 |
db:simplemsgentry |
| 120 |
db:manvolnum |
| 121 |
"/> |
| 122 |
|
| 123 |
<!-- ==================================================================== --> |
| 124 |
<!-- * Get character map contents --> |
| 125 |
<!-- ==================================================================== --> |
| 126 |
|
| 127 |
<xsl:variable name="man.charmap.contents"> |
| 128 |
<xsl:if test="$man.charmap.enabled != 0"> |
| 129 |
<xsl:call-template name="read-character-map"> |
| 130 |
<xsl:with-param name="use.subset" select="$man.charmap.use.subset"/> |
| 131 |
<xsl:with-param name="subset.profile" select="$man.charmap.subset.profile"/> |
| 132 |
<xsl:with-param name="uri"> |
| 133 |
<xsl:choose> |
| 134 |
<xsl:when test="$man.charmap.uri != ''"> |
| 135 |
<xsl:value-of select="$man.charmap.uri"/> |
| 136 |
</xsl:when> |
| 137 |
<xsl:otherwise> |
| 138 |
<xsl:value-of select="'../manpages/charmap.groff.xsl'"/> |
| 139 |
</xsl:otherwise> |
| 140 |
</xsl:choose> |
| 141 |
</xsl:with-param> |
| 142 |
</xsl:call-template> |
| 143 |
</xsl:if> |
| 144 |
</xsl:variable> |
| 145 |
|
| 146 |
<!-- ==================================================================== --> |
| 147 |
|
| 148 |
<xsl:template name="root.messages"> |
| 149 |
<xsl:param name="refname"/> |
| 150 |
<!-- redefine this any way you'd like to output messages --> |
| 151 |
<!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE --> |
| 152 |
<!-- Example: |
| 153 |
<xsl:if test="//foo"> |
| 154 |
<xsl:call-template name="log.message"> |
| 155 |
<xsl:with-param name="level">Warn</xsl:with-param> |
| 156 |
<xsl:with-param name="source" select="$refname"/> |
| 157 |
<xsl:with-param name="context-desc"> |
| 158 |
<xsl:text>limitation</xsl:text> |
| 159 |
</xsl:with-param> |
| 160 |
<xsl:with-param name="message"> |
| 161 |
<xsl:text>Output for foo element is not yet supported.</xsl:text> |
| 162 |
</xsl:with-param> |
| 163 |
</xsl:call-template> |
| 164 |
</xsl:if> |
| 165 |
--> |
| 166 |
</xsl:template> |
| 167 |
|
| 168 |
<!-- ==================================================================== --> |
| 169 |
<!-- * Escape roff special chars --> |
| 170 |
<!-- ==================================================================== --> |
| 171 |
|
| 172 |
<!-- ******************************************************************** --> |
| 173 |
<!-- * --> |
| 174 |
<!-- * The backslash, dot, dash, and apostrophe (\, ., -, ') characters --> |
| 175 |
<!-- * have special meaning for roff, so before we do any other --> |
| 176 |
<!-- * processing, we must escape those characters where they appear in --> |
| 177 |
<!-- * the source content. --> |
| 178 |
<!-- * --> |
| 179 |
<!-- * Here we also deal with replacing U+00a0 (non-breaking space) with --> |
| 180 |
<!-- * its roff equivalent --> |
| 181 |
<!-- * --> |
| 182 |
<!-- ******************************************************************** --> |
| 183 |
|
| 184 |
<xsl:template match="//refentry//text()"> |
| 185 |
<xsl:call-template name="escape.roff.specials"> |
| 186 |
<xsl:with-param name="content"> |
| 187 |
<xsl:value-of select="."/> |
| 188 |
</xsl:with-param> |
| 189 |
</xsl:call-template> |
| 190 |
</xsl:template> |
| 191 |
|
| 192 |
<xsl:template name="escape.roff.specials"> |
| 193 |
<xsl:param name="content"/> |
| 194 |
<xsl:call-template name="convert.nobreak-space"> |
| 195 |
<xsl:with-param name="content"> |
| 196 |
<xsl:call-template name="escape.apostrophe"> |
| 197 |
<xsl:with-param name="content"> |
| 198 |
<xsl:call-template name="escape.dash"> |
| 199 |
<xsl:with-param name="content"> |
| 200 |
<xsl:call-template name="escape.dot"> |
| 201 |
<xsl:with-param name="content"> |
| 202 |
<xsl:call-template name="escape.backslash"> |
| 203 |
<xsl:with-param name="content" select="$content"/> |
| 204 |
</xsl:call-template> |
| 205 |
</xsl:with-param> |
| 206 |
</xsl:call-template> |
| 207 |
</xsl:with-param> |
| 208 |
</xsl:call-template> |
| 209 |
</xsl:with-param> |
| 210 |
</xsl:call-template> |
| 211 |
</xsl:with-param> |
| 212 |
</xsl:call-template> |
| 213 |
</xsl:template> |
| 214 |
|
| 215 |
<xsl:template name="escape.backslash"> |
| 216 |
<xsl:param name="content"/> |
| 217 |
<xsl:call-template name="string.subst"> |
| 218 |
<xsl:with-param name="string" select="$content"/> |
| 219 |
<xsl:with-param name="target">\</xsl:with-param> |
| 220 |
<!-- * we use "\e" instead of "\\" because the groff docs say --> |
| 221 |
<!-- * that's the correct thing to do; also because testing --> |
| 222 |
<!-- * shows that "\\" doesn't always work as expected; for --> |
| 223 |
<!-- * example, "\\" within a table seems to mess things up --> |
| 224 |
<xsl:with-param name="replacement">\e</xsl:with-param> |
| 225 |
</xsl:call-template> |
| 226 |
</xsl:template> |
| 227 |
|
| 228 |
<xsl:template name="escape.dot"> |
| 229 |
<xsl:param name="content"/> |
| 230 |
<xsl:call-template name="string.subst"> |
| 231 |
<xsl:with-param name="string" select="$content"/> |
| 232 |
<xsl:with-param name="target">.</xsl:with-param> |
| 233 |
<xsl:with-param name="replacement">\.</xsl:with-param> |
| 234 |
</xsl:call-template> |
| 235 |
</xsl:template> |
| 236 |
|
| 237 |
<xsl:template name="escape.dash"> |
| 238 |
<xsl:param name="content"/> |
| 239 |
<xsl:call-template name="string.subst"> |
| 240 |
<xsl:with-param name="string" select="$content"/> |
| 241 |
<xsl:with-param name="target">-</xsl:with-param> |
| 242 |
<xsl:with-param name="replacement">\-</xsl:with-param> |
| 243 |
</xsl:call-template> |
| 244 |
</xsl:template> |
| 245 |
|
| 246 |
<xsl:template name="escape.apostrophe"> |
| 247 |
<xsl:param name="content"/> |
| 248 |
<xsl:call-template name="string.subst"> |
| 249 |
<xsl:with-param name="string" select="$content"/> |
| 250 |
<xsl:with-param name="target">'</xsl:with-param> |
| 251 |
<xsl:with-param name="replacement">\'</xsl:with-param> |
| 252 |
</xsl:call-template> |
| 253 |
</xsl:template> |
| 254 |
|
| 255 |
<xsl:template name="convert.nobreak-space"> |
| 256 |
<xsl:param name="content"/> |
| 257 |
<xsl:call-template name="string.subst"> |
| 258 |
<xsl:with-param name="string" select="$content"/> |
| 259 |
<xsl:with-param name="target"> </xsl:with-param> |
| 260 |
<!-- * A no-break space can be written two ways in roff; the --> |
| 261 |
<!-- * difference, according to the "Page Motions" node in the --> |
| 262 |
<!-- * groff info page, is: --> |
| 263 |
<!-- * --> |
| 264 |
<!-- * "\ " = --> |
| 265 |
<!-- * An unbreakable and unpaddable (i.e. not expanded --> |
| 266 |
<!-- * during filling) space. --> |
| 267 |
<!-- * --> |
| 268 |
<!-- * "\~" = --> |
| 269 |
<!-- * An unbreakable space that stretches like a normal --> |
| 270 |
<!-- * inter-word space when a line is adjusted." --> |
| 271 |
<!-- * --> |
| 272 |
<!-- * Unfortunately, roff seems to do some weird things with --> |
| 273 |
<!-- * long lines that only have words separated by "\~" --> |
| 274 |
<!-- * spaces, so it's safer just to stick with the "\ " space --> |
| 275 |
<xsl:with-param name="replacement">\ </xsl:with-param> |
| 276 |
</xsl:call-template> |
| 277 |
</xsl:template> |
| 278 |
|
| 279 |
<!-- ==================================================================== --> |
| 280 |
|
| 281 |
<!-- * top.comment generates a comment containing metadata for the man --> |
| 282 |
<!-- * page; for example, Author, Generator, and Date information --> |
| 283 |
|
| 284 |
<xsl:template name="top.comment"> |
| 285 |
<xsl:param name="info"/> |
| 286 |
<xsl:param name="date"/> |
| 287 |
<xsl:param name="title"/> |
| 288 |
<xsl:param name="manual"/> |
| 289 |
<xsl:param name="source"/> |
| 290 |
<xsl:text>.\" Title: </xsl:text> |
| 291 |
<xsl:call-template name="replace.dots.and.dashes"> |
| 292 |
<xsl:with-param name="content" select="$title"/> |
| 293 |
</xsl:call-template> |
| 294 |
<xsl:text> </xsl:text> |
| 295 |
<xsl:text>.\" Author: </xsl:text> |
| 296 |
<xsl:call-template name="replace.dots.and.dashes"> |
| 297 |
<xsl:with-param name="content"> |
| 298 |
<xsl:call-template name="make.roff.metadata.author"> |
| 299 |
<xsl:with-param name="info" select="$info"/> |
| 300 |
</xsl:call-template> |
| 301 |
</xsl:with-param> |
| 302 |
</xsl:call-template> |
| 303 |
<xsl:text> </xsl:text> |
| 304 |
<xsl:text>.\" Generator: DocBook </xsl:text> |
| 305 |
<xsl:value-of select="$DistroTitle"/> |
| 306 |
<xsl:text> v</xsl:text> |
| 307 |
<xsl:call-template name="replace.dots.and.dashes"> |
| 308 |
<xsl:with-param name="content" select="$VERSION"/> |
| 309 |
</xsl:call-template> |
| 310 |
<xsl:text> <http://docbook.sf.net/></xsl:text> |
| 311 |
<xsl:text> </xsl:text> |
| 312 |
<xsl:text>.\" Date: </xsl:text> |
| 313 |
<xsl:call-template name="replace.dots.and.dashes"> |
| 314 |
<xsl:with-param name="content" select="$date"/> |
| 315 |
</xsl:call-template> |
| 316 |
<xsl:text> </xsl:text> |
| 317 |
<xsl:text>.\" Manual: </xsl:text> |
| 318 |
<xsl:call-template name="replace.dots.and.dashes"> |
| 319 |
<xsl:with-param name="content" select="$manual"/> |
| 320 |
</xsl:call-template> |
| 321 |
<xsl:text> </xsl:text> |
| 322 |
<xsl:text>.\" Source: </xsl:text> |
| 323 |
<xsl:call-template name="replace.dots.and.dashes"> |
| 324 |
<xsl:with-param name="content" select="$source"/> |
| 325 |
</xsl:call-template> |
| 326 |
<xsl:text> </xsl:text> |
| 327 |
<xsl:text>.\"</xsl:text> |
| 328 |
<xsl:text> </xsl:text> |
| 329 |
</xsl:template> |
| 330 |
|
| 331 |
<!-- ==================================================================== --> |
| 332 |
|
| 333 |
<xsl:template name="TH.title.line"> |
| 334 |
|
| 335 |
<!-- * The exact way that .TH contents are displayed is system- --> |
| 336 |
<!-- * dependent; it varies somewhat between OSes and roff --> |
| 337 |
<!-- * versions. Below is a description of how Linux systems with --> |
| 338 |
<!-- * a modern groff seem to render .TH contents. --> |
| 339 |
<!-- * --> |
| 340 |
<!-- * title(section) extra3 title(section) <- page header --> |
| 341 |
<!-- * extra2 extra1 title(section) <- page footer--> |
| 342 |
<!-- * --> |
| 343 |
<!-- * Or, using the names with which the man(7) man page refers --> |
| 344 |
<!-- * to the various fields: --> |
| 345 |
<!-- * --> |
| 346 |
<!-- * title(section) manual title(section) <- page header --> |
| 347 |
<!-- * source date title(section) <- page footer--> |
| 348 |
<!-- * --> |
| 349 |
<!-- * Note that while extra1, extra2, and extra3 are all (nominally) --> |
| 350 |
<!-- * optional, in practice almost all pages include an "extra1" --> |
| 351 |
<!-- * field, which is, universally, a date (in some form), and it is --> |
| 352 |
<!-- * always rendered in the same place (the middle footer position) --> |
| 353 |
<!-- * --> |
| 354 |
<!-- * Here are a couple of examples of real-world man pages that --> |
| 355 |
<!-- * have somewhat useful page headers/footers: --> |
| 356 |
<!-- * --> |
| 357 |
<!-- * gtk-options(7) GTK+ User's Manual gtk-options(7) --> |
| 358 |
<!-- * GTK+ 1.2 2003-10-20 gtk-options(7) --> |
| 359 |
<!-- * --> |
| 360 |
<!-- * svgalib(7) Svgalib User Manual svgalib(7) --> |
| 361 |
<!-- * Svgalib 1.4.1 16 December 1999 svgalib(7) --> |
| 362 |
<!-- * --> |
| 363 |
<xsl:param name="title"/> |
| 364 |
<xsl:param name="section"/> |
| 365 |
<xsl:param name="extra1"/> |
| 366 |
<xsl:param name="extra2"/> |
| 367 |
<xsl:param name="extra3"/> |
| 368 |
|
| 369 |
<xsl:call-template name="mark.subheading"/> |
| 370 |
<!-- * Note that we generate quotes around _every_ field in the --> |
| 371 |
<!-- * .TH title line, including the "title" and "section" --> |
| 372 |
<!-- * fields. That is because we use the contents of those "as --> |
| 373 |
<!-- * is", unchanged from the DocBook source; and DTD-based --> |
| 374 |
<!-- * validation does not provide a way to constrain them to be --> |
| 375 |
<!-- * "space free" --> |
| 376 |
<xsl:text>.TH "</xsl:text> |
| 377 |
<xsl:call-template name="string.upper"> |
| 378 |
<xsl:with-param name="string"> |
| 379 |
<xsl:choose> |
| 380 |
<xsl:when test="$man.th.title.max.length != ''"> |
| 381 |
<xsl:value-of |
| 382 |
select="normalize-space(substring($title, 1, $man.th.title.max.length))"/> |
| 383 |
</xsl:when> |
| 384 |
<xsl:otherwise> |
| 385 |
<xsl:value-of select="normalize-space($title)"/> |
| 386 |
</xsl:otherwise> |
| 387 |
</xsl:choose> |
| 388 |
</xsl:with-param> |
| 389 |
</xsl:call-template> |
| 390 |
<xsl:text>" "</xsl:text> |
| 391 |
<xsl:value-of select="normalize-space($section)"/> |
| 392 |
<xsl:text>" "</xsl:text> |
| 393 |
<xsl:if test="$man.th.extra1.suppress = 0"> |
| 394 |
<!-- * there is no max.length for the extra1 field; the reason --> |
| 395 |
<!-- * is, it is almost always a date, and it is not possible --> |
| 396 |
<!-- * to truncate dates without changing their meaning --> |
| 397 |
<xsl:value-of select="normalize-space($extra1)"/> |
| 398 |
</xsl:if> |
| 399 |
<xsl:text>" "</xsl:text> |
| 400 |
<xsl:if test="$man.th.extra2.suppress = 0"> |
| 401 |
<xsl:choose> |
| 402 |
<!-- * if max.length is non-empty, use value to truncate field --> |
| 403 |
<xsl:when test="$man.th.extra2.max.length != ''"> |
| 404 |
<xsl:value-of |
| 405 |
select="normalize-space(substring($extra2, 1, $man.th.extra2.max.length))"/> |
| 406 |
</xsl:when> |
| 407 |
<xsl:otherwise> |
| 408 |
<xsl:value-of select="normalize-space($extra2)"/> |
| 409 |
</xsl:otherwise> |
| 410 |
</xsl:choose> |
| 411 |
</xsl:if> |
| 412 |
<xsl:text>" "</xsl:text> |
| 413 |
<xsl:if test="$man.th.extra3.suppress = 0"> |
| 414 |
<xsl:choose> |
| 415 |
<!-- * if max.length is non-empty, use value to truncate field --> |
| 416 |
<xsl:when test="$man.th.extra3.max.length != ''"> |
| 417 |
<xsl:value-of |
| 418 |
select="normalize-space(substring($extra3, 1, $man.th.extra3.max.length))"/> |
| 419 |
</xsl:when> |
| 420 |
<xsl:otherwise> |
| 421 |
<xsl:value-of select="normalize-space($extra3)"/> |
| 422 |
</xsl:otherwise> |
| 423 |
</xsl:choose> |
| 424 |
</xsl:if> |
| 425 |
<xsl:text>" </xsl:text> |
| 426 |
<xsl:call-template name="mark.subheading"/> |
| 427 |
</xsl:template> |
| 428 |
|
| 429 |
<!-- ============================================================== --> |
| 430 |
|
| 431 |
<xsl:template name="set.default.formatting"> |
| 432 |
<!-- * Set default hyphenation, justification, indentation and --> |
| 433 |
<!-- * line-breaking --> |
| 434 |
<!-- * --> |
| 435 |
<!-- * If the value of man.hypenate is zero (the default), then --> |
| 436 |
<!-- * disable hyphenation (".nh" = "no hyphenation") --> |
| 437 |
<xsl:if test="$man.hyphenate = 0"> |
| 438 |
<xsl:text>.\" disable hyphenation </xsl:text> |
| 439 |
<xsl:text>.nh </xsl:text> |
| 440 |
</xsl:if> |
| 441 |
<!-- * If the value of man.justify is zero (the default), then --> |
| 442 |
<!-- * disable justification (".ad l" means "adjust to left only") --> |
| 443 |
<xsl:if test="$man.justify = 0"> |
| 444 |
<xsl:text>.\" disable justification</xsl:text> |
| 445 |
<xsl:text> (adjust text to left margin only) </xsl:text> |
| 446 |
<xsl:text>.ad l </xsl:text> |
| 447 |
</xsl:if> |
| 448 |
<xsl:if test="not($man.indent.refsect = 0)"> |
| 449 |
<xsl:text>.\" store initial "default indentation value" </xsl:text> |
| 450 |
<xsl:text>.nr zq \n(IN </xsl:text> |
| 451 |
<xsl:text>.\" adjust default indentation </xsl:text> |
| 452 |
<xsl:text>.nr IN </xsl:text> |
| 453 |
<xsl:value-of select="$man.indent.width"/> |
| 454 |
<xsl:text> </xsl:text> |
| 455 |
<xsl:text>.\" adjust indentation of SS headings </xsl:text> |
| 456 |
<xsl:text>.nr SN \n(IN </xsl:text> |
| 457 |
</xsl:if> |
| 458 |
<!-- * Unless the value of man.break.after.slash is zero (the --> |
| 459 |
<!-- * default), tell groff that it is OK to break a line --> |
| 460 |
<!-- * after a slash when needed. --> |
| 461 |
<xsl:if test="$man.break.after.slash != 0"> |
| 462 |
<xsl:text>.\" enable line breaks after slashes </xsl:text> |
| 463 |
<xsl:text>.cflags 4 / </xsl:text> |
| 464 |
</xsl:if> |
| 465 |
</xsl:template> |
| 466 |
|
| 467 |
<!-- ================================================================== --> |
| 468 |
|
| 469 |
<!-- * The prepare.manpage.contents template is called after all --> |
| 470 |
<!-- * other processing has been done, before serializing the --> |
| 471 |
<!-- * result of all the other processing. It basically works on --> |
| 472 |
<!-- * the result as one big string. --> |
| 473 |
<xsl:template name="prepare.manpage.contents"> |
| 474 |
<xsl:param name="content" select="''"/> |
| 475 |
|
| 476 |
<!-- * If user has provided a "local" string-substitution map to --> |
| 477 |
<!-- * be applied /before/ the standard string-substitution map, --> |
| 478 |
<!-- * apply it. --> |
| 479 |
<xsl:variable name="pre.adjusted.content"> |
| 480 |
<xsl:choose> |
| 481 |
<xsl:when test="$man.string.subst.map.local.pre"> |
| 482 |
<!-- * normalized value of man.string.subst.map.local.pre --> |
| 483 |
<!-- * is non-empty, so get contents of map and apply them --> |
| 484 |
<xsl:call-template name="apply-string-subst-map"> |
| 485 |
<xsl:with-param name="content" select="$content"/> |
| 486 |
<xsl:with-param name="map.contents" |
| 487 |
select="exsl:node-set($man.string.subst.map.local.pre)/*"/> |
| 488 |
</xsl:call-template> |
| 489 |
</xsl:when> |
| 490 |
<xsl:otherwise> |
| 491 |
<!-- * value of man.string.subst.map.local.pre is empty, --> |
| 492 |
<!-- * so just copy original contents --> |
| 493 |
<xsl:value-of select="$content"/> |
| 494 |
</xsl:otherwise> |
| 495 |
</xsl:choose> |
| 496 |
</xsl:variable> |
| 497 |
|
| 498 |
<!-- * Apply standard string-substitution map. The main purpose --> |
| 499 |
<!-- * of this map is to escape certain characters that have --> |
| 500 |
<!-- * special meaning in roff, and to replace certain characters --> |
| 501 |
<!-- * used within the stylesheet internally to represent roff --> |
| 502 |
<!-- * markup characters. --> |
| 503 |
<xsl:variable name="adjusted.content"> |
| 504 |
<xsl:call-template name="apply-string-subst-map"> |
| 505 |
<xsl:with-param name="content" select="$pre.adjusted.content"/> |
| 506 |
<xsl:with-param name="map.contents" |
| 507 |
select="exsl:node-set($man.string.subst.map)/*"/> |
| 508 |
</xsl:call-template> |
| 509 |
</xsl:variable> |
| 510 |
|
| 511 |
<!-- * If user has provided a "local" string-substitution map to --> |
| 512 |
<!-- * be applied /after/ the standard string-substitution map, --> |
| 513 |
<!-- * apply it. --> |
| 514 |
<xsl:variable name="post.adjusted.content"> |
| 515 |
<xsl:choose> |
| 516 |
<xsl:when test="$man.string.subst.map.local.post"> |
| 517 |
<!-- * normalized value of man.string.subst.map.local.post --> |
| 518 |
<!-- * is non-empty, so get contents of map and apply them --> |
| 519 |
<xsl:call-template name="apply-string-subst-map"> |
| 520 |
<xsl:with-param name="content" select="$adjusted.content"/> |
| 521 |
<xsl:with-param name="map.contents" |
| 522 |
select="exsl:node-set($man.string.subst.map.local.post)/*"/> |
| 523 |
</xsl:call-template> |
| 524 |
</xsl:when> |
| 525 |
<xsl:otherwise> |
| 526 |
<!-- * value of man.string.subst.map.local.post is empty, --> |
| 527 |
<!-- * so just copy original contents --> |
| 528 |
<xsl:value-of select="$adjusted.content"/> |
| 529 |
</xsl:otherwise> |
| 530 |
</xsl:choose> |
| 531 |
</xsl:variable> |
| 532 |
|
| 533 |
<!-- * Optionally, apply a character map to replace Unicode --> |
| 534 |
<!-- * symbols and special characters. --> |
| 535 |
<xsl:choose> |
| 536 |
<xsl:when test="$man.charmap.enabled != 0"> |
| 537 |
<xsl:call-template name="apply-character-map"> |
| 538 |
<xsl:with-param name="content" select="$post.adjusted.content"/> |
| 539 |
<xsl:with-param name="map.contents" |
| 540 |
select="exsl:node-set($man.charmap.contents)/*"/> |
| 541 |
</xsl:call-template> |
| 542 |
</xsl:when> |
| 543 |
<xsl:otherwise> |
| 544 |
<!-- * if we reach here, value of $man.charmap.enabled is zero, --> |
| 545 |
<!-- * so we just pass the adjusted contents through "as is" --> |
| 546 |
<xsl:value-of select="$adjusted.content"/> |
| 547 |
</xsl:otherwise> |
| 548 |
</xsl:choose> |
| 549 |
</xsl:template> |
| 550 |
|
| 551 |
<!-- ================================================================== --> |
| 552 |
|
| 553 |
<xsl:template name="write.man.file"> |
| 554 |
<xsl:param name="name"/> |
| 555 |
<xsl:param name="section"/> |
| 556 |
<xsl:param name="lang"/> |
| 557 |
<xsl:param name="content"/> |
| 558 |
<xsl:param name="filename"> |
| 559 |
<xsl:call-template name="make.adjusted.man.filename"> |
| 560 |
<xsl:with-param name="name" select="$name"/> |
| 561 |
<xsl:with-param name="section" select="$section"/> |
| 562 |
<xsl:with-param name="lang" select="$lang"/> |
| 563 |
</xsl:call-template> |
| 564 |
</xsl:param> |
| 565 |
<xsl:call-template name="write.text.chunk"> |
| 566 |
<xsl:with-param name="filename" select="$filename"/> |
| 567 |
<xsl:with-param name="suppress-context-node-name" select="1"/> |
| 568 |
<xsl:with-param name="quiet" select="$man.output.quietly"/> |
| 569 |
<xsl:with-param |
| 570 |
name="message-prolog" |
| 571 |
>Note: </xsl:with-param> |
| 572 |
<xsl:with-param name="encoding" select="$man.output.encoding"/> |
| 573 |
<xsl:with-param name="content" select="$content"/> |
| 574 |
</xsl:call-template> |
| 575 |
</xsl:template> |
| 576 |
|
| 577 |
<!-- ============================================================== --> |
| 578 |
|
| 579 |
<!-- * A "stub" is sort of alias for another file, intended to be read --> |
| 580 |
<!-- * and expanded by soelim(1); it's simply a file whose complete --> |
| 581 |
<!-- * contents are just a single line of the following form: --> |
| 582 |
<!-- * --> |
| 583 |
<!-- * .so manX/realname.X --> |
| 584 |
<!-- * --> |
| 585 |
<!-- * "realname" is a name of another man-page file. That .so line is --> |
| 586 |
<!-- * basically a roff "include" statement. When the man command finds --> |
| 587 |
<!-- * it, it calls soelim(1) and includes and displays the contents of --> |
| 588 |
<!-- * the manX/realqname.X file. --> |
| 589 |
<!-- * --> |
| 590 |
<!-- * If a refentry has multiple refnames, we generate a "stub" page for --> |
| 591 |
<!-- * each refname found, except for the first one. --> |
| 592 |
<xsl:template name="write.stubs"> |
| 593 |
<xsl:param name="first.refname"/> |
| 594 |
<xsl:param name="section"/> |
| 595 |
<xsl:param name="lang"/> |
| 596 |
<xsl:for-each select="refnamediv/refname"> |
| 597 |
<xsl:if test=". != $first.refname"> |
| 598 |
<xsl:call-template name="write.text.chunk"> |
| 599 |
<xsl:with-param name="filename"> |
| 600 |
<xsl:call-template name="make.adjusted.man.filename"> |
| 601 |
<xsl:with-param name="name"> |
| 602 |
<xsl:apply-templates/> |
| 603 |
</xsl:with-param> |
| 604 |
<xsl:with-param name="section" select="$section"/> |
| 605 |
<xsl:with-param name="lang" select="$lang"/> |
| 606 |
</xsl:call-template> |
| 607 |
</xsl:with-param> |
| 608 |
<xsl:with-param name="quiet" select="$man.output.quietly"/> |
| 609 |
<xsl:with-param name="suppress-context-node-name" select="1"/> |
| 610 |
<xsl:with-param name="message-prolog">Note: </xsl:with-param> |
| 611 |
<xsl:with-param name="message-epilog"> (soelim stub)</xsl:with-param> |
| 612 |
<xsl:with-param name="content"> |
| 613 |
<xsl:value-of select="concat('.so man', $section, '/')"/> |
| 614 |
<xsl:call-template name="make.adjusted.man.filename"> |
| 615 |
<xsl:with-param name="name" select="$first.refname"/> |
| 616 |
<xsl:with-param name="section" select="$section"/> |
| 617 |
</xsl:call-template> |
| 618 |
<xsl:text> </xsl:text> |
| 619 |
</xsl:with-param> |
| 620 |
</xsl:call-template> |
| 621 |
</xsl:if> |
| 622 |
</xsl:for-each> |
| 623 |
</xsl:template> |
| 624 |
|
| 625 |
<!-- ============================================================== --> |
| 626 |
|
| 627 |
<!-- * A manifest file is useful for doing "make clean" during --> |
| 628 |
<!-- * builds and for other purposes. When we make the manifest --> |
| 629 |
<!-- * file, we need to include in it a filename for each man-page --> |
| 630 |
<!-- * generated, including any "stub" pages. --> |
| 631 |
<xsl:template name="generate.manifest"> |
| 632 |
<xsl:variable name="filelist"> |
| 633 |
<xsl:for-each select="//refentry"> |
| 634 |
<!-- * all refname instances in a Refentry inherit their section --> |
| 635 |
<!-- * numbers from the parent Refentry; so we only need to get --> |
| 636 |
<!-- * the section once per Refentry, not once per Refname --> |
| 637 |
<xsl:variable name="section"> |
| 638 |
<xsl:call-template name="get.refentry.section"> |
| 639 |
<xsl:with-param name="quiet" select="1"/> |
| 640 |
</xsl:call-template> |
| 641 |
</xsl:variable> |
| 642 |
<xsl:variable name="lang"> |
| 643 |
<xsl:call-template name="l10n.language"/> |
| 644 |
</xsl:variable> |
| 645 |
<xsl:for-each select="refnamediv/refname"> |
| 646 |
<xsl:call-template name="make.adjusted.man.filename"> |
| 647 |
<xsl:with-param name="name" select="."/> |
| 648 |
<xsl:with-param name="section" select="$section"/> |
| 649 |
<xsl:with-param name="lang" select="$lang"/> |
| 650 |
</xsl:call-template> |
| 651 |
<xsl:text> </xsl:text> |
| 652 |
</xsl:for-each> |
| 653 |
</xsl:for-each> |
| 654 |
</xsl:variable> |
| 655 |
|
| 656 |
<!-- * we write the manifest file once per document, not once per --> |
| 657 |
<!-- * Refentry --> |
| 658 |
<xsl:call-template name="write.text.chunk"> |
| 659 |
<xsl:with-param name="filename"> |
| 660 |
<xsl:value-of select="$man.output.manifest.filename"/> |
| 661 |
</xsl:with-param> |
| 662 |
<xsl:with-param name="quiet" select="1"/> |
| 663 |
<xsl:with-param name="message-prolog">Note: </xsl:with-param> |
| 664 |
<xsl:with-param name="message-epilog"> (manifest file)</xsl:with-param> |
| 665 |
<xsl:with-param name="content"> |
| 666 |
<xsl:value-of select="$filelist"/> |
| 667 |
</xsl:with-param> |
| 668 |
</xsl:call-template> |
| 669 |
<xsl:if test="$man.output.quietly = 0"> |
| 670 |
<xsl:message><xsl:text> </xsl:text></xsl:message> |
| 671 |
</xsl:if> |
| 672 |
</xsl:template> |
| 673 |
|
| 674 |
</xsl:stylesheet> |