#! /bin/sh # rctypeset - typeset a recipe # # This shell script extracts a recipe from an alt.gourmand netnews article and # typesets it with troff. It first strips all communication headers # (such as netnews or mail or notesfile headers) from the front and back # of the recipe. # # Brian Reid, November 1985 # Copyright (C) 1986, USENET Community Trust # #test-000.ps groff man macros with att-style rctypeset/recipe file # -C==max att compat., -i==read input after command line # pipe to grops (no options) to generate ps file #test-000a.ps as test-000 but grops -pletter option #TROFF="troff -man -C -i " #test-000b.ps as test-000a but redo setup for call of TH from RH #TROFF="troff -man -C -i " TROFF="DEFTROFF" PATH=DEFPATH export PATH TMPFILE=TEMPDIR/xart.$$ TITLE="BOOKTITLE" FRACTIONS=1 TMAC=TEMPDIR/tmac.$$ METFLAG="-rMMETRIC" VERBATIM=0 trap "rm -f $TMPFILE $TMAC; exit" 0 1 2 3 15 while [ $# -gt 0 ]; do case $1 in -t) TFLAG="$1";; -v) VERBATIM=1;; -m) METFLAG="-rM1";; -M) METFLAG="-rM0";; -f) FRACTIONS=0;; -*) echo $0: Unknown option $1 1>&2 ; exit;; esac shift done # today's date information in flexible format # Thu Mar 27 22:56:49 PST 1986 TODAY=`date +"%d %b %Y"` #alternative # set `date` # YEAR="$6" # YR=`expr $YEAR - 2000` # TODAY="$3 $2 $YEAR" cat > $TMPFILE << 'extractor.awk' BEGIN {Seen = 0} /^\.RH MOD\.RECIPES/ {Seen = 1} /^-- *$/ {Seen = 0} /^\/\* End of text from/ {Seen = 0} Seen == 1 {print $0} extractor.awk cat << 'tmac.recip' | sed -e "s/REPLACE-TODAY/\"${TODAY}\"/" -e "s/REPLACE-TITLE/${TITLE}/" -e "/^[ ]*$/d" -e '/^\.\\"./d' -e "/^\.ig/,/^\.\./d" > $TMAC .\" read in alt.gourmand recipe macros, modified minimally TMAC.RECIP tmac.recip case $FRACTIONS in 1) cat ;; *) sed -e 's/\([0-9a-zA-Z]\)\(\\([1-3]\)/\1 \2/g' \ -e 's|\\(12|1/2|' -e 's|\\(14|1/4|' -e 's|\\(34|3/4|' \ -e 's|``|"|' -e "s|''|\"|" ;; esac | # strip comments and .ig sections sed -e "/^\.ig/,/^\.\./d" -e "/^\.\\\"/d" | case $VERBATIM in 0) awk -f $TMPFILE;; 1) awk '{print}';; esac | # switch alt.gourmand use of .TE -> .To, to avoid table conflict awk '/^\.TE / {if (NF > 1) sub("\.TE", ".To")}; {print}' | # conversions for special French characters as in alt.gourmand # and a proper-name o' also from alt.gourmand sed -e "s/\\\\z\\\(aae/\\\*\(e\'/g" \ -e "s/\\\\z\\\(aao/\\\*\(o\'/g" \ -e "s/\\\\z\\\(gaa/\\\*\(a\`/g" | tbl |\ eqn -Tps |\ $TROFF $TFLAG $METFLAG $TMAC - echo "DONE: cat stdin | case fractions | case verbatim | alt.gourmand-conv | tbl | eqn -Tps | $TROFF $TFLAG $METFLAG $TMAC -" 1>&2 exit