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