in reply to AutoMagic HTML


This idea seems similar to the scheme used by various Wikis where simple text markup is converted to Html.

See for example C2 Wiki formatting, Usemod formatting or the Kwiki formatting rules.

The above examples are written in Perl and the source code is readily available should you wish to use their formatting.

--
John.

Replies are listed 'Best First'.
Re: Re: AutoMagic HTML
by Cody Pendant (Prior) on Jun 25, 2003 at 02:04 UTC
    Thanks jmacnamara, that was very useful.

    The Wiki people, as I found out here start with the text as one long string.

    We have the text of a page in one big string which we split into lines to be processed individually. This colors our TextFormattingRules, especially those dealing with bullet lists. Since we've now forced authors to be newline conscious, we give them the opportunity to escape newlines with a back-slash (\) which we substitute with a blank.
    sub PrintBodyText { s/\\\n/ /g; foreach (split(/\n/, $_)){

    (there follows a long long list of regexes) which is kind of an interesting answer to my question, "should I work on an array or a block of text?", which I hadn't considered. It's kind of a "both".



    “Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.”
    M-J D