Page MenuHomePhabricator

{{!}} always treated as literal instead of separator when the template is transcluded
Open, LowPublic

Description

It is hard for me to describe this problem, so I made a simple (and useless) example to describe this problem.

Suppose I do have a template named "Template:A" with the content:

{{void{{<includeonly>safesubst:</includeonly>!}}param=any}}

If I call this template with {{subst:A}} everything works as expected, since {{!}} is expanded and the generated "|" is treated as a parameter separator, so "Template:void" is called with "param=any" as parameter. So far so good.

But, if I call this template with {{A}}, the {{!}} is expanded as literal "|" and the "Template:void|param=any" is called without parameters, which is an error.

I do not know exactly how to workaround this issue (maybe some trick I do not know).

As I stated before, this is just a minimal example, because what I really intend to do is to pass a parameter to another template only when one condition is satisfied, but I am not able to made it work when the template is both substituted or transcluded.


Version: unspecified
Severity: normal

Details

Reference
bz72920

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 4:00 AM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz72920.
bzimport added a subscriber: Unknown Object (MLST).