Brion Vibber wrote:
Would you prefer to change the behavior? Note that this will require some restructuring to the parser to both be more correct and and not break things, and will leave us with inconsistent, unparseable code in the future. (That is, it'll be impossible to tell what the code after a template inclusion will parse as unless the template is available.)
But if we're really, really sure, we can put some time into working on that and accept that our syntax will never be predictable. (This has consequences for future wysiwyg or markup-sensitive assisted editing plugins.)
Isn't it general practice with a macro-like facility like templates not to parse until you've substituted in the preprocessing phase? That is, {{subst:foo}}, {{foo}}, and copying and pasting in the code from Template:foo (and substituting the parameters manually) should all produce equivalent output. Sort of like C macros---it's madness to try to parse C code without first running the preprocessor.
If they're to have some sort of different semantics, that's a different paradigm of sorts---it would require no longer using templates as macros, but as functions that return complete well-formed sub-parts of the page. I'm not really opposed to that change (I think it could be made to work, and as you note, it makes some future editing tools easier to write), but it should then be made obvious and well-understood that templates aren't macros.
-Mark