#!/bin/bash
xmllint --format emchain.1.xml --output emchain.1.xml
xmllint --format em_make.1.xml --output em_make.1.xml
xmllint --format emsetup.1.xml --output emsetup.1.xml
xmllint --format emlocale.1.xml --output emlocale.1.xml
xmllint --format emsource.1.xml --output emsource.1.xml
xmllint --format embuildstats.1.xml --output embuildstats.1.xml
xmllint --format emdebuild.1.xml --output emdebuild.1.xml
xmllint --format emdebian-tools.1.xml --output emdebian-tools.1.xml
xmllint --format overview.1.xml --output overview.1.xml
xmllint --format pbuilder/empdebuild.1.xml --output pbuilder/empdebuild.1.xml
xmllint --format pbuilder/emsandbox.1.xml --output pbuilder/emsandbox.1.xml
xsltproc -''-nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl emdebian-tools.1.xml
mv empdebuild.1 pbuilder/
mv emsandbox.1 pbuilder/
pod2man Emdebian/Tools.pm > Emdebian::Tools.3
pod2man emtargetcmp > emtargetcmp.1
if [ -d tmp/ ]; then
  xsltproc -o tmp/ -nonet http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl emdebian-tools.1.xml
  cd tmp/
  for i in `ls ./*.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 ../
  pod2html -outfile tmp/emtargetcmp.html -title emtargetcmp < emtargetcmp
  pod2html -outfile tmp/EmdebianTools.html -title Emdebian::Tools < Emdebian/Tools.pm 
  rm pod2htmd.tmp
  rm pod2htmi.tmp
fi
