> Yes realized later on I could copy the images over myself so not such

> a big deal, but a bit inconsistent don't you think ?

> As much as possible I want to create one help file and not consider

> the output formats at all whilst writing it, then one click I want it

> rendered nicely for each formats

>

> Paul



I didn't even want one click, so I wrote a script that pulls everything from my 
Subversion server and builds all the formats I want. It runs nightly, so all I 
have to do to update the documentation is commit the changes to source control. 
The script I use is below in case it is useful to someone. (Sorry if it’s 
overkill for some cases, but I really needed XIncludes and cross-references.)



Regards,

Paul Bort

Systems Engineer

TMW Systems, Inc.

pb...@tmwsystems.com

440 721 2233 (voice)

440 290 2662 (fax)



----------------------


#!/bin/bash

# Builds documentation from checked-in source

# *** Requires CentOS/SL 6 ***
#   and `yum -y install subversion rsync libxml2 libxslt fop`
#   or equivalent

echo ___ Prep ___

BASE=/var/product/sandbox
WORK=$BASE/export
OUT=$BASE/docbook
SVN=https://user@my.subversion.local/svn/trunk

mkdir -p $WORK
cd $WORK || exit 1

rm -rf docbook-xml docbook-xsl img
svn export $SVN/docbook-xml
svn export $SVN/docbook-xsl
svn export $SVN/docbook/prod

rm -rf $OUT/*
mkdir -p $OUT

echo ___ Validate ___

xmllint --timing --xinclude --noout --postvalid --noent --nonet \
    --dtdvalid $WORK/docbook-xml/docbookx.dtd $WORK/prod/prod.xml

# TODO - Stop if validation fails

echo ___ Build webhelp ___

mkdir -p $OUT/webhelp

xsltproc --timing --xinclude --stringparam collect.xref.targets "only" \
    --stringparam current.docid "prod" --stringparam targets.filename \
    "$WORK/prod/targets-xhtml.db" $WORK/docbook-xsl/webhelp/xsl/webhelp.xsl 
$WORK/prod/prod.xml

xsltproc --xinclude --timing --stringparam current.docid "prod" \
    --stringparam target.database.document "$WORK/prod/olinkdb-xhtml.xml" 
--output \
    $OUT/webhelp/index.html $WORK/docbook-xsl/webhelp/xsl/webhelp.xsl 
$WORK/prod/prod.xml

mkdir -p $OUT/webhelp/docs/common
cp -r $WORK/docbook-xsl/webhelp/template/common/* $OUT/webhelp/docs/common

mkdir -p $OUT/webhelp/docs/content/images
cp -r $WORK/prod/images/* $OUT/webhelp/docs/content/images

mkdir -p $OUT/webhelp/docs/content/figure
cp -r $WORK/prod/figure/* $OUT/webhelp/docs/content/figure

mkdir -p $OUT/webhelp/docs/content/search
cp -r $WORK/docbook-xsl/webhelp/template/content/search/* 
$OUT/webhelp/docs/content/search

cd $WORK/docbook-xsl/webhelp
ant index

cd $OUT/webhelp/docs
tar czf $BASE/webhelp.tgz *

tar zxf $BASE/webhelp.tgz -C /var/www/html/doc

echo ___ Build Complete PDF ___

mkdir -p $OUT/pdf/images
mkdir -p $OUT/pdf/figure
rsync -r $WORK/prod/figure/* $OUT/pdf/figure
rsync -r $WORK/prod/images/* $OUT/pdf/images

xsltproc --timing --xinclude --stringparam collect.xref.targets "only" \
    --stringparam current.docid "prod" --stringparam targets.filename \
    "$WORK/prod/targets-fo.db" $WORK/docbook-xsl/fo/docbook.xsl 
$WORK/prod/prod.xml

xsltproc --xinclude --timing --stringparam current.docid "prod" \
    --stringparam target.database.document "$WORK/prod/olinkdb-fo.xml" --output 
\
    $OUT/pdf/prod.fo $WORK/docbook-xsl/fo/docbook.xsl $WORK/prod/prod.xml

fop $OUT/pdf/prod.fo $OUT/pdf/prod.pdf

ln -s $OUT/pdf/prod.pdf $OUT/product.pdf

echo ___ Build HOWTOs ___

# Some chapters of the main documentation are
#   articles so that they can be built as
#   separate PDFs and sent to customers.

for art in os divisions scanner; do

    echo ___ Build HOWTO PDF $art ___

    mkdir -p $OUT/howto/$art/images
    mkdir -p $OUT/howto/$art/figure
    rsync -r $WORK/prod/figure/* $OUT/howto/$art/figure
    rsync -r $WORK/prod/images/* $OUT/howto/$art/images

    xsltproc --xinclude --timing --stringparam current.docid 
"product-howto-$art" \
        --stringparam target.database.document "$WORK/prod/olinkdb-fo.xml" 
--output \
        $OUT/howto/$art/howto-$art.fo $WORK/docbook-xsl/fo/docbook.xsl 
$WORK/prod/howto-$art.xml

    fop $OUT/howto/$art/howto-$art.fo $OUT/howto/$art/howto-$art.pdf

    ln -s $OUT/howto/$art/howto-$art.pdf $OUT/howto-$art.pdf

done



Reply via email to