Mercurial > hg > batmud > ggrtf
view docs/build-docs.sh @ 1540:1f18749befb4
Fix tests for catalogs.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 18 Apr 2013 04:34:46 +0300 |
parents | 9836b6ed8f09 |
children | cfcbe5e0c12e |
line wrap: on
line source
#!/bin/sh ### Settings DOCBOOKBASE="/usr/share/xml/docbook/stylesheet/docbook-xsl" UPURL="ccr@tnsp.org:public_html/ggrtf" TFPATH="../" SRCSGML="manual.sgml" SRCXML="manual.xml" SRCFO="manual.fo" HTMLPATH="html" HTMLFILE="$HTMLPATH/manual.html" PDFFILE="manual.pdf" PSFILE="manual.ps" XSLTPARAMS="--stringparam html.stylesheet manual.css" ### Get paths, if available echo "* Initialization" CPWD=`pwd` CONVERT=`which convert` PNMTOPS=`which pnmtops` GIFTOPNM=`which giftopnm` TIDY=`which tidy` XSLTPROC=`which xsltproc` XMLROFF=`which xmlroff` CATALOGS1="$DOCBOOKBASE/xhtml/chunk.xsl" CATALOGS2="$DOCBOOKBASE/xhtml/docbook.xsl" CATALOGS3="$DOCBOOKBASE/fo/docbook.xsl" ### Convert images echo "* Checking for image to EPS converting utilities ..." if test -n "$CONVERT" && test -x "$CONVERT"; then echo "** GraphicsMagic/ImageMagick convert found" for i in *.gif; do TOUTFILE=`echo "$i" | sed "s/.gif/.eps/"` echo " - $i -> $TOUTFILE" $CONVERT "$i" "$TOUTFILE" done elif test -n "$PNMTOPS" && test -x "$PNMTOPS" && test -n "$GIFTOPNM" && test -x "$GIFTOPNM"; then echo "** NetPBM tools found" for i in *.gif; do TOUTFILE=`echo "$i" | sed "s/.gif/.eps/"` echo " - $i -> $TOUTFILE" $GIFTOPNM "$i" | $PNMTOPS -scale=0.5 -noturn > "$TOUTFILE" done else echo "*** WARNING! No supported image conversion tools found, not converting images." echo "*** This may cause some document format conversions to fail or produce errors." fi ### Check that we have xsltproc installed for DocBook XML processing if test -n "$XSLTPROC" && test -x "$XSLTPROC"; then echo "* xsltproc found, good... testing for DocBook XML stuff .." if test -e "$CATALOGS1"; then echo " * $CATALOGS1 found." else echo "*** xhtml/chunk.xsl not found!" exit 1 fi if test -e "$CATALOGS2"; then echo " * $CATALOGS2 found." else echo "*** xhtml/docbook.xsl not found!" exit 1 fi if test -e "$CATALOGS3"; then echo " * $CATALOGS3 found." else echo "*** fo/docbook.xsl not found!" exit 1 fi else echo "*** ERROR! Could not find xsltproc! You need xsltproc and the" echo "*** DocBook XML suite (with XSL stylesheets) to be able to" echo "*** generate the documentation!" exit 1 fi ### Generate kludge-normalized XML from the DocBook SGML source ( perl -w tfdoc.pl "$TFPATH" < "$SRCSGML" | perl -w normalizeml.pl > "$SRCXML" ) || exit 1 ### Generate HTML files echo "* HTML" if test -e "$HTMLPATH"; then rm -fr "$HTMLPATH" fi mkdir -p "$HTMLPATH" if test -d "$HTMLPATH"; then cp *.css *.png *.gif "$HTMLPATH" && cd "$HTMLPATH" && $XSLTPROC $XSLTPARAMS "$CATALOGS1" "../$SRCXML" cd "$CPWD" if $XSLTPROC $XSLTPARAMS "$CATALOGS2" "$SRCXML" > "$HTMLFILE"; then echo " * Transform successful." else echo "*** ERROR! $XSLTPROC failed. Quitting on fatal error." echo "*** Check $SRCXML for errors." exit 2 fi echo " * Checking for HTML Tidy ..." if test -n "$TIDY" && test -x "$TIDY"; then echo "** Found, cleaning up the mess by DocBook .." if $TIDY -q -w 512 -utf8 -asxhtml -i -m $HTMLPATH/*.html "$HTMLFILE"; then echo "** Tidying process successful." fi else echo "*** WARNING! HTML tidy not found! To get better HTML output," echo "*** please install HTML tidy (http://tidy.sourceforge.net/)" fi fi ### Generate PostScript file rm -f "$PSFILE" if test -n "$XMLROFF" && test -x "$XMLROFF" && test -e "$SRCXML"; then echo "* PostScript" $XSLTPROC "$CATALOGS3" "$SRCXML" > "$SRCFO" $XMLROFF # rm -f "$SRCFO" fi ## Upload if test "x$1" = "x--upload"; then scp -C $HTMLPATH/* manual.css "$UPURL/html/" scp -C "$PSFILE" "$PDFFILE" "$UPURL" scp -C "$HOME/bin/tf5" "$UPURL/tf5.sh" fi