]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/boostbook/xsl/html-base.xsl
update sources to v12.2.3
[ceph.git] / ceph / src / boost / tools / boostbook / xsl / html-base.xsl
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3 Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
4
5 Distributed under the Boost Software License, Version 1.0.
6 (See accompanying file LICENSE_1_0.txt or copy at
7 http://www.boost.org/LICENSE_1_0.txt)
8 -->
9 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"
11 version="1.0">
12
13 <xsl:param name="html.stylesheet">
14 <xsl:choose>
15 <xsl:when test = "$boost.defaults = 'Boost'">
16 <xsl:value-of select = "concat($boost.root, '/doc/src/boostbook.css')"/>
17 </xsl:when>
18 <xsl:otherwise>
19 boostbook.css
20 </xsl:otherwise>
21 </xsl:choose>
22 </xsl:param>
23
24 <xsl:param name="boost.graphics.root">
25 <xsl:choose>
26 <xsl:when test = "$boost.defaults = 'Boost'">
27 <xsl:value-of select = "concat($boost.root, '/doc/src/images/')"/>
28 </xsl:when>
29 <xsl:otherwise>
30 <xsl:value-of select = "'images/'"/>
31 </xsl:otherwise>
32 </xsl:choose>
33 </xsl:param>
34
35 <xsl:param name="boost.mathjax" select="0"/>
36 <xsl:param name="boost.mathjax.script"
37 select="'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'"/>
38 <!--See usage below for explanation of this param-->
39 <xsl:param name="boost.noexpand.chapter.toc" select="0"/>
40
41 <xsl:param name="admon.style"/>
42 <xsl:param name="admon.graphics">1</xsl:param>
43 <xsl:param name="boostbook.verbose" select="0"/>
44 <xsl:param name="navig.graphics" select="1"/>
45 <xsl:param name="navig.graphics.extension" select="'.png'"/>
46 <xsl:param name="chapter.autolabel" select="1"/>
47 <xsl:param name="use.id.as.filename" select="1"/>
48 <xsl:param name="refentry.generate.name" select="0"/>
49 <xsl:param name="refentry.generate.title" select="1"/>
50 <xsl:param name="make.year.ranges" select="1"/>
51 <xsl:param name="generate.manifest" select="1"/>
52 <xsl:param name="generate.section.toc.level" select="3"/>
53 <xsl:param name="doc.standalone">false</xsl:param>
54 <xsl:param name="chunker.output.indent">yes</xsl:param>
55 <xsl:param name="chunker.output.encoding">US-ASCII</xsl:param>
56 <xsl:param name="chunk.quietly" select="not(number($boostbook.verbose))"/>
57 <xsl:param name="toc.max.depth">2</xsl:param>
58 <xsl:param name="callout.graphics.number.limit">15</xsl:param>
59 <xsl:param name = "admon.graphics.path" select="$boost.graphics.root" />
60 <xsl:param name = "navig.graphics.path" select="$boost.graphics.root" />
61 <xsl:param name = "callout.graphics.path"
62 select = "concat($boost.graphics.root, 'callouts/')"/>
63
64
65 <xsl:param name="admon.style">
66 <!-- Remove the style. Let the CSS do the styling -->
67 </xsl:param>
68
69 <!-- Always have graphics -->
70 <xsl:param name="admon.graphics" select="1"/>
71
72 <xsl:param name="generate.toc">
73 appendix toc,title
74 article/appendix nop
75 article toc,title
76 book toc,title
77 chapter toc,title
78 part toc,title
79 preface toc,title
80 qandadiv toc
81 qandaset toc
82 reference toc,title
83 sect1 toc
84 sect2 toc
85 sect3 toc
86 sect4 toc
87 sect5 toc
88 section toc
89 set toc,title
90 </xsl:param>
91
92
93 <xsl:template name="format.cvs.revision">
94 <xsl:param name="text"/>
95
96 <!-- Remove the "$Date: " -->
97 <xsl:variable name="text.noprefix"
98 select="substring-after($text, '$Date: ')"/>
99
100 <!-- Grab the year -->
101 <xsl:variable name="year" select="substring-before($text.noprefix, '/')"/>
102 <xsl:variable name="text.noyear"
103 select="substring-after($text.noprefix, '/')"/>
104
105 <!-- Grab the month -->
106 <xsl:variable name="month" select="substring-before($text.noyear, '/')"/>
107 <xsl:variable name="text.nomonth"
108 select="substring-after($text.noyear, '/')"/>
109
110 <!-- Grab the year -->
111 <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
112 <xsl:variable name="text.noday"
113 select="substring-after($text.nomonth, ' ')"/>
114
115 <!-- Get the time -->
116 <xsl:variable name="time" select="substring-before($text.noday, ' ')"/>
117
118 <xsl:variable name="month.name">
119 <xsl:choose>
120 <xsl:when test="$month=1">January</xsl:when>
121 <xsl:when test="$month=2">February</xsl:when>
122 <xsl:when test="$month=3">March</xsl:when>
123 <xsl:when test="$month=4">April</xsl:when>
124 <xsl:when test="$month=5">May</xsl:when>
125 <xsl:when test="$month=6">June</xsl:when>
126 <xsl:when test="$month=7">July</xsl:when>
127 <xsl:when test="$month=8">August</xsl:when>
128 <xsl:when test="$month=9">September</xsl:when>
129 <xsl:when test="$month=10">October</xsl:when>
130 <xsl:when test="$month=11">November</xsl:when>
131 <xsl:when test="$month=12">December</xsl:when>
132 </xsl:choose>
133 </xsl:variable>
134
135 <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
136 $time, ' GMT')"/>
137 </xsl:template>
138
139
140 <xsl:template name="format.svn.revision">
141 <xsl:param name="text"/>
142
143 <!-- Remove the "$Date: " or "$Date:: " -->
144 <xsl:variable name="text.noprefix"
145 select="substring-after($text, ': ')"/>
146
147 <!-- Grab the year -->
148 <xsl:variable name="year" select="substring-before($text.noprefix, '-')"/>
149 <xsl:variable name="text.noyear"
150 select="substring-after($text.noprefix, '-')"/>
151
152 <!-- Grab the month -->
153 <xsl:variable name="month" select="substring-before($text.noyear, '-')"/>
154 <xsl:variable name="text.nomonth"
155 select="substring-after($text.noyear, '-')"/>
156
157 <!-- Grab the year -->
158 <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
159 <xsl:variable name="text.noday"
160 select="substring-after($text.nomonth, ' ')"/>
161
162 <!-- Get the time -->
163 <xsl:variable name="time" select="substring-before($text.noday, ' ')"/>
164 <xsl:variable name="text.notime"
165 select="substring-after($text.noday, ' ')"/>
166
167 <!-- Get the timezone -->
168 <xsl:variable name="timezone" select="substring-before($text.notime, ' ')"/>
169
170 <xsl:variable name="month.name">
171 <xsl:choose>
172 <xsl:when test="$month=1">January</xsl:when>
173 <xsl:when test="$month=2">February</xsl:when>
174 <xsl:when test="$month=3">March</xsl:when>
175 <xsl:when test="$month=4">April</xsl:when>
176 <xsl:when test="$month=5">May</xsl:when>
177 <xsl:when test="$month=6">June</xsl:when>
178 <xsl:when test="$month=7">July</xsl:when>
179 <xsl:when test="$month=8">August</xsl:when>
180 <xsl:when test="$month=9">September</xsl:when>
181 <xsl:when test="$month=10">October</xsl:when>
182 <xsl:when test="$month=11">November</xsl:when>
183 <xsl:when test="$month=12">December</xsl:when>
184 </xsl:choose>
185 </xsl:variable>
186
187 <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year)"/>
188 <xsl:if test="$time != ''">
189 <xsl:value-of select="concat(' at ', $time, ' ', $timezone)"/>
190 </xsl:if>
191 </xsl:template>
192
193 <!-- Footer Copyright -->
194 <xsl:template match="copyright" mode="boost.footer">
195 <xsl:if test="position() &gt; 1">
196 <br/>
197 </xsl:if>
198 <xsl:call-template name="gentext">
199 <xsl:with-param name="key" select="'Copyright'"/>
200 </xsl:call-template>
201 <xsl:call-template name="gentext.space"/>
202 <xsl:call-template name="dingbat">
203 <xsl:with-param name="dingbat">copyright</xsl:with-param>
204 </xsl:call-template>
205 <xsl:call-template name="gentext.space"/>
206 <xsl:call-template name="copyright.years">
207 <xsl:with-param name="years" select="year"/>
208 <xsl:with-param name="print.ranges" select="$make.year.ranges"/>
209 <xsl:with-param name="single.year.ranges"
210 select="$make.single.year.ranges"/>
211 </xsl:call-template>
212 <xsl:call-template name="gentext.space"/>
213 <xsl:apply-templates select="holder" mode="titlepage.mode"/>
214 </xsl:template>
215
216 <!-- Footer License -->
217 <xsl:template match="legalnotice" mode="boost.footer">
218 <xsl:apply-templates select="para" mode="titlepage.mode" />
219 </xsl:template>
220
221 <xsl:template name="user.footer.content">
222 <table width="100%">
223 <tr>
224 <td align="left">
225 <xsl:variable name="revision-nodes"
226 select="ancestor-or-self::*
227 [not (attribute::rev:last-revision='')]"/>
228 <xsl:if test="count($revision-nodes) &gt; 0">
229 <xsl:variable name="revision-node"
230 select="$revision-nodes[last()]"/>
231 <xsl:variable name="revision-text">
232 <xsl:value-of
233 select="normalize-space($revision-node/attribute::rev:last-revision)"/>
234 </xsl:variable>
235 <xsl:if test="string-length($revision-text) &gt; 0 and not($revision-text = '$Date$')">
236 <p>
237 <small>
238 <xsl:text>Last revised: </xsl:text>
239 <xsl:choose>
240 <xsl:when test="not(contains($revision-text, '$Date: ')) and not(contains($revision-text, '$Date:: '))">
241 <xsl:value-of select="$revision-text"/>
242 </xsl:when>
243 <xsl:when test="contains($revision-text, '/')">
244 <xsl:call-template name="format.cvs.revision">
245 <xsl:with-param name="text" select="$revision-text"/>
246 </xsl:call-template>
247 </xsl:when>
248 <xsl:otherwise>
249 <xsl:call-template name="format.svn.revision">
250 <xsl:with-param name="text" select="$revision-text"/>
251 </xsl:call-template>
252 </xsl:otherwise>
253 </xsl:choose>
254 </small>
255 </p>
256 </xsl:if>
257 </xsl:if>
258 </td>
259 <td align="right">
260 <div class = "copyright-footer">
261 <xsl:apply-templates select="ancestor::*/*/copyright"
262 mode="boost.footer"/>
263 <xsl:apply-templates select="ancestor::*/*/legalnotice"
264 mode="boost.footer"/>
265 </div>
266 </td>
267 </tr>
268 </table>
269 </xsl:template>
270
271 <!-- We don't want refentry's to show up in the TOC because they
272 will merely be redundant with the synopsis. -->
273 <xsl:template match="refentry" mode="toc"/>
274
275 <!-- override the behaviour of some DocBook elements for better
276 rendering facilities -->
277
278 <xsl:template match = "programlisting[ancestor::informaltable]">
279 <pre class = "table-{name(.)}"><xsl:apply-templates/></pre>
280 </xsl:template>
281
282 <xsl:template match = "refsynopsisdiv">
283 <h2 class = "{name(.)}-title">Synopsis</h2>
284 <div class = "{name(.)}">
285 <xsl:apply-templates/>
286 </div>
287 </xsl:template>
288
289 <xsl:template name="generate.html.title"/>
290
291 <xsl:template match="*" mode="detect-math">
292 <xsl:variable name="is-chunk">
293 <xsl:call-template name="chunk"/>
294 </xsl:variable>
295 <xsl:if test="$is-chunk = '0'">
296 <xsl:apply-templates mode="detect-math"/>
297 </xsl:if>
298 </xsl:template>
299
300 <xsl:template match="text()" mode="detect-math"/>
301
302 <xsl:template match="textobject[@role='tex']" mode="detect-math">
303 <xsl:text>1</xsl:text>
304 </xsl:template>
305
306 <xsl:template name="user.head.content">
307 <xsl:if test="$boost.mathjax = 1">
308 <xsl:variable name="has-math">
309 <xsl:apply-templates mode="detect-math" select="*"/>
310 </xsl:variable>
311 <xsl:if test="string($has-math) != ''">
312 <script type="text/javascript" src="{$boost.mathjax.script}"/>
313 </xsl:if>
314 </xsl:if>
315 </xsl:template>
316
317 <xsl:template match="inlinemediaobject">
318 <xsl:choose>
319 <xsl:when test="$boost.mathjax = 1 and textobject[@role='tex']">
320 <xsl:variable name="content" select="string(textobject[@role='tex'])"/>
321 <xsl:variable name="plain-content">
322 <xsl:choose>
323 <!--strip $$-->
324 <xsl:when test="substring($content, 1, 1) = '$' and
325 substring($content, string-length($content), 1) = '$'">
326 <xsl:value-of select="substring($content, 2, string-length($content) - 2)"/>
327 </xsl:when>
328 <xsl:otherwise>
329 <xsl:value-of select="$content"/>
330 </xsl:otherwise>
331 </xsl:choose>
332 </xsl:variable>
333 <script type="math/tex">
334 <xsl:value-of select="$plain-content"/>
335 </script>
336 <noscript>
337 <xsl:apply-imports/>
338 </noscript>
339 </xsl:when>
340 <xsl:otherwise>
341 <xsl:apply-imports/>
342 </xsl:otherwise>
343 </xsl:choose>
344 </xsl:template>
345
346 <!-- ============================================================ -->
347
348 <xsl:template name="output.html.stylesheets">
349 <xsl:param name="stylesheets" select="''"/>
350
351 <xsl:choose>
352 <xsl:when test="contains($stylesheets, ' ')">
353 <link rel="stylesheet">
354 <xsl:attribute name="href">
355 <xsl:call-template name="href.target.relative">
356 <xsl:with-param name="target" select="substring-before($stylesheets, ' ')"/>
357 </xsl:call-template>
358 </xsl:attribute>
359 <xsl:if test="$html.stylesheet.type != ''">
360 <xsl:attribute name="type">
361 <xsl:value-of select="$html.stylesheet.type"/>
362 </xsl:attribute>
363 </xsl:if>
364 </link>
365 <xsl:call-template name="output.html.stylesheets">
366 <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
367 </xsl:call-template>
368 </xsl:when>
369 <xsl:when test="$stylesheets != ''">
370 <link rel="stylesheet">
371 <xsl:attribute name="href">
372 <xsl:call-template name="href.target.relative">
373 <xsl:with-param name="target" select="$stylesheets"/>
374 </xsl:call-template>
375 </xsl:attribute>
376 <xsl:if test="$html.stylesheet.type != ''">
377 <xsl:attribute name="type">
378 <xsl:value-of select="$html.stylesheet.type"/>
379 </xsl:attribute>
380 </xsl:if>
381 </link>
382 </xsl:when>
383 </xsl:choose>
384 </xsl:template>
385
386 <xsl:template match="itemizedlist[@role = 'index']" mode="class.value">
387 <xsl:value-of select="'index'"/>
388 </xsl:template>
389
390 <xsl:template match="sidebar[@role = 'blurb']" mode="class.value">
391 <xsl:value-of select="'blurb'"/>
392 </xsl:template>
393
394 <xsl:template match="preface|chapter|appendix|article" mode="toc">
395 <xsl:param name="toc-context" select="."/>
396
397 <!--
398 When boost.noexpand.chapter.toc is set to 1, then the TOC for
399 chapters is only one level deep (ie toc.max.depth has no effect)
400 and nested sections within chapters are not shown. TOC's and LOC's
401 at other levels are not effected and respond to toc.max.depth as normal.
402 -->
403 <xsl:choose>
404 <xsl:when test="local-name($toc-context) = 'book' and $boost.noexpand.chapter.toc = 1">
405 <xsl:call-template name="subtoc">
406 <xsl:with-param name="toc-context" select="$toc-context"/>
407 <xsl:with-param name="nodes" select="foo"/>
408 </xsl:call-template>
409 </xsl:when>
410 <xsl:otherwise>
411 <xsl:call-template name="subtoc">
412 <xsl:with-param name="toc-context" select="$toc-context"/>
413 <xsl:with-param name="nodes"
414 select="section|sect1|glossary|bibliography|index
415 |bridgehead[$bridgehead.in.toc != 0]"/>
416 </xsl:call-template>
417 </xsl:otherwise>
418 </xsl:choose>
419 </xsl:template>
420
421 </xsl:stylesheet>
422
423