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