#!/usr/bin/perl -w -p00 # text2html - trivial html encoding of normal text # -p means apply this script to each record. # -00 mean that a record is now a paragraph use HTML::Entities; $_ = encode_entities($_, "\200-\377"); if (/^\s/) { # Paragraphs beginning with whitespace are wrapped in
 
    s{(.*)$}        {
\n$1
\n}s; # indented verbatim } else { s{^(>.*)} {$1
}gm; # quoted text s{} {$1}gs # embedded URL (good) || s{(http:\S+)} {$1}gs; # guessed URL (bad) s{\*(\S+)\*} {$1}g; # this is *bold* here s{\b_(\S+)\_\b} {$1}g; # this is _italics_ here s{^} {

\n}; # add paragraph tag }