generalise the HTML creation process too.

git-svn-id: http://emdebian.org/svn/current@6622 563faec7-e20c-0410-992a-a66f704d0ccd
This commit is contained in:
codehelp 2009-09-15 15:30:59 +00:00
parent 0f7a65cf57
commit 9259c1ca6c

View file

@ -22,6 +22,10 @@ set -e
CONFIG="doc/po4a.config"
# POTFILE path
POTFILE="po/emdebian-rootfs.pot"
# The scripts with translated output
SCRIPTS="em_multistrap"
# The language to declare for the SCRIPTS
SCRIPTS_LANG="perl"
# the binary packages that will contain generated manpages
BINARIES="emdebian-rootfs multistrap"
# the binary packages with manpages in Section 3.
@ -30,12 +34,20 @@ HASMAN3="emdebian-rootfs"
XMLPACKAGES="emdebian-rootfs"
# the DocBook XML files (TODO: let this take paths)
XMLFILE="emdebian-rootfs.1.xml"
# the directory containing the XML files
XMLDIR="doc/xml"
# the pattern to find the .docbook files
DOCBOOKDIR=""
# the XSL file to use for Docbook XSL
XSLFILE="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
# the POD files (TODO: let this take paths)
PODFILE="em_multistrap"
# the binary packages using POD
PODPACKAGES="multistrap"
# html output
HTMLDIR="doc/html"
# html DocBook file
HTMLFILE="emdebian-rootfs.1.xml"
# remember to add something to the clean:: rule in debian/rules
# to remove each binary package sub-directory.
@ -64,10 +76,6 @@ if [ ! -z "$LANGS" ]; then
LANGS=`ls po/*.po | sed -e 's/.*\/\(.*\)\.po/\1 /' || true`
fi
if [ ! -z "$LANGS" ]; then
# LANGS should not include the specification, just the root.
LANGS=`echo $LANGS | sed -e 's/_.*//'`
LANGS=`echo $LANGS | sed -e 's/@.*//'`
LANGS=`echo $LANGS | sed -e 's/\+.*//'`
echo "[po4a_langs] $LANGS" > $CONFIG
else
echo > $CONFIG
@ -89,14 +97,22 @@ for d in $BINARIES; do
done
mkdir -p doc/html/
for file in `ls doc/xml/*.xml`; do
xmllint --format "$file" --output "$file"
#for file in $SCRIPTS; do
# wrap_langs "[type:$SCRIPTS_LANG]" "$file"
#done
for file in $XMLDIR/*.xml; do
LOCAL=`basename $file`
wrap_langs "[type:docbook]" "$file" "\$lang:doc/xml/\$lang/$LOCAL"
wrap_langs "[type:docbook]" "$file" "\$lang:$XMLDIR\$lang/$LOCAL"
done
for file in "$PODFILE"; do
wrap_langs "[type: pod]" "$file" "\$lang:doc/pod/\$lang/$file"
for file in $DOCBOOKDIR; do
LOCAL=`basename $file`
wrap_langs "[type:docbook]" "$file" "\$lang:doc/\$lang/$LOCAL"
done
if [ -n "$PODFILE" ]; then
for file in "$PODFILE"; do
wrap_langs "[type:pod]" "$file" "\$lang:doc/pod/\$lang/$file"
done
fi
# use -k to create all XML even if untranslated or the XSL breaks the build.
po4a -k 0 $CONFIG
@ -105,46 +121,47 @@ for d in $BINARIES; do
for P in $XMLPACKAGES; do
for X in $XMLFILE; do
XML_CATALOG_FILES="/etc/xml/catalog" \
xsltproc -o doc/man/ --nonet $XSLFILE doc/xml/$X
xsltproc -o doc/$P/man/ --nonet $XSLFILE $XMLDIR/$X
done
if [ "$d" = "$HASMAN3" ]; then
mv doc/man/*.3 doc/$P/man/man3/
mv doc/$P/man/*.3 doc/$P/man/man3/
fi
mv doc/man/*.1 doc/$P/man/man1/
mv doc/$P/man/*.1 doc/$P/man/man1/
done
for POD in $PODPACKAGES; do
pod2man $PODFILE > doc/$POD/man/man1/$PODFILE.1
done
mkdir -p $HTMLDIR/$d/
xsltproc -o $HTMLDIR/$d/ --nonet \
http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl \
$XMLDIR/$HTMLFILE
for l in $LANGS; do
for P in $XMLPACKAGES; do
for X in $XMLFILE; do
XML_CATALOG_FILES="/etc/xml/catalog" \
xsltproc -o doc/man/ --nonet $XSLFILE doc/xml/$l/$X
xsltproc -o doc/$P/man/ --nonet $XSLFILE $XMLDIR/$l/$X
done
if [ "$d" = "$HASMAN3" ]; then
mv doc/man/*.3 doc/$P/man/$l/man3/
mv doc/$P/man/*.3 doc/$P/man/$l/man3/
fi
mv doc/man/*.1 doc/$P/man/$l/man1/
mv doc/$P/man/*.1 doc/$P/man/$l/man1/
done
for POD in $PODPACKAGES; do
pod2man doc/pod/$l/$PODFILE > doc/$POD/man/$l/man1/$PODFILE.1
done
mkdir -p $HTMLDIR/$d/$l/
xsltproc -o $HTMLDIR/$d/$l/ --nonet \
http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl \
$XMLDIR/$l/$HTMLFILE
done
for i in `ls doc/html/$d/*.html`; do
iconv -t utf-8 -f iso8859-1 $i > doc/html/tmp
sed < doc/html/tmp > $i -e 's:charset=ISO-8859-1:charset=UTF-8:'
done
rm -f doc/html/tmp
done
for l in $LANGS; do
rm -rf doc/xml/$l
rm -rf $XMLDIR/$l
done
rm -rf doc/pod/
# the rest is specific to emdebian-rootfs - ignore.
# HTML versions, not packaged.
xsltproc -o doc/html/ --nonet \
http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl \
doc/xml/emdebian-rootfs.1.xml
for i in `ls doc/html/*.html`; do
iconv -t utf-8 -f iso8859-1 $i > doc/html/tmp
sed < doc/html/tmp > $i -e 's:charset=ISO-8859-1:charset=UTF-8:'
done
rm -f doc/html/tmp