On Sun, Sep 20, 2009 at 8:14 PM, Tim Starling <tstarling(a)wikimedia.org> wrote:
Robert Rohde wrote:
I am looking at bug 1310, which involves parser
behavior such that
when given nested tag extensions, i.e.:
The parser selects the tag block as running from the first open tag to
the FIRST close tag, i.e. in the example it gives:
as the inner text of the first tag. It should be fairly
straightforward to modify this to handle nested tags by checking for
additional open tags in the inner string.
This syntax was chosen because originally <pre> and <nowiki> were the
only such tags (I called them xmlish elements in [[mw:Preprocessor
ABNF]]). Those two tags were imagined as being useful solely for
escaping HTML and other wikitext, so that it is displayed literally on
the page. No nesting behaviour was desirable.
Actually, if one is following the HTML4 spec then <pre> would be
expected to nest. (Not particularly useful as far as I can see, but
it is what it is.)
I could see arguments in either direction for nowiki. For example, it
might be nice to be able to wrap <nowiki> around arbitrary blocks
without worrying if another nowiki was already present in the middle.
<math>, and then the extension interface, were
added afterwards using
the same syntax. There is no application for nesting with <math> since
the contents are TeX.
<ref> was the first tag to assume that its contents were some kind of
wikitext, unfortunately this was an inefficient and ugly hack on the
software side, and could have been much more easily done, with
appropriate nesting behaviour, if a different syntax had been chosen.
Other tags were later added, following this bad example.
So if you ask me if there's a use case, I would say most likely yes,
especially for <nowiki> and <pre>, and very likely for the extensions
that shell out, like <math> and <lilypond>. These use cases would
become especially obvious if an extension registered a short name name
like <->, then the lack of a syntax for communicating this string with
a shell command would become especially obvious.
I can't really think of an example where it would be valid and useful
to enclose a single tag, i.e. <math> x + <math> 5 = 6 </math> is
silly, but I can't rule out that there might be some circumstance
somewhere where one would want that behavior.
But it would be possible to enable or disable nesting
on a per-tag
basis at registration time.
That seems like probably the best option.