@@ 1,8 @@
+#!/bin/sh
+I=./index.html;O="${1:-out}";H=hd.txt;F=ft.txt;mkdir -p $O;touch $H $F $I
+alias eo='echo >>"$OF"' p=printf;po(){ cat $H "$1" >"$OF"; }
+for f in ./*.html;do [ "$f" = $I ] || (OF="$O/$f";p "$f\t"
+po "$f"; <$F >>"$OF";eo '<a id=ret href=.>return</a>';p OK\\n;) done
+p "$I\t";OF="$O/$I";po "$I";eo '<ul id=toc>';for p in $O/*.html;do
+[ -e "$p" ] && (t="$(sed -n 's,.*<title>\(.*\)</title>.*,\1,ip;T;q' "$p")"
+eo "<li><a href='${p##*/}'>$t</a></li>";) done;eo "</ul>"; <$F >>"$OF";p OK\\n