Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | #!/bin/sh |
Andrew Geissler | 4ed12e1 | 2020-06-05 18:00:41 -0500 | [diff] [blame] | 2 | # |
| 3 | # SPDX-License-Identifier: CC-BY-2.0-UK |
| 4 | # |
| 5 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 6 | if [ -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 |
| 13 | fi |
| 14 | |
| 15 | FO=`echo $1 | sed s/.xml/.fo/` || exit 1 |
| 16 | PDF=`echo $1 | sed s/.xml/.pdf/` || exit 1 |
| 17 | TEMPLATEDIR=$2 |
| 18 | |
| 19 | ## |
| 20 | # These URI should be rewritten by your distribution's xml catalog to |
| 21 | # match your localy installed XSL stylesheets. |
| 22 | XSL_BASE_URI="http://docbook.sourceforge.net/release/xsl/current" |
| 23 | |
| 24 | # Creates a temporary XSL stylesheet based on titlepage.xsl |
| 25 | xsltproc -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 |
| 31 | xsltproc --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 |
| 47 | fop -c $TEMPLATEDIR/fop-config.xml -fo $FO -pdf $PDF || exit 1 |
| 48 | |
| 49 | rm -f $FO |
| 50 | rm -f /tmp/titlepage.xsl |
| 51 | |
| 52 | echo |
| 53 | echo " #### Success! $PDF ready. ####" |
| 54 | echo |