#!/bin/csh

# make TOC for course
# grep for header records

grep -i "<h1>" *.html */*.html */*/*.html > junk
ed junk << "X"
1
g/blank\.html/ d
1
g/COURSE IN PREP/ d
1
g/<img .*>/ s///
1
g?H1? s//h1/g
1
g?</h1>? s???
1
g?/? s/^/+/
1
g?^? s//+/
1
g?^++? s//-/
1
g/index\.html/ s//\/_index\.html/
w
q
"X"

cat junk | sort > toc.html
rm junk

ex toc.html << "X"
1
g/./ s//\.\.<a href = /
1
g/\// s/^/\.\./
1
g/_index/ s/<h1>/<h1><b>/
1
g/_index/ s/$/<\%b>/
1
g/\// s//\%/
1
g/\// s/^/\.\./
1
g/\%/ s//\//g
1
g/_index/ s//index/
1
g/\/\/index/ s//\/index/
1
g/:<h1>/ s//>/
1
g/$/ s//<\/a><br>/
1
g/<\/b>/ s/\.\.\.\.//
w
q
"X"



