blob: b36e74b6bedf9d8e78f96c80c341c2c3cd12e9f7 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001#!/bin/sh
Andrew Geissler4ed12e12020-06-05 18:00:41 -05002#
3# SPDX-License-Identifier: CC-BY-2.0-UK
4#
5
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006if [ -z "$1" -o -z "$2" ]; then
7 echo "usage: [-v] $0 <docbook file> <templatedir>"
8 echo
9 echo "*NOTE* you need xsltproc, fop and nwalsh docbook stylesheets"
10 echo " installed for this to work!"
11 echo
12 exit 0
13fi
14
15FO=`echo $1 | sed s/.xml/.fo/` || exit 1
16PDF=`echo $1 | sed s/.xml/.pdf/` || exit 1
17TEMPLATEDIR=$2
18
19##
20# These URI should be rewritten by your distribution's xml catalog to
21# match your localy installed XSL stylesheets.
22XSL_BASE_URI="http://docbook.sourceforge.net/release/xsl/current"
23
24# Creates a temporary XSL stylesheet based on titlepage.xsl
25xsltproc -o /tmp/titlepage.xsl \
26 --xinclude \
27 $XSL_BASE_URI/template/titlepage.xsl \
28 $TEMPLATEDIR/titlepage.templates.xml || exit 1
29
30# Creates the file needed for FOP
31xsltproc --xinclude \
32 --stringparam hyphenate false \
33 --stringparam formal.title.placement "figure after" \
34 --stringparam ulink.show 1 \
35 --stringparam body.font.master 9 \
36 --stringparam title.font.master 11 \
37 --stringparam draft.watermark.image "$TEMPLATEDIR/draft.png" \
38 --stringparam chapter.autolabel 1 \
39 --stringparam appendix.autolabel A \
40 --stringparam section.autolabel 1 \
41 --stringparam section.label.includes.component.label 1 \
42 --output $FO \
43 $TEMPLATEDIR/poky-db-pdf.xsl \
44 $1 || exit 1
45
46# Invokes the Java version of FOP. Uses the additional configuration file common/fop-config.xml
47fop -c $TEMPLATEDIR/fop-config.xml -fo $FO -pdf $PDF || exit 1
48
49rm -f $FO
50rm -f /tmp/titlepage.xsl
51
52echo
53echo " #### Success! $PDF ready. ####"
54echo