Skip to content

Commit 563facd

Browse files
committed
Added the necessary XSL and LaTeX styles to render a book for print
1 parent 2e11cc3 commit 563facd

14 files changed

+929
-8
lines changed

build.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ echo "--- Converting images - Finished ---"
1616

1717
# Build the Single HTML Page Version
1818
echo "--- Building single HTML page version - Started ---"
19-
asciidoc -o target/book-hudson.html content/book-hudson.doc
19+
#asciidoc -o target/book-hudson.html content/book-hudson.doc
2020
echo "--- Building single HTML page version - Finished ---"
2121

2222
# Build the PDF
@@ -26,12 +26,12 @@ cp -r content/figs target
2626
cp -r content/images target
2727

2828
echo "--- Building PDF version - Started ---"
29-
a2x -v -k -fpdf -dbook --dblatex-opts=" -P latex.output.revhistory=0" -D target content/book-hudson.doc
29+
a2x -v -k -fpdf -dbook --xsl-file=docbook-xsl/fo.xsl --dblatex-opts=" -P latex.output.revhistory=0 -s ./latex/custom-docbook.sty" -D target content/book-hudson.doc
3030
echo "--- Building PDF version - Finished ---"
3131

3232
# Build the Chunked HTML
3333
echo "--- Building chunked HTML version - Started ---"
34-
a2x -v -k -fchunked -dbook --dblatex-opts=" -P latex.output.revhistory=0" -D target content/book-hudson.doc
34+
#a2x -v -k -fchunked -dbook --dblatex-opts=" -P latex.output.revhistory=0" -D target content/book-hudson.doc
3535
echo "--- Building chunked HTML page version - Finished ---"
3636

3737
echo "--- Build successful --"

