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