Page MenuHomePhabricator

Templates inside template parameters
Closed, DeclinedPublic

Description

Author: mrnobo1024

Description:
Templates inside template parameters, e.g. {{foo|{{bar}}}},
don't work, the parser sees the first }} as ending foo.


Version: 1.4.x
Severity: normal

Details

Reference
bz662

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 6:58 PM
bzimport set Reference to bz662.
bzimport added a subscriber: Unknown Object (MLST).

mrnobo1024 wrote:

patch

Attached:

wmahan_04 wrote:

Templates within templates like {{foo{{bar}}}} don't work, either.
The regex that replaces templates doesn't balance the braces.

Before doing something like in the attached patch, we should
make sure:

  1. it's useful - I'm not sure there's any reason to make the

code more complex

  1. it doesn't hurt performance

egil wrote:

Templates within template arguments are defintely useful. The more templates
like infoboxes that are created, the more useful this becomes. One example: A
template for geographical coordinates (generating an uniform look as well as a
link to a map) cannot be used in templates for geographical locations :(

If there is a problem with syntax/parsing, then perhaps we can some special ugly
syntax for this case. Since 3 brackets is already used for arguments, why not go
to 4?
E.g:

{{foo{{{{bar}}}}}}

egil wrote:

That said, I it seems strange from a syntax point of view why templates as
template arguments cannot be handled, when template arguments (which also
contain braces) can (for instance when using a template in another template
definition).

gangleri wrote:

In response to comment 0

Hallo!

The first }} should be seen as the end of the template started with the last {{.
Implementing this would solve bug 895 and would help for bug 2148.

Regards Reinhardt [[user:gangleri]]

avarab wrote:

*** Bug 895 has been marked as a duplicate of this bug. ***

Astronouth7303 wrote:

Probably related to this, "{{localurle:{{ns:4}}:Requested articles}}" don't work
under 1.5 (they did under 1.4).

The parser outputs "{{localurle:Astro73:Requested articles}}" (HTML) on my
private wiki (the meta namespace is "Astro73").

gangleri wrote:

testcase from http://eo.wikipedia.org/w/index.php?title=Ap%C5%9Deronsk&oldid=310604

{{Rusia urbo 2|Apsxeronsk||[[Krasnodara regiono]]|[[Apsxeronska distrikto de
Krasnodara regiono|Apsxeronska]]|[[1863]]|[[1947]]|{{Koordinatoj
gm|44|28|N|39|45|E}}|39,6 (2003)|03205501|86152|0}}

behaves differently then
the first example at http://test.leuksman.com/view/Ap%C5%9Deronsk

Note:
I will recommend the usage of distinct paramters for geographical coordinates
for this template at [[eo:]].

Regards Reinhardt [[user:gangleri]]

alarm wrote:

Fix for 3526 should have fixed this

gangleri wrote:

changed to worksforme

http://yi.wiktionary.org/wiki/%D7%B0%D7%A2%D7%A8%D7%91
includes templates in templates at two levels

Thanks for fixing this. Best regards reinhardt [[user:gangleri]]

gangleri wrote:

*** Bug 2148 has been marked as a duplicate of this bug. ***