Page MenuHomePhabricator

Parser: Interferences of ParserFunctions, table syntax and {{!}}
Open, Needs TriagePublic

Description

I think I incidentally found a parser defect that is caused by intereferences of ParserFunctions, table syntax and {{!}}.

{{#if:{{{1|}}}|{{{!}}
{{!}} {{{1|}}}
{{!}}}}}

prints } while it should print nothing. Without an if it works. If I add an else part or remove a curly bracket, it works as well, for example

{{#if:{{{1|}}}|{{{!}}
{{!}} {{{1|}}}
{{!}}}|}}

or

{{#if:{{{1|}}}|{{{!}}
{{!}} {{{1|}}}
{{!}}}}

, which is actually wrong.

If I replace {{!}}} by an template {{!)}} with the content |}, everything works as expected.

Event Timeline

MGChecker renamed this task from Parser doesn'T work as expected to Parser doesn't work as expected.May 19 2017, 11:10 PM
Framawiki renamed this task from Parser doesn't work as expected to Parser: Intereferences of ParserFunctions, table syntax and {{!}}.May 19 2017, 11:39 PM
Framawiki subscribed.

Instead of the else branch you can write an space to make clear how to split the 5 brackets into parts.

{{#if:{{{1|}}}|{{{!}}
{{!}} {{{1|}}}
{{!}}} }}

At the moment the preprocessor is using the first two brackets for transculsion and the next for the #if, and left over one bracket to print. In this context the preprocessor does not know about table syntax. This can also happen when a template argument contains brackets, see T27721

For sure this works as workaround, but in my opinion it isn't a proper solution.

MGChecker renamed this task from Parser: Intereferences of ParserFunctions, table syntax and {{!}} to Parser: Interferences of ParserFunctions, table syntax and {{!}}.Oct 14 2018, 6:54 PM