Last modified: 2010-05-15 14:35:52 UTC
Currently template and template argument parsing is incomplete and inconsistent - based on regular expresions and workarounds (for example, workaround not to treat '|' in links as parameter separator). This may cause problems, some known problems are: * template cannot be included as parameter for another template ( {{a|{{b}}|c}} ) * if any argument value is ommioted, prepared template is ugly if it uses another template passing some arguments to that template (having template A which uses template B - {{B|a={{{a}}}|b={{{b}}}|c=c}} and not passing value for 'a' will be treat {{B|a= {{{a}} as call to another template and '}|b={{{b}}}|c=c}}' will be left unnparsed)
Created attachment 905 [details] some testcases (using parserTest format) These tests extends template automated tests, few tests are failing due to bug
Created attachment 906 [details] A generic solution This patch replaces template parsing with generic function which parses all parentheses pairs in same way and that is done by correctly parsing levels (first inner parentheses are parsed). So any parentheses combination (for example, {{a|a|{{b|b|[[c|{{{c}}}]]}}}} )is parsed consistently. Patch also includes default values for arguments (as having generic parsing makes it very simple and consistent), but if that may cause any doubts, this can be made optional or completely removed (it is not a main part of a patch - just a line or two). After applying a patch all old and newly proposed tests run successfully.
You're going to put a whopping strain on the servers of a large wiki if that's used on a lot of pages.
I cannot tell for sure, but I don't think this should be any slower than 3 or 4 regex replace calls + array manipulation (to workaround link '|' problem). Also, isn't parsing output cached? Anyway, I may be wrong.
I meant the calling of templates as parameters of other templates; one could end up with a series of circular references. In addition, I belive certain template outputs are not cached. I'm talking about the load on the mySQL servers here...
Circular references can already be created using templates without any parameters and as I know there is a solution for that, so I don't think this patch will introduce any new problems. Still, I can be wrong on ghis.
Created attachment 1002 [details] Patch (on1.5rc4) to make templates with templates as arguments work A simple solution that solves the templates as arguments bug, eg. {{note|{{3x|blah}}}}
Created attachment 1007 [details] Patch (on1.5rc4) to make templates with templates as arguments work, tweaked a bit A simple solution that solves the templates as arguments bug, eg. {{note|{{3x|blah}}}}
Created attachment 1009 [details] Optimized generic solution
Would this bug be the reason I get the following parsing glitch in my template? http://wqoq.com/wiki/Template:Bad_parse I get this glitch in 1.5.0 and 1.5.2.
Nevermind, I'm just going to go with a cvs revision. That obviously has the fix in it.
More examples of template usage after the fix was applied - http://meta.wikimedia.org/wiki/Extended_template_syntax