3 # code2html - convert code to html for posting to slashdot
6 # Sunday, December 19th, 1999
8 BEGIN { print "<TT>\n" } # and the spirit of awk...
10 # first kill all the tabs
12 { " " x (length($&)*8 - length($`)%8) }ex;
14 # then the four standard naughty bits
15 s/&/&/g; # must remember to do this one first!
16 s/</</g; # this is the most important one
17 s/>/>/g; # don't close too early
18 s/"/"/g; # only in embedded tags, i guess
20 # make lines break where they should
21 s/^\s*$/<P>/ || s/$/<BR>/;
23 # make sure spaces aren't squishticated so we
24 # can do indentation and properly align comments
27 END { print "</TT>\n" } # ...shall be with us always