" Defines makehtml alias to convert plain text to HTLM source alias makehtml { "Convert plain text to HTML source local report=0 m=text n=text b=false magic magicchar=^$.[* noignorecase " " m is current line mode -- one of "text", "pre", "ol", or "ul" " n is next line mode " b is a flag for detecting series of blank lines. " " For each line... !%g /^/ { " Protect characters which are special to HTML try s/&/\&/g try s/\</g try s/>/\>/g " " Convert uppercase lines into headings try s/^[A-Z0-9][A-Z0-9-.) ]*$/
tags, though. if m!="pre" && b=="false" then { try s/^$/
/ then set b=true } " " if mode switched, then add tags for that. if m!=n then { if m!="text" then eval i (m)> if n!="text" then eval i <(n)> let m=n set b=false } } " " if not in text mode, then terminate the mode if m != "text" then eval !> a (m)> " " If converting the whole file, then add ... if "!%" == "" then { $a