docbook-xsl/asciidoc-docbook-xsl.txt

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
AsciiDoc DocBook XSL Stylesheets Notes
2+
======================================
3+
4+
Output file customisation is achieved by tweaking the DocBook XSL
5+
stylesheets. I've tried to keep customization to a minimum and
6+
confine it to the separate XSL driver files in the distribution
7+
`./docbook-xsl/` directory (see the User Guide for details).
8+
9+
To polish some rough edges I've written some patches for the DocBook
10+
XSL stylesheets -- you don't need them but they're documented below
11+
and included in the distribution `./docbook-xsl/` directory.
12+
13+
14+
Manually upgrading Debian to the latest DocBook XSL stylesheets
15+
---------------------------------------------------------------
16+
The DocBook XSL Stylesheets distribution is just a directory full of
17+
text files and you can switch between releases by changing the
18+
directory name in the system XML catalog.
19+
20+
To upgrade to the latest docbook-xsl stylesheets without having to
21+
wait for the Debian `docbook-xsl` package:
22+
23+
- Download the latest docbook-xsl tarball from
24+
http://sourceforge.net/projects/docbook/. Bleeding edge snapshots
25+
can be found at http://docbook.sourceforge.net/snapshots/
26+
27+
- Unzip the tarball to `/usr/share/xml/docbook/stylesheet/`:
28+
29+
$ cd /usr/share/xml/docbook/stylesheet
30+
$ sudo tar -xzf /tmp/docbook-xsl-1.72.0.tar.gz
31+
32+
- Edit `/etc/xml/docbook-xsl.xml` catalog and replace occurences of
33+
the current stylesheets directory with the new one (in our example
34+
it would be `/usr/share/xml/docbook/stylesheet/docbook-xsl-1.72.0`.
35+
36+
$ cd /etc/xml/
37+
$ sudo cp -p docbook-xsl.xml docbook-xsl.xml.ORIG
38+
$ sudo vi docbook-xsl.xml
39+
40+
41+
Customizing Generated Text
42+
--------------------------
43+
An example
44+
http://www.sagehill.net/docbookxsl/CustomGentext.html#CustomGenText[DocBook
45+
XSL Stylesheets customization file] for formatting chapter titles
46+
without chapter numbering.
47+
48+
.custom-chapter.xml
49+
---------------------------------------------------------------------
50+
<!-- Customize chapter title -->
51+
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
52+
<l:l10n language="en">
53+
<l:context name="title">
54+
<l:template name="chapter" text="%t"/>
55+
</l:context>
56+
</l:l10n>
57+
</l:i18n>
58+
---------------------------------------------------------------------
59+
60+
Executed with this 'xsltproc' parameter:
61+
62+
--param local.l10n.xml document\(\'custom-chapter.xml\'\)
63+
64+
NOTE: This example is hypothetical -- use the 'xsltproc'
65+
`--stringparam chapter.autolabel 0` option to do the same job.

docbook-xsl/chunked.xsl

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!--
2+
Generates chunked XHTML documents from DocBook XML source using DocBook XSL
3+
stylesheets.
4+
5+
NOTE: The URL reference to the current DocBook XSL stylesheets is
6+
rewritten to point to the copy on the local disk drive by the XML catalog
7+
rewrite directives so it doesn't need to go out to the Internet for the
8+
stylesheets. This means you don't need to edit the <xsl:import> elements on
9+
a machine by machine basis.
10+
-->
11+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
12+
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/>
13+
<xsl:import href="common.xsl"/>
14+
<xsl:param name="navig.graphics.path">images/icons/</xsl:param>
15+
<xsl:param name="admon.graphics.path">images/icons/</xsl:param>
16+
<xsl:param name="callout.graphics.path" select="'images/icons/callouts/'"/>
17+
</xsl:stylesheet>

docbook-xsl/common.xsl

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<!--
2+
Inlcuded in xhtml.xsl, xhtml.chunked.xsl, htmlhelp.xsl.
3+
Contains common XSL stylesheets parameters.
4+
Output documents styled by docbook.css.
5+
-->
6+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
7+
<xsl:param name="html.stylesheet" select="'docbook-xsl.css'"/>
8+
9+
<xsl:param name="htmlhelp.chm" select="'htmlhelp.chm'"/>
10+
<xsl:param name="htmlhelp.hhc.section.depth" select="5"/>
11+
12+
<xsl:param name="section.autolabel">
13+
<xsl:choose>
14+
<xsl:when test="/processing-instruction('asciidoc-numbered')">1</xsl:when>
15+
<xsl:otherwise>0</xsl:otherwise>
16+
</xsl:choose>
17+
</xsl:param>
18+
19+
<xsl:param name="suppress.navigation" select="0"/>
20+
<xsl:param name="navig.graphics.extension" select="'.png'"/>
21+
<xsl:param name="navig.graphics" select="0"/>
22+
<xsl:param name="navig.graphics.path">images/icons/</xsl:param>
23+
<xsl:param name="navig.showtitles">0</xsl:param>
24+
25+
<xsl:param name="shade.verbatim" select="0"/>
26+
<xsl:attribute-set name="shade.verbatim.style">
27+
<xsl:attribute name="border">0</xsl:attribute>
28+
<xsl:attribute name="background-color">#E0E0E0</xsl:attribute>
29+
</xsl:attribute-set>
30+
31+
<xsl:param name="admon.graphics" select="1"/>
32+
<xsl:param name="admon.graphics.path">images/icons/</xsl:param>
33+
<xsl:param name="admon.graphics.extension" select="'.png'"/>
34+
<xsl:param name="admon.style">
35+
<xsl:text>margin-left: 0; margin-right: 10%;</xsl:text>
36+
</xsl:param>
37+
<xsl:param name="admon.textlabel" select="1"/>
38+
39+
<xsl:param name="callout.defaultcolumn" select="'60'"/>
40+
<xsl:param name="callout.graphics.extension" select="'.png'"/>
41+
<xsl:param name="callout.graphics" select="'1'"/>
42+
<xsl:param name="callout.graphics.number.limit" select="'10'"/>
43+
<xsl:param name="callout.graphics.path" select="'images/icons/callouts/'"/>
44+
<xsl:param name="callout.list.table" select="'1'"/>
45+
46+
<!-- This does not seem to work. -->
47+
<xsl:param name="section.autolabel.max.depth" select="2"/>
48+
49+
<xsl:param name="chunk.first.sections" select="1"/>
50+
<xsl:param name="chunk.section.depth" select="1"/>
51+
<xsl:param name="chunk.quietly" select="0"/>
52+
<xsl:param name="chunk.toc" select="''"/>
53+
<xsl:param name="chunk.tocs.and.lots" select="0"/>
54+
55+
<xsl:param name="html.cellpadding" select="'4px'"/>
56+
<xsl:param name="html.cellspacing" select="''"/>
57+
58+
<xsl:param name="table.borders.with.css" select="1"/>
59+
<xsl:param name="table.cell.border.color" select="'#527bbd'"/>
60+
61+
<xsl:param name="table.cell.border.style" select="'solid'"/>
62+
<xsl:param name="table.cell.border.thickness" select="'1px'"/>
63+
<xsl:param name="table.footnote.number.format" select="'a'"/>
64+
<xsl:param name="table.footnote.number.symbols" select="''"/>
65+
<xsl:param name="table.frame.border.color" select="'#527bbd'"/>
66+
<xsl:param name="table.frame.border.style" select="'solid'"/>
67+
<xsl:param name="table.frame.border.thickness" select="'3px'"/>
68+
<xsl:param name="tablecolumns.extension" select="'1'"/>
69+
70+
<xsl:param name="highlight.source" select="1"/>
71+
72+
<xsl:param name="section.label.includes.component.label" select="1"/>
73+
74+
<!--
75+
Table of contents inserted by <?asciidoc-toc?> processing instruction.
76+
-->
77+
<xsl:param name="generate.toc">
78+
<xsl:choose>
79+
<xsl:when test="/processing-instruction('asciidoc-toc')">
80+
article toc,title
81+
book toc,title,figure,table,example,equation
82+
<!-- The only way I could find that suppressed book chapter TOCs -->
83+
<xsl:if test="$generate.section.toc.level != 0">
84+
chapter toc,title
85+
part toc,title
86+
preface toc,title
87+
qandadiv toc
88+
qandaset toc
89+
reference toc,title
90+
sect1 toc
91+
sect2 toc
92+
sect3 toc
93+
sect4 toc
94+
sect5 toc
95+
section toc
96+
set toc,title
97+
</xsl:if>
98+
</xsl:when>
99+
<xsl:otherwise>
100+
article nop
101+
book nop
102+
</xsl:otherwise>
103+
</xsl:choose>
104+
</xsl:param>
105+
106+
</xsl:stylesheet>

0 commit comments

Comments
 (0)