#!/bin/tcsh -f
# build a summary of the Dhamma Transcription Project
set me=$0:t # the name of this program
set tag="_DTP_PROGRESS_TAG_" # what this script greps for
# Abort if the required env variables aren't set
if (! ${?HTML_DIR}) then
echo ${me}: HTML_DIR environment variable not set\!
exit
endif
set theFile = $HTML_DIR/tech/scribe.html
set tmpDir = ~/tmp
set theTmp = $tmpDir/${me}.tmp
set theResult = $tmpDir/${me}.result
ed << END_INPUT $theFile >& /dev/null
1,/name="seekscribe"/d
/
/,\$d
w $theTmp
Q
END_INPUT
set n_seekscribe=`grep $tag $theTmp | wc -l`
ed << END_INPUT $theFile >& /dev/null
1,/name="consider"/d
/
/,\$d
w $theTmp
Q
END_INPUT
set n_consider=`grep $tag $theTmp | wc -l`
ed << END_INPUT $theFile >& /dev/null
1,/name="scribing"/d
/
/,\$d
w $theTmp
Q
END_INPUT
set n_scribing=`grep $tag $theTmp | wc -l`
ed << END_INPUT $theFile >& /dev/null
1,/name="formatting"/d
/
/,\$d
w $theTmp
Q
END_INPUT
set n_formatting=`grep $tag $theTmp | wc -l`
ed << END_INPUT $theFile >& /dev/null
1,/name="released"/d
/
/,\$d
w $theTmp
Q
END_INPUT
set n_released=`grep $tag $theTmp | wc -l`
cat << END_INPUT > $theTmp
END_INPUT
ed << END_INPUT $theFile >& /dev/null
/%dtp-progress START%<\/span>/,/%dtp-progress END%<\/span>/d
i
%dtp-progress START%
.
.r $theTmp
a
%dtp-progress END%
.
wq
END_INPUT
cat << END_INPUT
Dhamma Transcription Project Summary:
under consideration: $n_consider
seeking transcribers: $n_seekscribe
being transcribed: $n_scribing
being formatted: $n_formatting
released since May 2005: $n_released
Summary info added to file ${theFile}.
END_INPUT
/bin/rm $tmpDir/${me}.*