Page MenuHomePhabricator

Unexpect behaviour when substing templates with substed parser functions.
Closed, ResolvedPublic

Description

I'll explain on a simple example...

Let's say I have a template called Substing, it's source is:
{{#if:{{{1|}}}|{{{1}}}|7}}

Now let us have 3 situations:

  1. {{subst:Substing}}
  2. {{subst:Substing|}}
  3. {{subst:Substing|3}}

This should give me:

  1. 7
  2. 7
  3. 3

So far it all works, but now let's say I want the template to be permanent (so
there will only be numbers in the source). Should be easy - changing the source to:
{{<includeonly>subst:</includeonly>#if:{{{1|}}}|{{{1}}}|7}}

And now let us have those 3 situations:

  1. {{subst:Substing}}
  2. {{subst:Substing|}}
  3. {{subst:Substing|3}}

This should give me:

  1. 7
  2. 7
  3. 3

But it gives me:

  1. {{{1}}}
  2. 7
  3. 3

So the first one is wrong.

More tests (both for #if and #ifeq):
http://test.wikipedia.org/wiki/Template_talk:Substing#subst_table


Version: unspecified
Severity: normal
URL: http://test.wikipedia.org/wiki/Template_talk:Substing#subst_table

Details

Reference
bz8675

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:32 PM
bzimport added a project: ParserFunctions.
bzimport set Reference to bz8675.
bzimport added a subscriber: Unknown Object (MLST).

mr.heat wrote:

I found a similar bug. Maybee it's the same. For example, I created a template called "Negative" which calculates something. The source of this template is {{<includeonly>subst:</includeonly>#expr: -{{{1}}} }} for example.

Usage: {{subst:Negative|7}}
Result: -7

Usage: {{Negative|7}}
Result: {{subst:#expr: -{{{1}}} }}

This is very strange and completely useless, obviously. The expected result is {{Negative|7}}.

webboy wrote:

This bug is fixed with the new preprocessor.

(In reply to comment #1)

I found a similar bug. Maybee it's the same. For example, I created a template
called "Negative" which calculates something. The source of this template is
{{<includeonly>subst:</includeonly>#expr: -{{{1}}} }} for example.

Usage: {{subst:Negative|7}}
Result: -7

Usage: {{Negative|7}}
Result: {{subst:#expr: -{{{1}}} }}

This is very strange and completely useless, obviously. The expected result is
{{Negative|7}}.

This is bug 5453.

herd wrote:

*** This bug has been marked as a duplicate of bug 5453 ***