: Filter for converting a MATHS document into HTML. Version for Sun OS sed. : NEEDS compiled version of ascii2html.c # if [ $# -eq 0 ]; then echo Usage: $0 input_file\[.mth\]; exit 1; fi if expr $1 : '.*\.mth$' >/dev/null then mthfile=$1; name=`expr $mthfile : '\(.*\)\.mth$`; htmlfile=$name.html else name=$1; mthfile=$1.mth; htmlfile=$1.html fi # extract contents list and index tmp=/tmp/mth2html$$; index=$tmp.index; contents=$tmp.contents trap "rm $tmp*" 1 2 3 sed -n '/^[ ]*\([A-Za-z0-9_]*\)[ ]*::=[ ]*Net.*$/s//
  • \1<\/A>/p s/^\.Open *\(.*\)$/
  • \1<\/A>/p s/^\. \(.*\)$/
  • \1<\/A>/p' $mthfile >$contents sed -n '/^[ ]*\([A-Za-z0-9_]*\)[ ]*::[ ]*.*$/s//
  • \1<\/A>/p /^[ ]*\([A-Za-z0-9_]*\)([^)]*)::[ ]*.*$/s//
  • \1<\/A>/p s/^\.Open *\(.*\)$/
  • \1<\/A>/p s/^\. \(.*\)$/
  • \1<\/A>/p' $mthfile|sort >$index # cat $mthfile|br 78|awk 'BEGIN{n=2; } /^\.Open/{ $1=$1 n;n++; if(n>6)n=6;} /^\. ./{ $1=$1 n; } /^\.Close/{n--; if(n<2)n=2; } {print}'|ascii2html| ( echo "$name" [ -r standard.include.html ] && cat standard.include.html echo '

    Contents

    ' echo "
    " sed '/^\.Close/d s/^$/

    / s/^[ ]*For /
    For / s/^[ ]*|-/
    |- / s/^[ ]*\(}=::.*$\)/
    \1/ s/^\.See \(.*\):\(\/\/.*\)\/\([^/]*\)\.\([^.]*\)$/ \3<\/A>/ s/^\.See \(.*\):\(\/.*\)$/ \2<\/A>/ s/^\.See \(.*\)$/ \1<\/A>/ s/^\.Open\(.\) *\(.*\)$/\2<\/H\1><\/A>/ s/^\.Source *\(.*\)$/\1<\/cite>/ s/^\.Address *\(.*\)$/
    \1<\/address>/ s/^\.Image *\([^ ]*\)[ ]\(.*\)$/\2/ s/^\.\(.\) \(.*\)$/\2<\/H\1><\/A>/ s/^\.\(.*\)$/
    \1<\/H6>/ /^[ ]*\([A-Za-z0-9_.!@#$%^&*-+|<>=~ ]*\)[ ]*::\([^=]*\)=\(.*\)$/s//
    \1<\/A>::\2=
    \3/ /^[ ]*\([A-Za-z0-9_.!@#$%^&*-+|<>=~ ]*\)[ ]*::[ ]*\([^=]*\)$/s//
    \1<\/A>::
    \2/ /^[ ]*\([A-Za-z0-9_.!@#$%^&*-+|<>=~ ]*\)[ ]*\(([^)]*)\)::\([^=]*\)=\(.*\)$/s//
    \1<\/A>\2::\3=
    \4/ /^[ ]*\([A-Za-z0-9_.!@#$%^&*-+|<>=~ ]*\)[ ]*\(([^)]*)\)::\([^=]*\)$/s//
    \1<\/A>\2::
    \3/ /^[ ]*\([A-Za-z0-9_.!@#$%^&*-+|<>=~ ]*\)[ ]*\(([^)]*)\)::\([^=]*\)$/s//
    \1<\/A>\2::
    \3/ /^[ ]*\([A-Za-z0-9_.!@#$%^&*-+|<>=~ ]*\)[ ]*\(([^)]*)\)::\([^=]*\)$/s//
    \1<\/A>\2::
    \3/ s/^[ ][ ]*/
    / ' echo "
    " echo "
    " echo '

    Sections and Definitions in Alphabetical Order

    ' echo "" [ -r $HOME/.signature.html ] && ( echo '
    '; cat $HOME/.signature.html) echo "" ) >$htmlfile rm $tmp*