On 7/3/07, Jim Wilson wilson.jim.r@gmail.com wrote:
Hi all,
I have some questions about the way the templating system would work in an ideal world (not necessarily how it works today). I'm attempting to write a template processor that mimics the ideal behavior of MW's templating engine.
I'm running into difficulties when considering edge cases. Take for example four nested brackets: {{{{a}}}}
I would have thought that this was equivalent to calling the template whose name is output after calling {{a}}. So if Template:A contains just "b", I'd expect {{{{a}}}} to be equivalent to {{b}} - however this is not the case, and the raw text "{{{{a}}}}" is returned.
In the #mediawiki IRC channel, someone helpfully suggested {{{{void}}{{a}}}}
- which does what I expected {{{{a}}}} to do. However, this doesn't
really help me from a requirements standpoint - as it doesn't answer whether {{{{a}}}}'s behavior is an intentional, conscientious design choice, or merely a missing feature.
Another thing I've noticed is that template parameters (three brackets) bind more tightly than template calls (two brackets). So five brackets like this {{{{{a}}}}} is similar to {{ {{{a}}} }}. However, six brackets like this {{{{{{a}}}}}} resolves to {{{ {{{a}}} }}} and the inner parameter is replaced leaving {{{a's value}}}. The outer triple is left as plain text.
Generally speaking, as long as there are breaks, it appears the parser can figure out the intent, which is why {{{{void}}{{a}}}} succeeds where {{{{a}}}} fails.
Any advice on how to handle these edge cases (nested brackets beyond 2 or 3) would be much appreciated.
-- Jim R. Wilson (jimbojw) _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
I feel that it would be benefititial to MediaWiki (and this problem) to have a discussion and consultation about rewriting wikitext. Currently there are many ambiuties that a specification would solve. If a speciifcation was created it would also help experienced users to work out why there was a problem with the wikitext they are using. By all means disregard this message (I am sure it has been suggested many times before) - but seriously, wikitext is in a really bad state. Thanks, MinuteElectron.