Brion Vibber wrote:
Jim Higson wrote:
What should be the output from something like:
** foo ** bar
Should there be a 'phantom' listitem to contan the nested list, such as:
[snip]
Or is it valid for a List to directly contain a list, ie:
In HTML, a list cannot directly contain another list; the child list must sit inside a list item. If you break the list tree by skipping a level in this way you will get a phantom bullet point.
I take the attitude that the wiki XML representation doesn't have to follow HTML too closely. Having said that, it does make semantic sense that a listitem would contain the nested list, because it will usually be a subclause of that item.
At the moment my 'parser' adds phantom items if two levels of list start at once, and gives them a phantom="true" attribute. This is ok, but maybe it is unnecessary because the XML-to-whatever formatter could just look to see if items have text nodes and if not format them without markers. I don't want to just invent attributes as I need them, in case my xml strays too far from the flex/bison parser's.
Maybe one way I could help would be drawing up a DTD? That way the validity of parser output could be easily checked.
My little parser does lists completely reliably now (I'm guessing the flex/bison one would gets this right too?). Even though I'm not using a parser generator, I'm using a lot of 'proper parser' techniques. Some output:
* normal list... * ...easy! ** nested *#** bit odd here! #*** huh? #*#*:# who would write this awful wikitext? #*# at least it parses! * Oh, the joy of parse trees! # foo
# bar ** baz # bac
<list type="bullet"> <listitem> normal list... </listitem> <listitem> ...easy! <list type="bullet"> <listitem> nested </listitem> </list> </listitem> <listitem phantom="true"> <list type="numbered"> <listitem phantom="true"> <list type="bullet"> <listitem phantom="true"> <list type="bullet"> <listitem> bit odd here! </listitem> </list> </listitem> </list> </listitem> </list> </listitem> </list> <list type="numbered"> <listitem phantom="true"> <list type="bullet"> <listitem phantom="true"> <list type="bullet"> <listitem phantom="true"> <list type="bullet"> <listitem> huh? </listitem> </list> </listitem> </list> </listitem> <listitem phantom="true"> <list type="numbered"> <listitem phantom="true"> <list type="bullet"> <listitem phantom="true"> <list type="indent"> <listitem phantom="true"> <list type="numbered"> <listitem> who would write this awful wikitext? </listitem> </list> </listitem> </list> </listitem> </list> </listitem> <listitem> at least it parses! </listitem> </list> </listitem> </list> </listitem> </list> <list type="bullet"> <listitem> Oh, the joy of parse trees! </listitem> </list> <list type="numbered"> <listitem> foo </listitem> </list> <list type="numbered"> <listitem> bar </listitem> </list> <list type="bullet"> <listitem phantom="true"> <list type="bullet"> <listitem> baz </listitem> </list> </listitem> </list> <list type="numbered"> <listitem> bac </listitem> </list>