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