in reply to Re: AutoMagic HTML
in thread AutoMagic HTML
Best is what YOU think is best. TMTOWTDI and no one can tell what's the best way if you don't define "best" ;-)
Is best the code that is
Having said that, I would do it on a line-by-line basis, something like this
This won't work with cascaded, ordered lists, but it's a starting point.while (<>) { # replace italics and bold s{^([ib])\s+(.*)}[<$1>$2</$1>]; # find ordered lists if (my $hit= /^\[\s*$/ .. /^\]\s*$/) { if ($hit==1) { print "<ol>\n"; next; } if ($hit=~ /e0/i) { print "</ol>\n"; next; } s[^][<li>]; s[$][</li>]; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: AutoMagic HTML
by Cody Pendant (Prior) on Jun 24, 2003 at 07:02 UTC | |
by sgifford (Prior) on Jun 24, 2003 at 07:07 UTC |