#!/bin/sh
set -e
if [ ! -d html ]; then
mkdir html
fi
if [ ! -d txt ]; then
mkdir txt
fi
if [ ! -d pdf ]; then
mkdir pdf
fi
# until pdf can be generated, leave manual versions alone.
# rm -f pdf/*
rm -f txt/*
rm -f html/*
XML=`ls *.xml`
for x in $XML; do
fold -s $x > tmp
mv tmp $x
echo "Checking and formatting $x with xmllint"
xmllint --format $x --output $x
done
xsltproc -o html/ http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl debian.xml
cd html/
HTML=`ls *.html`
for i in ${HTML}; do iconv -t utf-8 -f iso8859-1 $i > tmp;
sed < tmp > $i -e 's:charset=ISO-8859-1:charset=UTF-8:'; done;
rm -f tmp
cd ../
xmlto -o txt txt debian.xml
# due to the tex transition, no docbook->pdf tools are installable
# at least not without a half-a-gigabyte package download.
#xmlto -o pdf pdf emdebian.xml
# Alternative: use onechunk.xsl instead of chunk above and print to PDF or PS from a browser
# xsltproc -o html/ http://docbook.sourceforge.net/release/xsl/current/html/onechunk.xsl emdebian.xml