#! /bin/sh
{
echo "<!-- WARNING! This is a generated file! -->"
for f in tmp/*.html; do
ltx=tmp/`basename $f .html`.tex
# Make that the file ends with LF:
echo >>$f
base=`basename $f .html`
title=`echo "$base" | sed -e 's:^type_::'`
case "$base" in
index)
true ;;
*)
for_latex="no"
if [ -f "$ltx" ]; then for_latex="yes"; fi
echo "<page title=\"$title\" id=\"$base\" file=\"$base.html\" for-latex=\"$for_latex\">"
echo "<sect1>"
echo "<title>&name; API for Objective Caml: $title</title>"
echo "<p>"
echo "<html><![CDATA["
# Now include $f. Do not include the part until <body>,
# and strip </body> and </html>.
body=0
{
while read line; do
if [ $body -gt 0 ]; then
echo "$line" | sed -e 's:</body>::' | sed -e 's:</html>::'
else
case "$line" in
*\<body\>* )
body=1 ;;
*)
;;
esac
fi
done
} <$f
echo "]]></html>"
if [ -f "$ltx" ]; then
echo "<latex><![CDATA["
cat "$ltx"
echo "]]></latex>"
fi
echo "</p>"
echo "</sect1>"
echo "</page>"
;;
esac
done
} >wd-ocamldoc.xml