Download this file

xmlmake.sh    61 lines (52 with data), 1.9 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
# A script to produce the Sqlscreens manual with an xml toolchain.
# Limitations:
# - Does not produce the links to the whole/chunked versions at the top
# of the document
# - The anchor names from the source text are converted to uppercase by
# the sgml toolchain. This does not happen with the xml toolchain.
# This means that all ids inside the source file must be
# upper-case for the xml and sgml toolchains to generate
# compatible anchors/links.
# - No simple way to produce pdf
# Wherever docbook.xsl and chunk.xsl live
# Fbsd
#XSLDIR="/usr/local/share/xsl/docbook/"
# Mac
#XSLDIR="/opt/local/share/xsl/docbook-xsl/"
#Linux
XSLDIR="/usr/share/xml/docbook/stylesheet/docbook-xsl/"
dochunky=0
test $# -eq 1 && dochunky=0
# Remove the SGML header and uncomment the XML one + convert from iso-8859-1
# to utf-8
sed -e '\!//FreeBSD//DTD!d' \
-e '\!DTD DocBook XML!s/<!--//' \
-e '\!/docbookx.dtd!s/-->//' \
< sqlscreens.sgml \
| iconv -f iso-8859-1 -t utf-8 \
> sqlscreens.xml
# Options common to the single-file and chunked versions
commonoptions="--stringparam section.autolabel 1 \
--stringparam section.autolabel.max.depth 3 \
--stringparam section.label.includes.component.label 1 \
--stringparam autotoc.label.in.hyperlink 0 \
--stringparam abstract.notitle.enabled 1 \
--stringparam html.stylesheet docbook-xsl.css \
--stringparam generate.toc \"book toc,title,figure,table,example,equation\" \
"
# Do the chunky thing
if test $dochunky -ne 0 ; then
eval xsltproc $commonoptions \
--stringparam use.id.as.filename 1 \
--stringparam root.filename index \
"$XSLDIR/html/chunk.xsl" \
sqlscreens.xml
fi
# Produce the single file version
eval xsltproc $commonoptions \
-o sqlscreens.html \
"$XSLDIR/html/docbook.xsl" \
sqlscreens.xml
tidy -indent sqlscreens.html > tmpfile
mv -f tmpfile sqlscreens.html