Jitterbug no more.
[fvwm.git] / doc / docbook-xsl / manpages / block.xsl
blob2a844700d04717e71760dfdff1b4b07cd9f71d7b
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 exclude-result-prefixes="exsl"
5 version='1.0'>
7 <!-- ********************************************************************
8 $Id: block.xsl,v 1.1 2007/03/10 05:15:34 scott Exp $
9 ********************************************************************
11 This file is part of the XSL DocBook Stylesheet distribution.
12 See ../README or http://docbook.sf.net/release/xsl/current/ for
13 copyright and other information.
15 ******************************************************************** -->
17 <!-- ==================================================================== -->
19 <xsl:template match="caution|important|note|tip|warning">
20 <xsl:call-template name="nested-section-title"/>
21 <xsl:apply-templates/>
22 <xsl:text>&#10;</xsl:text>
23 </xsl:template>
25 <xsl:template match="formalpara">
26 <xsl:variable name="title.wrapper">
27 <bold><xsl:value-of select="normalize-space(title[1])"/></bold>
28 </xsl:variable>
29 <xsl:text>.PP&#10;</xsl:text>
30 <!-- * don't put linebreak after head; instead render it as a "run in" -->
31 <!-- * head, that is, inline, with a period and space following it -->
32 <xsl:apply-templates mode="bold" select="exsl:node-set($title.wrapper)"/>
33 <xsl:text>. </xsl:text>
34 <xsl:apply-templates/>
35 </xsl:template>
37 <xsl:template match="formalpara/para">
38 <xsl:call-template name="mixed-block"/>
39 <xsl:text>&#10;</xsl:text>
40 </xsl:template>
42 <xsl:template match="para">
43 <!-- * FIXME: Need to extract the ancestor::footnote, etc. checking and -->
44 <!-- * move to named template so that we can call it from templates for -->
45 <!-- * other block elements also -->
46 <xsl:choose>
47 <!-- * If a para is a descendant of a footnote, etc., then indent it -->
48 <!-- * (unless it is the first child, in which case don't generate -->
49 <!-- * anything at all to mark its start). -->
50 <!-- * FIXME: *blurb checking should not be munged in here the way -->
51 <!-- * it currently is; this probably breaks blurb indenting. -->
52 <xsl:when test="ancestor::footnote or
53 ancestor::annotation or
54 ancestor::authorblurb or
55 ancestor::personblurb">
56 <xsl:if test="preceding-sibling::*[not(name() ='')]">
57 <xsl:text>.sp</xsl:text>
58 <xsl:text>&#10;</xsl:text>
59 <xsl:text>.RS 4n</xsl:text>
60 <xsl:text>&#10;</xsl:text>
61 </xsl:if>
62 </xsl:when>
63 <xsl:otherwise>
64 <xsl:text>.PP</xsl:text>
65 <xsl:text>&#10;</xsl:text>
66 </xsl:otherwise>
67 </xsl:choose>
68 <xsl:call-template name="mixed-block"/>
69 <xsl:if test="ancestor::footnote or
70 ancestor::annotation or
71 ancestor::authorblurb or
72 ancestor::personblurb">
73 <xsl:if test="preceding-sibling::*[not(name() ='')]">
74 <xsl:text>&#10;</xsl:text>
75 <xsl:text>.RE</xsl:text>
76 <xsl:text>&#10;</xsl:text>
77 </xsl:if>
78 </xsl:if>
79 <xsl:text>&#10;</xsl:text>
80 </xsl:template>
82 <xsl:template match="simpara">
83 <xsl:variable name="content">
84 <xsl:apply-templates/>
85 </xsl:variable>
86 <xsl:value-of select="normalize-space($content)"/>
87 <xsl:text>&#10;</xsl:text>
88 <xsl:if test="not(ancestor::authorblurb) and
89 not(ancestor::personblurb)">
90 <xsl:text>.sp&#10;</xsl:text>
91 </xsl:if>
92 </xsl:template>
94 <!-- ==================================================================== -->
96 <!-- * Yes, address, synopsis, and funcsynopsisinfo are verbatim environments. -->
97 <xsl:template match="literallayout|programlisting|screen|
98 address|synopsis|funcsynopsisinfo">
99 <xsl:param name="indent">
100 <!-- * Only indent this verbatim if $man.indent.verbatims is -->
101 <!-- * non-zero and it is not a child of a *synopsis element -->
102 <xsl:if test="not($man.indent.verbatims = 0) and
103 not(substring(local-name(..),
104 string-length(local-name(..))-7) = 'synopsis')">
105 <xsl:text>Yes</xsl:text>
106 </xsl:if>
107 </xsl:param>
109 <xsl:choose>
110 <!-- * Check to see if this verbatim item is within a parent element that -->
111 <!-- * allows mixed content. -->
112 <!-- * -->
113 <!-- * If it is within a mixed-content parent, then a line space is -->
114 <!-- * already added before it by the mixed-block template, so we don't -->
115 <!-- * need to add one here. -->
116 <!-- * -->
117 <!-- * If it is not within a mixed-content parent, then we need to add a -->
118 <!-- * line space before it. -->
119 <xsl:when test="parent::caption|parent::entry|parent::para|
120 parent::td|parent::th" /> <!-- do nothing -->
121 <xsl:otherwise>
122 <xsl:text>&#10;</xsl:text>
123 <xsl:text>.sp&#10;</xsl:text>
124 </xsl:otherwise>
125 </xsl:choose>
126 <xsl:if test="$indent = 'Yes'">
127 <!-- * start indented section -->
128 <xsl:text>.RS</xsl:text>
129 <xsl:if test="not($man.indent.width = '')">
130 <xsl:text> </xsl:text>
131 <xsl:value-of select="$man.indent.width"/>
132 </xsl:if>
133 <xsl:text>&#10;</xsl:text>
134 </xsl:if>
135 <xsl:choose>
136 <xsl:when test="self::funcsynopsisinfo">
137 <!-- * All Funcsynopsisinfo content is by default rendered in bold, -->
138 <!-- * because the man(7) man page says this: -->
139 <!-- * -->
140 <!-- * For functions, the arguments are always specified using -->
141 <!-- * italics, even in the SYNOPSIS section, where the rest of -->
142 <!-- * the function is specified in bold -->
143 <!-- * -->
144 <!-- * Look through the contents of the man/man2 and man3 directories -->
145 <!-- * on your system, and you'll see that most existing pages do follow -->
146 <!-- * this "bold everything in function synopsis" rule. -->
147 <!-- * -->
148 <!-- * Users who don't want the bold output can choose to adjust the -->
149 <!-- * man.font.funcsynopsisinfo parameter on their own. So even if you -->
150 <!-- * don't personally like the way it looks, please don't change the -->
151 <!-- * default to be non-bold - because it's a convention that's -->
152 <!-- * followed is the vast majority of existing man pages that document -->
153 <!-- * functions, and we need to follow it by default, like it or no. -->
154 <xsl:text>.ft </xsl:text>
155 <xsl:value-of select="$man.font.funcsynopsisinfo"/>
156 <xsl:text>&#10;</xsl:text>
157 <xsl:text>.nf&#10;</xsl:text>
158 <xsl:apply-templates/>
159 <xsl:text>&#10;</xsl:text>
160 <xsl:text>.fi&#10;</xsl:text>
161 <xsl:text>.ft&#10;</xsl:text>
162 </xsl:when>
163 <xsl:otherwise>
164 <!-- * Other verbatims do not need to get bolded -->
165 <xsl:text>.nf&#10;</xsl:text>
166 <xsl:apply-templates/>
167 <xsl:text>&#10;</xsl:text>
168 <xsl:text>.fi&#10;</xsl:text>
169 </xsl:otherwise>
170 </xsl:choose>
171 <xsl:if test="$indent = 'Yes'">
172 <!-- * end indented section -->
173 <xsl:text>.RE&#10;</xsl:text>
174 </xsl:if>
175 <!-- * if first following sibling node of this verbatim -->
176 <!-- * environment is a text node, output a line of space before it -->
177 <xsl:if test="following-sibling::node()[1][name(.) = '']">
178 <xsl:text>.sp&#10;</xsl:text>
179 </xsl:if>
180 </xsl:template>
182 <!-- ==================================================================== -->
184 <xsl:template match="table|informaltable">
185 <xsl:apply-templates select="." mode="to.tbl">
186 <!--* we call the to.tbl mode with the "source" param so that we can -->
187 <!--* preserve the context information and pass it down to the -->
188 <!--* named templates that do the actual table processing -->
189 <xsl:with-param name="source" select="ancestor::refentry/refnamediv[1]/refname[1]"/>
190 </xsl:apply-templates>
191 </xsl:template>
193 <!-- ==================================================================== -->
195 <xsl:template match="informalexample">
196 <xsl:apply-templates/>
197 </xsl:template>
199 <!-- ==================================================================== -->
201 <xsl:template match="figure">
202 <xsl:variable name="param.placement"
203 select="substring-after(normalize-space($formal.title.placement),
204 concat(local-name(.), ' '))"/>
206 <xsl:variable name="placement">
207 <xsl:choose>
208 <xsl:when test="contains($param.placement, ' ')">
209 <xsl:value-of select="substring-before($param.placement, ' ')"/>
210 </xsl:when>
211 <xsl:when test="$param.placement = ''">before</xsl:when>
212 <xsl:otherwise>
213 <xsl:value-of select="$param.placement"/>
214 </xsl:otherwise>
215 </xsl:choose>
216 </xsl:variable>
218 <xsl:text>.PP&#10;</xsl:text>
219 <xsl:call-template name="formal.object">
220 <xsl:with-param name="placement" select="$placement"/>
221 </xsl:call-template>
222 <xsl:text>&#10;</xsl:text>
223 </xsl:template>
225 <!-- ==================================================================== -->
227 <xsl:template match="mediaobject">
228 <xsl:text>.sp</xsl:text>
229 <xsl:text>&#10;</xsl:text>
230 <xsl:text>.RS</xsl:text>
231 <xsl:if test="not($list-indent = '')">
232 <xsl:text> </xsl:text>
233 <xsl:value-of select="$list-indent"/>
234 </xsl:if>
235 <xsl:text>&#10;</xsl:text>
236 <xsl:apply-templates/>
237 <xsl:text>&#10;</xsl:text>
238 <xsl:text>.RE&#10;</xsl:text>
239 </xsl:template>
241 <xsl:template match="imageobject">
242 <xsl:text>[IMAGE]</xsl:text>
243 <xsl:apply-templates/>
244 <xsl:text>&#10;</xsl:text>
245 </xsl:template>
247 <xsl:template match="textobject[parent::inlinemediaobject]">
248 <xsl:text>[</xsl:text>
249 <xsl:value-of select="."/>
250 <xsl:text>]</xsl:text>
251 </xsl:template>
253 <xsl:template match="textobject">
254 <xsl:apply-templates/>
255 </xsl:template>
257 <!-- ==================================================================== -->
259 <xsl:template name="formal.object">
260 <xsl:param name="placement" select="'before'"/>
261 <xsl:param name="class" select="local-name(.)"/>
263 <xsl:choose>
264 <xsl:when test="$placement = 'before'">
265 <xsl:call-template name="formal.object.heading"/>
266 <xsl:apply-templates/>
267 </xsl:when>
268 <xsl:otherwise>
269 <xsl:apply-templates/>
270 <xsl:call-template name="formal.object.heading"/>
271 </xsl:otherwise>
272 </xsl:choose>
273 </xsl:template>
275 <xsl:template name="formal.object.heading">
276 <xsl:param name="object" select="."/>
277 <xsl:param name="title">
278 <bold><xsl:apply-templates select="$object" mode="object.title.markup.textonly"/></bold>
279 </xsl:param>
280 <xsl:apply-templates mode="bold" select="exsl:node-set($title)"/>
281 <xsl:text>&#10;</xsl:text>
282 </xsl:template>
284 <!-- ==================================================================== -->
286 <!-- * suppress abstract -->
287 <xsl:template match="abstract"/>
289 </xsl:stylesheet>