Last modified: 2010-05-15 14:35:52 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T5526, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 3526 - Template parsing is incomplete and inconsistent
Template parsing is incomplete and inconsistent
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Templates (Other open bugs)
unspecified
All All
: High normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 2376
  Show dependency treegraph
 
Reported: 2005-09-21 12:15 UTC by Andrius Ramanauskas
Modified: 2010-05-15 14:35 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
some testcases (using parserTest format) (2.60 KB, text/plain)
2005-09-21 12:20 UTC, Andrius Ramanauskas
Details
A generic solution (10.87 KB, patch)
2005-09-21 12:29 UTC, Andrius Ramanauskas
Details
Patch (on1.5rc4) to make templates with templates as arguments work (1021 bytes, patch)
2005-10-17 17:08 UTC, Piers Titus van der Torren
Details
Patch (on1.5rc4) to make templates with templates as arguments work, tweaked a bit (1.19 KB, patch)
2005-10-18 04:00 UTC, Piers Titus van der Torren
Details
Optimized generic solution (11.69 KB, patch)
2005-10-18 15:46 UTC, Andrius Ramanauskas
Details

Description Andrius Ramanauskas 2005-09-21 12:15:01 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)
Comment 1 Andrius Ramanauskas 2005-09-21 12:20:22 UTC
Created attachment 905 [details]
some testcases (using parserTest format)

These tests extends template automated tests, few tests are failing due to bug
Comment 2 Andrius Ramanauskas 2005-09-21 12:29:10 UTC
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.
Comment 3 Rob Church 2005-09-21 17:47:18 UTC
You're going to put a whopping strain on the servers of a large wiki if that's
used on a lot of pages.
Comment 4 Andrius Ramanauskas 2005-09-22 06:01:48 UTC
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.
Comment 5 Rob Church 2005-09-22 11:06:55 UTC
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...
Comment 6 Andrius Ramanauskas 2005-09-22 14:06:14 UTC
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.
Comment 7 Piers Titus van der Torren 2005-10-17 17:08:11 UTC
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}}}}
Comment 8 Piers Titus van der Torren 2005-10-18 04:00:30 UTC
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}}}}
Comment 9 Andrius Ramanauskas 2005-10-18 15:46:49 UTC
Created attachment 1009 [details]
Optimized generic solution
Comment 10 Bob Maguire 2005-11-26 18:52:52 UTC
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.
Comment 11 Bob Maguire 2005-11-27 04:08:01 UTC
Nevermind, I'm just going to go with a cvs revision.  That obviously has the fix in it.
Comment 12 Andrius Ramanauskas 2005-11-30 14:13:44 UTC
More examples of template usage after the fix was applied - http://meta.wikimedia.org/wiki/Extended_template_syntax

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links