Me too! me too!
A far less sophisticated toc-generator than Prananandas, written as a bash shell-script. Its single redeeming feature is its brevity. Good (?) to use as a starting-point for more sophisticated tocs, at least.
Code:
# Generate an html toc file
# Assumes one file - one chapter
# Assumes toc will be in same directory as chapter files
# Usage: toc <chapter files in correct order>
# the value of 'tag' is the classname of the <H2,3> - tag that contains the chapter heading, e.g. <h2 class="chapter">A NEW BEGINNING</h2>
# all other instances of <H2,3> are ignored
tag=chapter
cat <<__EOF__
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<title>Contents</title>
</head>
<body>
<h2>Contents</h2>
<ol>
__EOF__
n=0
for chapfile in $*
do
chap=$(grep -o "class=.${tag}.>[^<]*</h[32]" $chapfile)
chap=${chap#*>}
chap=${chap%</h?}
chap=$(echo $chap)
echo " <li>"
echo " <a href=\"$(basename $chapfile)\" >"
echo " ${chap}"
echo " </a>"
echo " </li>"
done
echo " </ol>"
echo "</body>"
echo "</html>"