#! /bin/ksh umask 022 PATH="/usr/local/bin:/usr/bin" export PATH # slide separator pattern # br="
---
" # get last slide number # n=$(grep "$br" ss.html | wc -l) # previous file # en="$n" es=$(printf "%.4d" "$en") e="$es.html" # current file # fn="0" fs="0000" f="$fs.html" # next file # gn="1" gs="0001" g="$gs.html" # function to print arrows # print_arrows() { echo "\"\" \"\" \"\"" } # function to print header # print_header() { echo "SS " print_arrows echo "Batch Spreadsheet for C Programmers - " m=0 while [ "$m" -le "$n" ]; do if [ "$m" -eq "$fn" ]; then echo "$m" else ms=$(printf "%.4d" "$m") echo "$m" fi m=$(("$m" + 1)) done } rm -f 00*.html exec < "ss.html" echo "${0}: creating file $f" 1>&2 exec > "$f" print_header while read -r line do line=$(print -r "$line" | sed 's/^~/ /') if [ "$line" = "$br" ]; then echo "" # en="$fn"; es="$fs"; e="$f" fn="$gn"; fs="$gs"; f="$g" if [ "$gn" -eq "$n" ]; then gn="0" else gn=$(("$gn" + 1)) fi gs=$(printf "%.4d" "$gn") g="$gs.html" # echo "${0}: creating file $f" 1>&2 exec > "$f" print_header elif [ "$line" = "" ]; then print_arrows else print -r "$line" | sed 's/~/ /g' fi done echo "" exec 1>&2 weblint -x netscape 00*.html