On 11/14/07, Thomas Dalton <thomas.dalton(a)gmail.com> wrote:
The only alternative I can think of is running the wikitext through a
tidier first that detects that kind of mess and adds the appropriate
close and reopen tags. It requires an extra pass through the text, but
I think this is a terrible solution. Running a tidier *first* means we
have to parse all the text,
and I mean *all* of it, twice. All the nowikis, all the pre's, all the
places that '''
and '' *don't* get interpreted - all of that logic will have to be coded in
the pre-tidier as well as in the parser proper.
Much better IMHO to do your bold/italic (and apostrophe if necessary) logic
*afterwards* when you have a logical tree. You could even treat all
sequences of 2+ apostrophes (if found in appropriate places) as "to be dealt
with later", storing the number of apostrophes in the tree. In a secondary
walk, you could probably even reproduce the current pathological behaviour -
if we really wanted to.
Basically, we accept that wikitext can't be
described by EBNF,
Yes.
so start by parsing the wikitext into a more
restrictive form of wikitext
No.
It's a mess,
Yes.
but it's probably better than what we have
at the moment.
Barely.
Steve