Mercurial > hg > batmud > ggrtf
view docs/build-docs.sh @ 640:6dc4d0b19975
Added CSS stylesheets to HTML output.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 11 Jun 2007 03:42:13 +0000 |
parents | d7b6d60112d5 |
children | 6b608ea3f7af |
line wrap: on
line source
#!/bin/sh ### Settings SRCFILE="manual.sgml" SRCTMP="manual.xml" HTMLPATH="html" HTMLFILE="manual.html" TXTFILE="manual.txt" PSFILE="manual.ps" XSLTPARAMS="--stringparam html.stylesheet manual.css" ### Get paths, if available echo "* Initialization" CPWD=`pwd` GS=`which gs` CONVERT=`which convert` PNMTOPS=`which pnmtops` GIFTOPNM=`which giftopnm` TIDY=`which tidy` XSLTPROC=`which xsltproc` XMLROFF=`which xmlroff` CATALOGS1=`locate xhtml/chunk.xsl|head -1` CATALOGS2=`locate xhtml/docbook.xsl|head -1` CATALOGS3=`locate fo/docbook.xsl|head -1` LINKS=`which links` ELINKS=`which elinks` LYNX=`which lynx` ### Convert images echo "* Checking for image to EPS converting utilities ..." if test -n "$PNMTOPS" && test -x "$PNMTOPS" && test -n "$GIFTOPNM" && test -x "$GIFTOPNM"; then echo "** NetPBM tools found" for i in *.gif; do echo " - $i" $GIFTOPNM "$i" | $PNMTOPS -scale=0.5 -noturn > `echo "$i" | sed "s/.gif/.eps/"` done elif test -n "$CONVERT" && test -x "$CONVERT"; then echo "** ImageMagick found" for i in *.gif; do echo " - $i" $CONVERT "$i" `echo "$i" | sed "s/.gif/.eps/"` 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 -n "$CATALOGS1"; then echo " * $CATALOGS1 found." else echo "*** xhtml/chunk.xsl not found!" exit 1 fi if test -n "$CATALOGS2"; then echo " * $CATALOGS2 found." else echo "*** xhtml/docbook.xsl not found!" exit 1 fi perl -w normalizeml.pl < "$SRCFILE" > "$SRCTMP" 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 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" "../$SRCTMP" cd "$CPWD" $XSLTPROC $XSLTPARAMS "$CATALOGS2" "$SRCTMP" > "$HTMLFILE" echo "** Checking for HTML Tidy ..." if test -n "$TIDY" && test -x "$TIDY"; then echo "** Found, cleaning up the mess by DocBook .." $TIDY -w 120 -utf8 -asxhtml -i -m $HTMLPATH/*.html "$HTMLFILE" else echo "*** WARNING! HTML tidy not found." fi fi ### Generate PostScript file rm -f "$PSFILE" if test -n "$XMLROFF" && test -x "$XMLROFF" && test -e "$SRCTMP"; then echo "* PostScript" $XSLTPROC "$CATALOGS3" "$SRCTMP" > tmp.fo fi #rm -f "$SRCTMP" ### Generate PDF if test -n "$GS" && test -x "$GS" && test -e "$PSFILE"; then echo "* PDF ..." rm -f manual.pdf $GS -dSAFER -dCompatibilityLevel=1.2 -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \ -sOutputFile=manual.pdf -dCompatibilityLevel=1.2 -c .setpdfwrite -f manual.ps else echo "*** WARNING! GhostScript does not seem to be installed." echo "*** PDF version of the manual will not be generated." fi ### Generate ASCII text if test -e "$HTMLFILE"; then echo "* Text" if test -n "$LINKS" && test -x "$LINKS"; then $LINKS -dump "$HTMLFILE" > "$TXTFILE" elif test -n "$ELINKS" && test -x "$ELINKS"; then $ELINKS -dump "$HTMLFILE" > "$TXTFILE" elif test -n "$LYNX" && test -x "$LYNX"; then echo "foobar" else echo "*** No Links, ELinks or Lynx found. Not generating plaintext documentation." fi fi