[15c7d39] | 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:dyn="http://exslt.org/dynamic"
|
---|
| 5 | xmlns:saxon="http://icl.com/saxon"
|
---|
| 6 | exclude-result-prefixes="exsl dyn saxon"
|
---|
| 7 | version='1.0'>
|
---|
| 8 |
|
---|
| 9 | <!-- ********************************************************************
|
---|
| 10 | $Id: utility.xsl 9703 2013-01-07 20:13:05Z bobstayton $
|
---|
| 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 | <!-- ==================================================================== -->
|
---|
| 20 |
|
---|
| 21 | <!-- * This file contains "utility" templates that are called multiple -->
|
---|
| 22 | <!-- * times per each Refentry. -->
|
---|
| 23 |
|
---|
| 24 | <!-- ==================================================================== -->
|
---|
| 25 |
|
---|
| 26 | <!-- * NOTE TO DEVELOPERS: For ease of maintenance, the current -->
|
---|
| 27 | <!-- * manpages stylesheets use the "bold" and "italic" named -->
|
---|
| 28 | <!-- * templates for anything and everything that needs to get -->
|
---|
| 29 | <!-- * boldfaced or italicized. -->
|
---|
| 30 | <!-- * -->
|
---|
| 31 | <!-- * So if you add anything that needs bold or italic character -->
|
---|
| 32 | <!-- * formatting, try to apply these templates to it rather than -->
|
---|
| 33 | <!-- * writing separate code to format it. This can be a little odd if -->
|
---|
| 34 | <!-- * the content you want to format is not element content; in those -->
|
---|
| 35 | <!-- * cases, you need to turn it into element content before applying -->
|
---|
| 36 | <!-- * the template; see examples of this in the existing code. -->
|
---|
| 37 |
|
---|
| 38 | <xsl:template name="bold">
|
---|
| 39 | <xsl:param name="node"/>
|
---|
| 40 | <xsl:param name="context"/>
|
---|
| 41 | <xsl:choose>
|
---|
| 42 | <xsl:when test="not($context[ancestor::title])">
|
---|
| 43 | <xsl:for-each select="$node/node()">
|
---|
| 44 | <xsl:text>\fB</xsl:text>
|
---|
| 45 | <xsl:apply-templates select="."/>
|
---|
| 46 | <xsl:text>\fR</xsl:text>
|
---|
| 47 | </xsl:for-each>
|
---|
| 48 | </xsl:when>
|
---|
| 49 | <xsl:otherwise>
|
---|
| 50 | <xsl:apply-templates select="$node/node()"/>
|
---|
| 51 | </xsl:otherwise>
|
---|
| 52 | </xsl:choose>
|
---|
| 53 | </xsl:template>
|
---|
| 54 |
|
---|
| 55 | <xsl:template name="italic">
|
---|
| 56 | <xsl:param name="node"/>
|
---|
| 57 | <xsl:param name="context"/>
|
---|
| 58 | <xsl:for-each select="$node/node()">
|
---|
| 59 | <xsl:text>\fI</xsl:text>
|
---|
| 60 | <xsl:apply-templates select="."/>
|
---|
| 61 | <xsl:text>\fR</xsl:text>
|
---|
| 62 | </xsl:for-each>
|
---|
| 63 | </xsl:template>
|
---|
| 64 |
|
---|
| 65 | <xsl:template name="inline.monoseq">
|
---|
| 66 | <xsl:param name="content">
|
---|
| 67 | <xsl:apply-templates/>
|
---|
| 68 | </xsl:param>
|
---|
| 69 | <xsl:call-template name="code-inline-start"/>
|
---|
| 70 | <xsl:copy-of select="$content"/>
|
---|
| 71 | <xsl:call-template name="code-inline-end"/>
|
---|
| 72 | </xsl:template>
|
---|
| 73 |
|
---|
| 74 | <xsl:template name="code-inline-start">
|
---|
| 75 | <xsl:if test="not($man.output.better.ps.enabled = 0)">
|
---|
| 76 | <xsl:text>\FC</xsl:text>
|
---|
| 77 | </xsl:if>
|
---|
| 78 | </xsl:template>
|
---|
| 79 |
|
---|
| 80 | <xsl:template name="code-inline-end">
|
---|
| 81 | <xsl:if test="not($man.output.better.ps.enabled = 0)">
|
---|
| 82 | <xsl:text>\F[]</xsl:text>
|
---|
| 83 | </xsl:if>
|
---|
| 84 | </xsl:template>
|
---|
| 85 |
|
---|
| 86 | <!-- ================================================================== -->
|
---|
| 87 |
|
---|
| 88 | <xsl:template name="verbatim-block-start">
|
---|
| 89 | <xsl:if test="not($man.output.better.ps.enabled = 0)">
|
---|
| 90 | <xsl:text>.fam C </xsl:text>
|
---|
| 91 | <xsl:text>.ps -1 </xsl:text>
|
---|
| 92 | </xsl:if>
|
---|
| 93 | </xsl:template>
|
---|
| 94 |
|
---|
| 95 | <xsl:template name="verbatim-block-end">
|
---|
| 96 | <xsl:if test="not($man.output.better.ps.enabled = 0)">
|
---|
| 97 | <xsl:text>.fam </xsl:text>
|
---|
| 98 | <xsl:text>.ps +1 </xsl:text>
|
---|
| 99 | </xsl:if>
|
---|
| 100 | </xsl:template>
|
---|
| 101 |
|
---|
| 102 | <xsl:template name="synopsis-block-start">
|
---|
| 103 | <xsl:if test="not($man.output.better.ps.enabled = 0)">
|
---|
| 104 | <xsl:text>.fam C </xsl:text>
|
---|
| 105 | </xsl:if>
|
---|
| 106 | </xsl:template>
|
---|
| 107 |
|
---|
| 108 | <xsl:template name="synopsis-block-end">
|
---|
| 109 | <xsl:if test="not($man.output.better.ps.enabled = 0)">
|
---|
| 110 | <xsl:text>.fam </xsl:text>
|
---|
| 111 | </xsl:if>
|
---|
| 112 | </xsl:template>
|
---|
| 113 |
|
---|
| 114 | <!-- ================================================================== -->
|
---|
| 115 |
|
---|
| 116 | <!-- * NOTE TO DEVELOPERS: For ease of maintenance, the current -->
|
---|
| 117 | <!-- * manpages stylesheets use the mode="prevent.line.breaking" -->
|
---|
| 118 | <!-- * templates for anything and everything that needs to have -->
|
---|
| 119 | <!-- * embedded spaces turned into no-break spaces in output - in -->
|
---|
| 120 | <!-- * order to prevent that output from getting broken across lines -->
|
---|
| 121 | <!-- * -->
|
---|
| 122 | <!-- * So if you add anything that whose output, try to apply this -->
|
---|
| 123 | <!-- * template to it rather than writing separate code to format -->
|
---|
| 124 | <!-- * it. This can be a little odd if the content you want to -->
|
---|
| 125 | <!-- * format is not element content; in those cases, you need to -->
|
---|
| 126 | <!-- * turn it into element content before applying the template; -->
|
---|
| 127 | <!-- * see examples of this in the existing code. -->
|
---|
| 128 | <!-- * -->
|
---|
| 129 | <!-- * This template is currently called by the funcdef and paramdef -->
|
---|
| 130 | <!-- * and group/arg templates. -->
|
---|
| 131 | <xsl:template mode="prevent.line.breaking" match="*">
|
---|
| 132 | <xsl:variable name="rcontent">
|
---|
| 133 | <xsl:apply-templates/>
|
---|
| 134 | </xsl:variable>
|
---|
| 135 | <xsl:variable name="content">
|
---|
| 136 | <xsl:value-of select="normalize-space($rcontent)"/>
|
---|
| 137 | </xsl:variable>
|
---|
| 138 | <xsl:call-template name="string.subst">
|
---|
| 139 | <xsl:with-param name="string" select="$content"/>
|
---|
| 140 | <xsl:with-param name="target" select="' '"/>
|
---|
| 141 | <!-- * U+2580 is a "UPPER HALF BLOCK"; we use it here because -->
|
---|
| 142 | <!-- * if we were to just use a normal space, it would get -->
|
---|
| 143 | <!-- * replaced when normalization is done. We replace it -->
|
---|
| 144 | <!-- * later with the groff markup for non-breaking space. -->
|
---|
| 145 | <xsl:with-param name="replacement" select="'▀'"/>
|
---|
| 146 | </xsl:call-template>
|
---|
| 147 | </xsl:template>
|
---|
| 148 |
|
---|
| 149 | <!-- ================================================================== -->
|
---|
| 150 |
|
---|
| 151 | <xsl:template name="suppress.hyphenation">
|
---|
| 152 | <!-- * we need to suppress hyphenation inline only if hyphenation is -->
|
---|
| 153 | <!-- * actually on, and even then only outside of Cmdsynopsis and -->
|
---|
| 154 | <!-- * Funcsynopsis, where it is already always turned off -->
|
---|
| 155 | <xsl:if test="$man.hyphenate != 0 and
|
---|
| 156 | not(ancestor::cmdsynopsis) and
|
---|
| 157 | not(ancestor::funcsynopsis)">
|
---|
| 158 | <xsl:text>\%</xsl:text>
|
---|
| 159 | </xsl:if>
|
---|
| 160 | </xsl:template>
|
---|
| 161 |
|
---|
| 162 | <!-- ================================================================== -->
|
---|
| 163 |
|
---|
| 164 | <!-- * The replace.dots.and.dashes template is used to cause real -->
|
---|
| 165 | <!-- * dots and dashes to be output in the top comment (instead of -->
|
---|
| 166 | <!-- * escaped ones as in the source for the text displayed in the -->
|
---|
| 167 | <!-- * body of the page) -->
|
---|
| 168 | <xsl:template name="replace.dots.and.dashes">
|
---|
| 169 | <xsl:param name="content">
|
---|
| 170 | <xsl:apply-templates/>
|
---|
| 171 | </xsl:param>
|
---|
| 172 | <xsl:variable name="dot-content">
|
---|
| 173 | <xsl:call-template name="string.subst">
|
---|
| 174 | <xsl:with-param name="string" select="$content"/>
|
---|
| 175 | <xsl:with-param name="target" select="'\&.'"/>
|
---|
| 176 | <xsl:with-param name="replacement" select="'.'"/>
|
---|
| 177 | </xsl:call-template>
|
---|
| 178 | </xsl:variable>
|
---|
| 179 | <xsl:call-template name="string.subst">
|
---|
| 180 | <xsl:with-param name="string" select="$dot-content"/>
|
---|
| 181 | <xsl:with-param name="target" select="'\-'"/>
|
---|
| 182 | <xsl:with-param name="replacement" select="'-'"/>
|
---|
| 183 | </xsl:call-template>
|
---|
| 184 | </xsl:template>
|
---|
| 185 |
|
---|
| 186 | <!-- ================================================================== -->
|
---|
| 187 |
|
---|
| 188 | <!-- * The nested-section-title template is called for refsect3, and any -->
|
---|
| 189 | <!-- * refsection nested more than 2 levels deep. -->
|
---|
| 190 | <xsl:template name="nested-section-title">
|
---|
| 191 | <xsl:text>.sp </xsl:text>
|
---|
| 192 | <xsl:call-template name="pinch.together"/>
|
---|
| 193 | <xsl:text>.ps +1 </xsl:text>
|
---|
| 194 | <xsl:call-template name="make.bold.title"/>
|
---|
| 195 | </xsl:template>
|
---|
| 196 |
|
---|
| 197 | <xsl:template name="pinch.together">
|
---|
| 198 | <!-- * arcane roff code to suppress line spacing after headings -->
|
---|
| 199 | <xsl:text>.it 1 an-trap </xsl:text>
|
---|
| 200 | <xsl:text>.nr an-no-space-flag 1 </xsl:text>
|
---|
| 201 | <xsl:text>.nr an-break-flag 1 </xsl:text>
|
---|
| 202 | <xsl:text>.br </xsl:text>
|
---|
| 203 | </xsl:template>
|
---|
| 204 |
|
---|
| 205 | <xsl:template name="make.bold.title">
|
---|
| 206 | <!-- * make title wrapper so that we can use "bold" template to apply -->
|
---|
| 207 | <!-- * character formatting to it -->
|
---|
| 208 | <xsl:variable name="title.wrapper">
|
---|
| 209 | <xsl:choose>
|
---|
| 210 | <xsl:when test="title">
|
---|
| 211 | <xsl:value-of select="normalize-space(title[1])"/>
|
---|
| 212 | </xsl:when>
|
---|
| 213 | <xsl:otherwise>
|
---|
| 214 | <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
|
---|
| 215 | </xsl:otherwise>
|
---|
| 216 | </xsl:choose>
|
---|
| 217 | </xsl:variable>
|
---|
| 218 | <xsl:call-template name="mark.subheading"/>
|
---|
| 219 | <xsl:call-template name="bold">
|
---|
| 220 | <xsl:with-param name="node" select="exsl:node-set($title.wrapper)"/>
|
---|
| 221 | <xsl:with-param name="context" select="."/>
|
---|
| 222 | </xsl:call-template>
|
---|
| 223 | <xsl:text> </xsl:text>
|
---|
| 224 | <xsl:call-template name="mark.subheading"/>
|
---|
| 225 | </xsl:template>
|
---|
| 226 |
|
---|
| 227 | <!-- ================================================================== -->
|
---|
| 228 |
|
---|
| 229 | <!-- * The mixed-block template jumps through a few hoops to deal with -->
|
---|
| 230 | <!-- * mixed-content blocks, so that we don't end up munging verbatim -->
|
---|
| 231 | <!-- * environments or lists and so that we don't gobble up whitespace -->
|
---|
| 232 | <!-- * when we shouldn't -->
|
---|
| 233 | <xsl:template name="mixed-block">
|
---|
| 234 | <xsl:for-each select="node()">
|
---|
| 235 | <xsl:choose>
|
---|
| 236 | <!-- * Check to see if this node is a verbatim environment. -->
|
---|
| 237 | <!-- * If so, put a line of space before it. -->
|
---|
| 238 | <!-- * -->
|
---|
| 239 | <!-- * Yes, address and synopsis are vertabim environments. -->
|
---|
| 240 | <!-- * -->
|
---|
| 241 | <!-- * The code here previously also treated informaltable as a -->
|
---|
| 242 | <!-- * verbatim, presumably to support some kludge; I removed it -->
|
---|
| 243 | <xsl:when test="self::address|self::literallayout|self::programlisting|
|
---|
| 244 | self::screen|self::synopsis">
|
---|
| 245 | <xsl:text> </xsl:text>
|
---|
| 246 | <xsl:text>.sp </xsl:text>
|
---|
| 247 | <xsl:call-template name="mark.up.block.start"/>
|
---|
| 248 | <xsl:apply-templates select="."/>
|
---|
| 249 | </xsl:when>
|
---|
| 250 | <!-- * Check to see if this node is a list; if it is, we don't -->
|
---|
| 251 | <!-- * want to normalize-space(), so we just apply-templates. -->
|
---|
| 252 | <!-- * Do same for all admonitions -->
|
---|
| 253 | <xsl:when test="(self::itemizedlist|self::orderedlist|
|
---|
| 254 | self::variablelist|self::glosslist|
|
---|
| 255 | self::simplelist[@type !='inline']|
|
---|
| 256 | self::segmentedlist|
|
---|
| 257 | self::caution|self::important|
|
---|
| 258 | self::note|self::tip|self::warning|
|
---|
| 259 | self::table|self::informaltable)">
|
---|
| 260 | <xsl:call-template name="mark.up.block.start"/>
|
---|
| 261 | <xsl:apply-templates select="."/>
|
---|
| 262 | </xsl:when>
|
---|
| 263 | <xsl:when test="self::text()">
|
---|
| 264 | <!-- * Check to see if this is a text node. -->
|
---|
| 265 | <!-- * -->
|
---|
| 266 | <!-- * If so, replace all whitespace at the beginning or end of it -->
|
---|
| 267 | <!-- * with a single linebreak. -->
|
---|
| 268 | <!-- * -->
|
---|
| 269 | <xsl:variable name="content">
|
---|
| 270 | <xsl:apply-templates select="."/>
|
---|
| 271 | </xsl:variable>
|
---|
| 272 | <xsl:if
|
---|
| 273 | test="starts-with(translate(.,'	 ',' '), ' ')
|
---|
| 274 | and preceding-sibling::node()[1][name(.)!='']
|
---|
| 275 | and normalize-space($content) != ''
|
---|
| 276 | and not(
|
---|
| 277 | preceding-sibling::*[1][
|
---|
| 278 | self::caution or
|
---|
| 279 | self::important or
|
---|
| 280 | self::note or
|
---|
| 281 | self::tip or
|
---|
| 282 | self::warning or
|
---|
| 283 | self::variablelist or
|
---|
| 284 | self::glosslist or
|
---|
| 285 | self::itemizedlist or
|
---|
| 286 | self::orderedlist or
|
---|
| 287 | self::segmentedlist or
|
---|
| 288 | self::procedure or
|
---|
| 289 | self::address or
|
---|
| 290 | self::literallayout or
|
---|
| 291 | self::programlisting or
|
---|
| 292 | self::synopsis or
|
---|
| 293 | self::screen or
|
---|
| 294 | self::table or
|
---|
| 295 | self::informaltable
|
---|
| 296 | ]
|
---|
| 297 | )
|
---|
| 298 | ">
|
---|
| 299 | <xsl:text> </xsl:text>
|
---|
| 300 | </xsl:if>
|
---|
| 301 | <xsl:value-of select="normalize-space($content)"/>
|
---|
| 302 | <xsl:if
|
---|
| 303 | test="(translate(substring(., string-length(.), 1),'	 ',' ') = ' '
|
---|
| 304 | and following-sibling::node()[1][name(.)!=''])
|
---|
| 305 | or following-sibling::node()[1][self::comment()]
|
---|
| 306 | or following-sibling::node()[1][self::processing-instruction()]
|
---|
| 307 | ">
|
---|
| 308 | <xsl:if test="normalize-space($content) != ''
|
---|
| 309 | or concat(normalize-space($content), ' ') != ' '">
|
---|
| 310 | <xsl:text> </xsl:text>
|
---|
| 311 | </xsl:if>
|
---|
| 312 | </xsl:if>
|
---|
| 313 | </xsl:when>
|
---|
| 314 | <xsl:otherwise>
|
---|
| 315 | <!-- * At this point, we know that this node is not a verbatim -->
|
---|
| 316 | <!-- * environment, list, admonition, or text node; so we can -->
|
---|
| 317 | <!-- * safely normalize-space() it. -->
|
---|
| 318 | <xsl:variable name="content">
|
---|
| 319 | <xsl:apply-templates select="."/>
|
---|
| 320 | </xsl:variable>
|
---|
| 321 | <xsl:value-of select="normalize-space($content)"/>
|
---|
| 322 | </xsl:otherwise>
|
---|
| 323 | </xsl:choose>
|
---|
| 324 | </xsl:for-each>
|
---|
| 325 | <xsl:call-template name="mark.up.block.end"/>
|
---|
| 326 | </xsl:template>
|
---|
| 327 |
|
---|
| 328 | <!-- ================================================================== -->
|
---|
| 329 |
|
---|
| 330 | <!-- * Footnote and annotation contents are displayed using a hanging -->
|
---|
| 331 | <!-- * indent out to $man.indent.width If a paragraph-level block -->
|
---|
| 332 | <!-- * element (verbatim, list, or admonition) is the first block -->
|
---|
| 333 | <!-- * element nested at its same level within the same footnote or -->
|
---|
| 334 | <!-- * annotation, then we push it over by the same indent width. -->
|
---|
| 335 | <!-- * -->
|
---|
| 336 | <!-- * We don't reset the indent for each following sibling, but -->
|
---|
| 337 | <!-- * instead do it after for-eaching over all block siblings at -->
|
---|
| 338 | <!-- * the same level. So the effect is that if there are any -->
|
---|
| 339 | <!-- * following-sibling blocks after the block that starts this -->
|
---|
| 340 | <!-- * indent, then they just retain the indent that was already set -->
|
---|
| 341 |
|
---|
| 342 | <xsl:template name="mark.up.block.start">
|
---|
| 343 | <xsl:choose>
|
---|
| 344 | <xsl:when test="(ancestor::footnote
|
---|
| 345 | or ancestor::annotation)">
|
---|
| 346 | <xsl:if test="not(preceding-sibling::address|
|
---|
| 347 | preceding-sibling::literallayout|
|
---|
| 348 | preceding-sibling::programlisting|
|
---|
| 349 | preceding-sibling::screen|
|
---|
| 350 | preceding-sibling::synopsis|
|
---|
| 351 | preceding-sibling::itemizedlist|
|
---|
| 352 | preceding-sibling::orderedlist|
|
---|
| 353 | preceding-sibling::variablelist|
|
---|
| 354 | preceding-sibling::glosslist|
|
---|
| 355 | preceding-sibling::simplelist[@type !='inline']|
|
---|
| 356 | preceding-sibling::segmentedlist|
|
---|
| 357 | preceding-sibling::caution|
|
---|
| 358 | preceding-sibling::important|
|
---|
| 359 | preceding-sibling::note|
|
---|
| 360 | preceding-sibling::tip|
|
---|
| 361 | preceding-sibling::warning|
|
---|
| 362 | preceding-sibling::table|
|
---|
| 363 | preceding-sibling::informaltable
|
---|
| 364 | )">
|
---|
| 365 | <xsl:text>.RS</xsl:text>
|
---|
| 366 | <xsl:if test="not($list-indent = '')">
|
---|
| 367 | <xsl:text> </xsl:text>
|
---|
| 368 | <xsl:value-of select="$list-indent"/>
|
---|
| 369 | </xsl:if>
|
---|
| 370 | <xsl:text> </xsl:text>
|
---|
| 371 | </xsl:if>
|
---|
| 372 | </xsl:when>
|
---|
| 373 | </xsl:choose>
|
---|
| 374 | </xsl:template>
|
---|
| 375 |
|
---|
| 376 | <!-- * Check to see if we were called from a block within a footnote or -->
|
---|
| 377 | <!-- * annotation; if so, and the block contains any nested block -->
|
---|
| 378 | <!-- * content, then we know the mark.up.block.end template was already -->
|
---|
| 379 | <!-- * called to generate a .RS macro to indent that nested block -->
|
---|
| 380 | <!-- * content; so we need to generate a .RE to set the margin back to -->
|
---|
| 381 | <!-- * where it was prior to the .RS call. -->
|
---|
| 382 | <xsl:template name="mark.up.block.end">
|
---|
| 383 | <xsl:if test="(ancestor::footnote
|
---|
| 384 | or ancestor::annotation)">
|
---|
| 385 | <xsl:if test="address|
|
---|
| 386 | literallayout|
|
---|
| 387 | programlisting|
|
---|
| 388 | screen|
|
---|
| 389 | synopsis|
|
---|
| 390 | itemizedlist|
|
---|
| 391 | orderedlist|
|
---|
| 392 | variablelist|
|
---|
| 393 | glosslist|
|
---|
| 394 | simplelist[@type !='inline']|
|
---|
| 395 | segmentedlist|
|
---|
| 396 | caution|
|
---|
| 397 | important|
|
---|
| 398 | note|
|
---|
| 399 | tip|
|
---|
| 400 | warning|
|
---|
| 401 | table|
|
---|
| 402 | informaltable">
|
---|
| 403 | <xsl:text> </xsl:text>
|
---|
| 404 | <xsl:text>.RE</xsl:text>
|
---|
| 405 | <xsl:text> </xsl:text>
|
---|
| 406 | </xsl:if>
|
---|
| 407 | </xsl:if>
|
---|
| 408 | </xsl:template>
|
---|
| 409 |
|
---|
| 410 | <!-- ================================================================== -->
|
---|
| 411 |
|
---|
| 412 | <!-- * The person.name template in the HTML stylesheets outputs extra -->
|
---|
| 413 | <!-- * spaces that we need to strip out for manpages output. This -->
|
---|
| 414 | <!-- * template calls person.name, then tries to do some smart -->
|
---|
| 415 | <!-- * normalization of the result tree fragment from that. -->
|
---|
| 416 | <xsl:template name="person.name.normalized">
|
---|
| 417 | <xsl:variable name="contents">
|
---|
| 418 | <xsl:call-template name="person.name"/>
|
---|
| 419 | </xsl:variable>
|
---|
| 420 | <!-- * We put the output of person.name into a node-set and then we -->
|
---|
| 421 | <!-- * check it node-by-node and strip out space only where needed. -->
|
---|
| 422 | <xsl:variable name="contents.tree" select="exsl:node-set($contents)"/>
|
---|
| 423 | <xsl:for-each select="$contents.tree/node()">
|
---|
| 424 | <xsl:choose>
|
---|
| 425 | <!-- * We don't want to monkey with single spaces or commas/periods -->
|
---|
| 426 | <!-- * followed by spaces, because those are bits of text that are -->
|
---|
| 427 | <!-- * actually generated by the person.name template itself (that -->
|
---|
| 428 | <!-- * is, they're not in the source). So, we preserve them. -->
|
---|
| 429 | <xsl:when test=". = ' ' or . = ', ' or . = '. '">
|
---|
| 430 | <xsl:value-of select="."/>
|
---|
| 431 | </xsl:when>
|
---|
| 432 | <xsl:otherwise>
|
---|
| 433 | <xsl:value-of select="normalize-space(.)"/>
|
---|
| 434 | </xsl:otherwise>
|
---|
| 435 | </xsl:choose>
|
---|
| 436 | </xsl:for-each>
|
---|
| 437 | </xsl:template>
|
---|
| 438 |
|
---|
| 439 | <!-- ================================================================== -->
|
---|
| 440 |
|
---|
| 441 | <xsl:template name="make.adjusted.man.filename">
|
---|
| 442 | <xsl:param name="name"/>
|
---|
| 443 | <xsl:param name="lang"/>
|
---|
| 444 | <xsl:param name="name.with.lang">
|
---|
| 445 | <xsl:choose>
|
---|
| 446 | <xsl:when test="$lang != 'en'
|
---|
| 447 | and not($man.output.lang.in.name.enabled = 0)
|
---|
| 448 | and ($man.output.subdirs.enabled = 0 or
|
---|
| 449 | $man.output.in.separate.dir = 0)">
|
---|
| 450 | <!-- * $lang is not en (English) -->
|
---|
| 451 | <!-- * AND user has specified man.output.lang.in.name.enabled -->
|
---|
| 452 | <!-- * AND doesn't want output going into separate dirs, -->
|
---|
| 453 | <!-- * SO... we include the $lang value in the filename; e.g., -->
|
---|
| 454 | <!-- * foo.ja.1 -->
|
---|
| 455 | <xsl:value-of select="concat($name, '.', $lang)"/>
|
---|
| 456 | </xsl:when>
|
---|
| 457 | <xsl:otherwise>
|
---|
| 458 | <!-- * user either has man.output.lang.in.name.enabled unset -->
|
---|
| 459 | <!-- * or has set it but also has man.output.subdirs.enabled -->
|
---|
| 460 | <!-- * set (in which case the $lang value is used to add a -->
|
---|
| 461 | <!-- * $lang subdir in the pathname); in either case, we don't -->
|
---|
| 462 | <!-- * want to include the $lang in the filename -->
|
---|
| 463 | <xsl:value-of select="$name"/>
|
---|
| 464 | </xsl:otherwise>
|
---|
| 465 | </xsl:choose>
|
---|
| 466 | </xsl:param>
|
---|
| 467 | <xsl:param name="section"/>
|
---|
| 468 | <xsl:param name="dirname">
|
---|
| 469 | <xsl:if test="not($man.output.in.separate.dir = 0)">
|
---|
| 470 | <xsl:choose>
|
---|
| 471 | <xsl:when test="not($man.output.subdirs.enabled = 0)">
|
---|
| 472 | <xsl:variable name="lang.subdir">
|
---|
| 473 | <xsl:if test="not($man.output.lang.in.name.enabled = 0)">
|
---|
| 474 | <!-- * user has man.output.lang.in.name.enabled set, so -->
|
---|
| 475 | <!-- * we need to add a $lang subdir -->
|
---|
| 476 | <xsl:value-of select="concat($lang, '/')"/>
|
---|
| 477 | </xsl:if>
|
---|
| 478 | </xsl:variable>
|
---|
| 479 | <xsl:value-of
|
---|
| 480 | select="concat($man.output.base.dir, $lang.subdir,
|
---|
| 481 | 'man', normalize-space($section), '/')"/>
|
---|
| 482 | </xsl:when>
|
---|
| 483 | <xsl:otherwise>
|
---|
| 484 | <xsl:value-of select="$man.output.base.dir"/>
|
---|
| 485 | </xsl:otherwise>
|
---|
| 486 | </xsl:choose>
|
---|
| 487 | </xsl:if>
|
---|
| 488 | </xsl:param>
|
---|
| 489 | <xsl:call-template name="string.subst">
|
---|
| 490 | <!-- * To create the man filename, replace any spaces in filename with -->
|
---|
| 491 | <!-- * underscores and then append a dot plus a section number. -->
|
---|
| 492 | <xsl:with-param name="string"
|
---|
| 493 | select="concat($dirname,
|
---|
| 494 | normalize-space($name.with.lang),
|
---|
| 495 | '.', normalize-space($section))"/>
|
---|
| 496 | <xsl:with-param name="target" select="' '"/>
|
---|
| 497 | <xsl:with-param name="replacement" select="'_'"/>
|
---|
| 498 | </xsl:call-template>
|
---|
| 499 | </xsl:template>
|
---|
| 500 |
|
---|
| 501 | <!-- ================================================================== -->
|
---|
| 502 |
|
---|
| 503 | <xsl:template name="make.subheading">
|
---|
| 504 | <xsl:param name="title"/>
|
---|
| 505 | <xsl:call-template name="mark.subheading"/>
|
---|
| 506 | <xsl:text>.SH</xsl:text>
|
---|
| 507 | <xsl:text> </xsl:text>
|
---|
| 508 | <xsl:text>"</xsl:text>
|
---|
| 509 | <xsl:choose>
|
---|
| 510 | <xsl:when test="not($man.output.better.ps.enabled = 0)">
|
---|
| 511 | <xsl:value-of select="$title"/>
|
---|
| 512 | </xsl:when>
|
---|
| 513 | <xsl:otherwise>
|
---|
| 514 | <xsl:call-template name="string.upper">
|
---|
| 515 | <xsl:with-param name="string" select="$title"/>
|
---|
| 516 | </xsl:call-template>
|
---|
| 517 | </xsl:otherwise>
|
---|
| 518 | </xsl:choose>
|
---|
| 519 | <xsl:text>"</xsl:text>
|
---|
| 520 | <xsl:text> </xsl:text>
|
---|
| 521 | <xsl:call-template name="mark.subheading"/>
|
---|
| 522 | </xsl:template>
|
---|
| 523 |
|
---|
| 524 | <!-- * Put a horizontal rule or other divider around section titles -->
|
---|
| 525 | <!-- * in roff source (just to make things easier to read). -->
|
---|
| 526 | <xsl:template name="mark.subheading">
|
---|
| 527 | <xsl:if test="$man.subheading.divider.enabled != 0">
|
---|
| 528 | <xsl:text>.\" </xsl:text>
|
---|
| 529 | <xsl:value-of select="$man.subheading.divider"/>
|
---|
| 530 | <xsl:text> </xsl:text>
|
---|
| 531 | </xsl:if>
|
---|
| 532 | </xsl:template>
|
---|
| 533 |
|
---|
| 534 | <!-- ================================================================== -->
|
---|
| 535 |
|
---|
| 536 | <xsl:template name="roff-if-else-start">
|
---|
| 537 | <xsl:param name="condition">n</xsl:param>
|
---|
| 538 | <xsl:text>.ie </xsl:text>
|
---|
| 539 | <xsl:value-of select="$condition"/>
|
---|
| 540 | <xsl:text> \{\ </xsl:text>
|
---|
| 541 | </xsl:template>
|
---|
| 542 |
|
---|
| 543 | <xsl:template name="roff-if-start">
|
---|
| 544 | <xsl:param name="condition">n</xsl:param>
|
---|
| 545 | <xsl:text>.if </xsl:text>
|
---|
| 546 | <xsl:value-of select="$condition"/>
|
---|
| 547 | <xsl:text> \{\ </xsl:text>
|
---|
| 548 | </xsl:template>
|
---|
| 549 |
|
---|
| 550 | <xsl:template name="roff-else">
|
---|
| 551 | <xsl:text>.\} </xsl:text>
|
---|
| 552 | <xsl:text>.el \{\ </xsl:text>
|
---|
| 553 | </xsl:template>
|
---|
| 554 |
|
---|
| 555 | <xsl:template name="roff-if-end">
|
---|
| 556 | <xsl:text>.\} </xsl:text>
|
---|
| 557 | </xsl:template>
|
---|
| 558 |
|
---|
| 559 | </xsl:stylesheet>
|
---|