1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
|
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
This file is part of the XSL DocBook Stylesheet distribution.
See ../README or http://cdn.docbook.org/release/xsl/current/ for
copyright and other information.
******************************************************************** -->
<!-- ==================================================================== -->
<xsl:template match="refnamediv">
<xsl:choose>
<xsl:when test="preceding-sibling::refnamediv">
<!-- * No title on secondary refnamedivs! -->
<!-- * Just put a single line break instead -->
<xsl:text>.br </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="make.subheading">
<xsl:with-param name="title">
<xsl:apply-templates select="." mode="subheading.markup"/>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="mark.subheading"/>
<!-- * if we have multiple Refname instances, separate the names -->
<!-- * with commas -->
<xsl:for-each select="refname">
<xsl:if test="position()>1">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:call-template name="string.subst">
<!-- * To create the name(s) for this man page, replace any -->
<!-- * spaces in the refname(s) with underscores. This ensures -->
<!-- * that tools like lexgrog(1) will be able to parse the name -->
<!-- * (lexgrog won’t parse names that contain spaces). -->
<xsl:with-param name="string" select="."/>
<xsl:with-param name="target" select="' '"/>
<xsl:with-param name="replacement" select="'_'"/>
</xsl:call-template>
</xsl:for-each>
<!-- * The man(7) man pages says: -->
<!-- * -->
<!-- * The only required heading is NAME, which should be the -->
<!-- * first section and be followed on the next line by a one -->
<!-- * line description of the program: -->
<!-- * -->
<!-- * .SH NAME chess \- the game of chess -->
<!-- * -->
<!-- * It is extremely important that this format is followed, -->
<!-- * and that there is a backslash before the single dash -->
<!-- * which follows the command name. This syntax is used by -->
<!-- * the makewhatis(8) program to create a database of short -->
<!-- * command descriptions for the whatis(1) and apropos(1) -->
<!-- * commands. -->
<!-- * -->
<xsl:if test="refpurpose/node()">
<xsl:text> \- </xsl:text>
<xsl:variable name="refpurpose">
<xsl:apply-templates select="refpurpose/node()"/>
</xsl:variable>
<xsl:value-of select="normalize-space($refpurpose)"/>
</xsl:if>
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="refsynopsisdiv">
<xsl:call-template name="make.subheading">
<xsl:with-param name="title">
<xsl:apply-templates select="." mode="subheading.markup"/>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="refsect1|refentry/refsection">
<xsl:variable name="title">
<xsl:apply-templates select="." mode="subheading.markup"/>
</xsl:variable>
<xsl:call-template name="make.subheading">
<xsl:with-param name="title">
<xsl:value-of select="normalize-space($title)"/>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="refsect2|refentry/refsection/refsection">
<xsl:call-template name="mark.subheading"/>
<xsl:variable name="title">
<xsl:apply-templates
select="(info/title
|refsectioninfo/title
|refsect1info/title
|title)[1]/node()"/>
</xsl:variable>
<xsl:text>.SS "</xsl:text>
<xsl:value-of select="normalize-space($title)"/>
<xsl:text>" </xsl:text>
<xsl:call-template name="mark.subheading"/>
<xsl:choose>
<!-- * If default-indentation adjustment is on, then indent the -->
<!-- * child content of this Refsect2 -->
<xsl:when test="not($man.indent.refsect = 0)">
<xsl:text>.RS </xsl:text>
<xsl:apply-templates/>
<xsl:text>.RE </xsl:text>
</xsl:when>
<xsl:otherwise>
<!-- * If default-indentation adjustment is on, then do not -->
<!-- * indent the child content of this Refsect2, because -->
<!-- * the title is already "sticking out to the left" -->
<!-- * (as the groff_man(7) man page describes it), which -->
<!-- * actually means the title is indented by the value of -->
<!-- * the SN register, which appears by default to be -->
<!-- * about half of the default indentation value -->
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="refsect3|refentry/refsection/refsection/refsection">
<xsl:variable name="title">
<xsl:value-of select="(info/title
|refsectioninfo/title
|refsect1info/title
|title)[1]"/>
</xsl:variable>
<xsl:choose>
<!-- * If default-indentation adjustment is on, then indent the -->
<!-- * child content of this Refsect3 or Refsection. -->
<xsl:when test="not($man.indent.refsect != 0)">
<xsl:call-template name="nested-section-title"/>
<xsl:text>.RS</xsl:text>
<xsl:if test="not($man.indent.width = '')">
<xsl:text> </xsl:text>
<xsl:value-of select="$man.indent.width"/>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
<xsl:text>.RE </xsl:text>
</xsl:when>
<xsl:otherwise>
<!-- * If default-indentation adjustment is on, then do not -->
<!-- * indent the child content of this Refsect2, because -->
<!-- * the title is already "sticking out to the left" -->
<!-- * (as the groff_man(7) man page describes it), which -->
<!-- * actually means the title is indented by the value of -->
<!-- * the SN register, which appears by default to be -->
<!-- * about half of the default indentation value -->
<xsl:text>.ti (\n(SNu * 5u / 3u) </xsl:text>
<xsl:call-template name="nested-section-title"/>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="refsection">
<!-- * This template is used for a nested Refsection that is -->
<!-- * is a child of a Refsect3-level section (The numberd -->
<!-- * Refsect hierarchy in DocBook ends with Refsect3, so -->
<!-- * there is not actually a Refsect4 element.) -->
<xsl:variable name="title">
<xsl:value-of select="(info/title
|refsectioninfo/title
|refsect1info/title
|title)[1]"/>
</xsl:variable>
<xsl:variable name="indent-width">
<xsl:if test="not($man.indent.refsect = 0)">
<!-- * If default-indentation adjustment is on, then indent the -->
<!-- * child content of this Refsect3 or Refsection. -->
<xsl:text>(\n(SNu) </xsl:text>
</xsl:if>
</xsl:variable>
<xsl:call-template name="nested-section-title"/>
<xsl:text>.RS (\n(SNu) </xsl:text>
<xsl:apply-templates/>
<xsl:text>.RE </xsl:text>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="refsect1|refentry/refsection"
mode="subheading.markup">
<xsl:variable name="title" select="(info/title
|refsectioninfo/title
|refsect1info/title
|title)[1]"/>
<xsl:apply-templates select="$title" mode="title.markup"/>
</xsl:template>
<xsl:template match="refsect1|refentry/refsection"
mode="title.markup">
<!-- * Note: This template is used just for generating the text for -->
<!-- * cross-references to Refsect1 or top-level Refsection instances. -->
<xsl:variable name="title" select="(info/title
|refsectioninfo/title
|refsect1info/title
|title)[1]"/>
<xsl:call-template name="process.SH.xref">
<xsl:with-param name="title">
<xsl:apply-templates select="$title" mode="title.markup"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- * Output of Titles from Xref with Endterm needs to be handled -->
<!-- * separately from output for Endterm-less Xref -->
<xsl:template match="refsect1/title
|refentry/refsection/title
|refsynopsisdiv/title"
mode="endterm">
<xsl:call-template name="process.SH.xref">
<xsl:with-param name="title">
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="refsynopsisdiv" mode="subheading.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title">
<xsl:call-template name="get.refsynopsisdiv.title">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$title"/>
</xsl:template>
<xsl:template match="refsynopsisdiv" mode="title.markup">
<!-- * Note: This template is used just for generating the text for -->
<!-- * cross-references to Refsynopsisdiv instances. -->
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title">
<xsl:call-template name="get.refsynopsisdiv.title">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="process.SH.xref">
<xsl:with-param name="title" select="$title"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="get.refsynopsisdiv.title">
<xsl:param name="allow-anchors"/>
<xsl:choose>
<xsl:when test="info/title
|refsynopsisdivinfo/title
|title">
<xsl:apply-templates
select="(info/title
|refsynopsisdivinfo/title
|title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'RefSynopsisDiv'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="refnamediv" mode="subheading.markup">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'RefName'"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="refnamediv" mode="title.markup">
<xsl:call-template name="process.SH.xref">
<xsl:with-param name="title">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'RefName'"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="refnamediv" mode="xref-to">
<xsl:apply-templates select="." mode="title.markup"/>
</xsl:template>
<!-- * suppress any title we don't otherwise process elsewhere -->
<xsl:template match="title"/>
<!-- ==================================================================== -->
<xsl:template name="process.SH.xref">
<xsl:param name="title"/>
<xsl:choose>
<xsl:when test="not($man.output.better.ps.enabled = 0)">
<xsl:text>\c</xsl:text>
<xsl:text>▒</xsl:text>
<xsl:text>.SH-xref </xsl:text>
<xsl:text>"</xsl:text>
<xsl:value-of select="$title"/>
<xsl:text>\c"</xsl:text>
<xsl:text>▒</xsl:text>
<xsl:text>\&</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="string.upper">
<xsl:with-param name="string" select="$title"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
|