#!/usr/bin/perl -p # # code2html - convert code to html for posting to slashdot # # tchrist@perl.com # Sunday, December 19th, 1999 BEGIN { print "\n" } # and the spirit of awk... # first kill all the tabs 1 while s{ \t + } { " " x (length($&)*8 - length($`)%8) }ex; # then the four standard naughty bits s/&/&/g; # must remember to do this one first! s//>/g; # don't close too early s/"/"/g; # only in embedded tags, i guess # make lines break where they should s/^\s*$/

/ || s/$/
/; # make sure spaces aren't squishticated so we # can do indentation and properly align comments s/ /  /g; END { print "
\n" } # ...shall be with us always