source: stylesheets/lfs-xsl/pdf/lfs-mixed.xsl@ a7f0b27

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since a7f0b27 was a7f0b27, checked in by Bruce Dubbs <bdubbs@…>, 13 years ago

Fix a pdf rendering issue

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9623 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 14.5 KB
Line 
1<?xml version='1.0' encoding='ISO-8859-1'?>
2
3<!--
4$LastChangedBy$
5$Date$
6-->
7
8<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9 xmlns:fo="http://www.w3.org/1999/XSL/Format"
10 version="1.0">
11
12 <!-- This stylesheet contains misc params, attribute sets and templates
13 for output formating.
14 This file is for that templates that don't fit in other files. -->
15
16 <!-- What space do you want between normal paragraphs. -->
17 <xsl:attribute-set name="normal.para.spacing">
18 <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
19 <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
20 <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
21 <xsl:attribute name="orphans">3</xsl:attribute>
22 <xsl:attribute name="widows">3</xsl:attribute>
23 </xsl:attribute-set>
24
25 <!-- Properties associated with verbatim text. -->
26 <xsl:attribute-set name="verbatim.properties">
27 <xsl:attribute name="keep-with-previous.within-column">always</xsl:attribute>
28 <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
29 <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
30 <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
31 <xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>
32 <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
33 <xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
34 <xsl:attribute name="hyphenate">false</xsl:attribute>
35 <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
36 <xsl:attribute name="white-space-collapse">false</xsl:attribute>
37 <xsl:attribute name="white-space-treatment">preserve</xsl:attribute>
38 <xsl:attribute name="linefeed-treatment">preserve</xsl:attribute>
39 <xsl:attribute name="text-align">start</xsl:attribute>
40 </xsl:attribute-set>
41
42 <!-- Should verbatim environments be shaded? 1 =yes, 0 = no -->
43 <xsl:param name="shade.verbatim" select="1"/>
44
45 <!-- Properties that specify the style of shaded verbatim listings -->
46 <xsl:attribute-set name="shade.verbatim.style">
47 <xsl:attribute name="background-color">#E9E9E9</xsl:attribute>
48 <xsl:attribute name="border-style">solid</xsl:attribute>
49 <xsl:attribute name="border-width">0.5pt</xsl:attribute>
50 <xsl:attribute name="border-color">#888</xsl:attribute>
51 <xsl:attribute name="padding-start">5pt</xsl:attribute>
52 <xsl:attribute name="padding-top">2pt</xsl:attribute>
53 <xsl:attribute name="padding-bottom">2pt</xsl:attribute>
54 </xsl:attribute-set>
55
56 <!-- para:
57 Skip empty "Home page" in packages.xml.
58 Allow forced line breaks inside paragraphs emulating literallayout.
59 Removed vertical space in variablelist. -->
60 <!-- The original template is in {docbook-xsl}/fo/block.xsl -->
61 <xsl:template match="para">
62 <xsl:choose>
63 <xsl:when test="child::ulink[@url=' ']"/>
64 <xsl:when test="./@remap='verbatim'">
65 <fo:block xsl:use-attribute-sets="verbatim.properties">
66 <xsl:call-template name="anchor"/>
67 <xsl:apply-templates/>
68 </fo:block>
69 </xsl:when>
70 <xsl:when test="ancestor::variablelist">
71 <fo:block>
72 <xsl:attribute name="space-before.optimum">0.1em</xsl:attribute>
73 <xsl:attribute name="space-before.minimum">0em</xsl:attribute>
74 <xsl:attribute name="space-before.maximum">0.2em</xsl:attribute>
75 <xsl:call-template name="anchor"/>
76 <xsl:apply-templates/>
77 </fo:block>
78 </xsl:when>
79 <xsl:otherwise>
80 <fo:block xsl:use-attribute-sets="normal.para.spacing">
81 <xsl:call-template name="anchor"/>
82 <xsl:apply-templates/>
83 </fo:block>
84 </xsl:otherwise>
85 </xsl:choose>
86 </xsl:template>
87
88 <!-- screen, literallayout:
89 Self-made template that creates a fo:block wrapper with keep-together
90 processing instruction support around the output generated by
91 original screen templates. -->
92 <xsl:template match="screen|literallayout">
93 <xsl:variable name="keep.together">
94 <xsl:call-template name="pi.dbfo_keep-together"/>
95 </xsl:variable>
96 <fo:block>
97 <xsl:attribute name="keep-together.within-column">
98 <xsl:choose>
99 <xsl:when test="$keep.together != ''">
100 <xsl:value-of select="$keep.together"/>
101 </xsl:when>
102
103<!-- The following section has been modified by Martin Miehe. Page breaks
104 should be allowed within the long script listings in the appendices.
105
106 <xsl:otherwise>always</xsl:otherwise>
107-->
108 <xsl:otherwise>
109 <xsl:choose>
110 <xsl:when test="ancestor::appendix">auto</xsl:when>
111 <!-- Modified by Bruce Dubbs. Allow user to specify
112 automatic screen formatting to split across pages. -->
113 <xsl:when test="@role='auto'">auto</xsl:when>
114 <xsl:otherwise>always</xsl:otherwise>
115 </xsl:choose>
116 </xsl:otherwise>
117<!-- End of modification -->
118
119 </xsl:choose>
120 </xsl:attribute>
121
122<!-- The following lines were inserted by Martin Miehe. Scripts and rules
123 in the appendices should have a smaller font-size so that at least
124 80 characters fit to one line. -->
125
126 <xsl:if test="ancestor::appendix"> <!-- name(/) != appendix" -->
127 <xsl:attribute name="font-size">10pt</xsl:attribute>
128 </xsl:if>
129<!-- End of insertion. -->
130
131 <xsl:apply-imports/>
132 </fo:block>
133 </xsl:template>
134
135 <!-- literal:
136 Be sure that literal will use allways normal font weight. -->
137 <!-- The original template is in {docbook-xsl}/fo/inline.xsl -->
138 <xsl:template match="literal">
139 <fo:inline font-weight="normal">
140 <xsl:call-template name="inline.monoseq"/>
141 </fo:inline>
142 </xsl:template>
143
144 <!-- inline.monoseq:
145 Added hyphenate-url support to classname, exceptionname, interfacename,
146 methodname, computeroutput, constant, envar, filename, function, code,
147 literal, option, promt, systemitem, varname, sgmltag, tag, and uri -->
148 <!-- The original template is in {docbook-xsl}/fo/inline.xsl -->
149 <xsl:template name="inline.monoseq">
150 <xsl:param name="content">
151 <xsl:call-template name="simple.xlink">
152 <xsl:with-param name="content">
153 <xsl:choose>
154 <xsl:when test="ancestor::para and not(ancestor::screen)
155 and not(descendant::ulink)">
156 <xsl:call-template name="hyphenate-url">
157 <xsl:with-param name="url">
158 <xsl:apply-templates/>
159 </xsl:with-param>
160 </xsl:call-template>
161 </xsl:when>
162 <xsl:otherwise>
163 <xsl:apply-templates/>
164 </xsl:otherwise>
165 </xsl:choose>
166 </xsl:with-param>
167 </xsl:call-template>
168 </xsl:param>
169 <fo:inline xsl:use-attribute-sets="monospace.properties">
170 <xsl:if test="@dir">
171 <xsl:attribute name="direction">
172 <xsl:choose>
173 <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
174 <xsl:otherwise>rtl</xsl:otherwise>
175 </xsl:choose>
176 </xsl:attribute>
177 </xsl:if>
178 <xsl:copy-of select="$content"/>
179 </fo:inline>
180 </xsl:template>
181
182 <!-- inline.italicmonoseq:
183 Added hyphenate-url support to parameter, replaceable, structfield,
184 function/parameter, and function/replaceable -->
185 <!-- The original template is in {docbook-xsl}/fo/inline.xsl -->
186 <xsl:template name="inline.italicmonoseq">
187 <xsl:param name="content">
188 <xsl:call-template name="simple.xlink">
189 <xsl:with-param name="content">
190 <xsl:choose>
191 <xsl:when test="ancestor::para and not(ancestor::screen)
192 and not(descendant::ulink)">
193 <xsl:call-template name="hyphenate-url">
194 <xsl:with-param name="url">
195 <xsl:apply-templates/>
196 </xsl:with-param>
197 </xsl:call-template>
198 </xsl:when>
199 <xsl:otherwise>
200 <xsl:apply-templates/>
201 </xsl:otherwise>
202 </xsl:choose>
203 </xsl:with-param>
204 </xsl:call-template>
205 </xsl:param>
206 <fo:inline font-style="italic" xsl:use-attribute-sets="monospace.properties">
207 <xsl:call-template name="anchor"/>
208 <xsl:if test="@dir">
209 <xsl:attribute name="direction">
210 <xsl:choose>
211 <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
212 <xsl:otherwise>rtl</xsl:otherwise>
213 </xsl:choose>
214 </xsl:attribute>
215 </xsl:if>
216 <xsl:copy-of select="$content"/>
217 </fo:inline>
218 </xsl:template>
219
220 <!-- Show external URLs in italic font -->
221 <xsl:attribute-set name="xref.properties">
222 <xsl:attribute name="font-style">
223 <xsl:choose>
224 <xsl:when test="self::ulink">italic</xsl:when>
225 <xsl:otherwise>inherit</xsl:otherwise>
226 </xsl:choose>
227 </xsl:attribute>
228 </xsl:attribute-set>
229
230 <!-- Center table title. -->
231 <xsl:attribute-set name="formal.title.properties">
232 <xsl:attribute name="text-align">
233 <xsl:choose>
234 <xsl:when test="local-name(.) = 'table'">center</xsl:when>
235 <xsl:otherwise>left</xsl:otherwise>
236 </xsl:choose>
237 </xsl:attribute>
238 </xsl:attribute-set>
239
240 <!-- table.layout:
241 We want all tables centered. Based on a hack posted
242 by Ellen Juhlin on docbook-apps mailing list. -->
243 <!-- The original template is in {docbook-xsl}/fo/table.xsl -->
244 <xsl:template name="table.layout">
245 <xsl:param name="table.content" select="NOTANODE"/>
246 <fo:table table-layout="fixed" width="100%">
247 <fo:table-column column-width ="proportional-column-width(1)"/>
248 <fo:table-column>
249 <!-- Set center column width equal to table width -->
250 <xsl:attribute name="column-width">
251 <xsl:call-template name="table.width"/>
252 </xsl:attribute>
253 </fo:table-column>
254 <fo:table-column column-width ="proportional-column-width(1)"/>
255 <fo:table-body>
256 <fo:table-row>
257 <fo:table-cell column-number="2">
258 <xsl:copy-of select="$table.content"/>
259 </fo:table-cell>
260 </fo:table-row>
261 </fo:table-body>
262 </fo:table>
263 </xsl:template>
264
265
266 <!-- Revision History -->
267
268 <!-- revhistory titlepage:
269 Self-made template to add missing support on bookinfo. -->
270 <xsl:template match="revhistory" mode="book.titlepage.verso.auto.mode">
271 <fo:block space-before.optimum="2em"
272 space-before.minimum="1.5em"
273 space-before.maximum="2.5em">
274 <xsl:apply-templates select="." mode="book.titlepage.verso.mode"/>
275 </fo:block>
276 </xsl:template>
277
278 <!-- revhitory title properties -->
279 <xsl:attribute-set name="revhistory.title.properties">
280 <xsl:attribute name="text-align">center</xsl:attribute>
281 <xsl:attribute name="font-weight">bold</xsl:attribute>
282 </xsl:attribute-set>
283
284 <!-- revhistory/revision mode titlepage.mode:
285 Removed authorinitials | author support placing
286 revremark | revdescription instead on that table-cell. -->
287 <!-- The original template is in {docbook-xsl}/fo/titlepage.xsl -->
288 <xsl:template match="revhistory/revision" mode="titlepage.mode">
289 <xsl:variable name="revnumber" select="revnumber"/>
290 <xsl:variable name="revdate" select="date"/>
291 <xsl:variable name="revremark" select="revremark|revdescription"/>
292 <fo:table-row>
293 <fo:table-cell xsl:use-attribute-sets="revhistory.table.cell.properties">
294 <fo:block>
295 <xsl:if test="$revnumber">
296 <xsl:call-template name="gentext">
297 <xsl:with-param name="key" select="'Revision'"/>
298 </xsl:call-template>
299 <xsl:call-template name="gentext.space"/>
300 <xsl:apply-templates select="$revnumber[1]" mode="titlepage.mode"/>
301 </xsl:if>
302 </fo:block>
303 </fo:table-cell>
304 <fo:table-cell xsl:use-attribute-sets="revhistory.table.cell.properties">
305 <fo:block>
306 <xsl:apply-templates select="$revdate[1]"/>
307 </fo:block>
308 </fo:table-cell>
309 <fo:table-cell xsl:use-attribute-sets="revhistory.table.cell.properties">
310 <fo:block>
311 <xsl:apply-templates select="$revremark[1]"/>
312 </fo:block>
313 </fo:table-cell>
314 </fo:table-row>
315 </xsl:template>
316
317
318 <!-- Dummy sect1 -->
319
320 <!-- sect1:
321 Self-made template to skip dummy sect1 pages generation. -->
322 <xsl:template match="sect1">
323 <xsl:choose>
324 <xsl:when test="@role = 'dummy'"/>
325 <xsl:otherwise>
326 <xsl:apply-imports/>
327 </xsl:otherwise>
328 </xsl:choose>
329 </xsl:template>
330
331 <!-- sect1 mode fop1.outline:
332 Self-made template to skip dummy sect1 bookmarks generation. -->
333 <xsl:template match="sect1" mode="fop1.outline">
334 <xsl:choose>
335 <xsl:when test="@role = 'dummy'"/>
336 <xsl:otherwise>
337 <xsl:apply-imports/>
338 </xsl:otherwise>
339 </xsl:choose>
340 </xsl:template>
341
342 <!-- toc.line:
343 For dummy sect1 output only the title. -->
344 <!-- The original template is in {docbook-xsl}/fo/autotoc.xsl -->
345 <xsl:template name="toc.line">
346 <xsl:param name="toc-context" select="NOTANODE"/>
347 <xsl:variable name="id">
348 <xsl:call-template name="object.id"/>
349 </xsl:variable>
350 <xsl:variable name="label">
351 <xsl:apply-templates select="." mode="label.markup"/>
352 </xsl:variable>
353 <xsl:choose>
354 <xsl:when test="@role = 'dummy'">
355 <fo:block text-align="left">
356 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
357 </fo:block>
358 </xsl:when>
359 <xsl:otherwise>
360 <fo:block xsl:use-attribute-sets="toc.line.properties">
361 <fo:inline keep-with-next.within-line="always">
362 <fo:basic-link internal-destination="{$id}">
363 <xsl:if test="$label != ''">
364 <xsl:copy-of select="$label"/>
365 <xsl:value-of select="$autotoc.label.separator"/>
366 </xsl:if>
367 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
368 </fo:basic-link>
369 </fo:inline>
370 <fo:inline keep-together.within-line="always">
371 <xsl:text> </xsl:text>
372 <fo:leader leader-pattern="dots"
373 leader-pattern-width="3pt"
374 leader-alignment="reference-area"
375 keep-with-next.within-line="always"/>
376 <xsl:text> </xsl:text>
377 <fo:basic-link internal-destination="{$id}">
378 <fo:page-number-citation ref-id="{$id}"/>
379 </fo:basic-link>
380 </fo:inline>
381 </fo:block>
382 </xsl:otherwise>
383 </xsl:choose>
384 </xsl:template>
385
386</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.