Last modified: 2013-02-16 10:09:19 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 T46936, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 44936 - Parser functions in additional parameters of {{#tag:}} ignored / thrown away
Parser functions in additional parameters of {{#tag:}} ignored / thrown away
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
ParserFunctions (Other open bugs)
unspecified
All All
: Normal major (vote)
: ---
Assigned To: Nobody - You can work on this!
https://test.wikipedia.org/wiki/Parse...
: need-parsertest, parser
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-13 08:46 UTC by Danny B.
Modified: 2013-02-16 10:09 UTC (History)
3 users (show)

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


Attachments

Description Danny B. 2013-02-13 08:46:53 UTC
Parser functions in additional parameters of {{#tag:}} are ignored / thrown away.

See https://test.wikipedia.org/wiki/Parser_functions_in_tag_parser_function for demo.
Comment 1 Brion Vibber 2013-02-13 21:29:51 UTC
Looking at:
{{#tag:ref|general|{{#if:{{{group|}}}|group=g3}}}}

I'm pretty sure this parses something like this:

 #tag:ref
   unnamed param 1: resolves to "general"
   unnamed param 2: resolves to "group=g3"

while I'm assuming what you want is something like this:

 #tag:ref
   unnamed param 1: resolves to "general"
   named param "group": resolves to "g3" (if 'group' param is present)

To get that I'm pretty sure you need the literal "blahblah=" in there, something like:

{{#tag:ref|general|group={{#if:{{{group|}}}|g3}}

This of course will always add a "group" parameter, but sometimes it will be blank. This may or may not do what you want, naturally.
Comment 2 Danny B. 2013-02-14 09:26:25 UTC
(In reply to comment #1)
> Looking at:
> {{#tag:ref|general|{{#if:{{{group|}}}|group=g3}}}}
> 
> I'm pretty sure this parses something like this:
> 
>  #tag:ref
>    unnamed param 1: resolves to "general"
>    unnamed param 2: resolves to "group=g3"
> 
> while I'm assuming what you want is something like this:
> 
>  #tag:ref
>    unnamed param 1: resolves to "general"
>    named param "group": resolves to "g3" (if 'group' param is present)
> 
> To get that I'm pretty sure you need the literal "blahblah=" in there,
> something like:
> 
> {{#tag:ref|general|group={{#if:{{{group|}}}|g3}}
> 
> This of course will always add a "group" parameter, but sometimes it will be
> blank. This may or may not do what you want, naturally.

I actually originally used |group={{{group|}}} construction, but it had issues because then it behaved like named group, so instead of <references /> you had to put <references group="" /> which is obviously uncomfortable.

There might be other tags, where empty param value is valid construction and is not ignored, so the solution you propose is unfortunately not applicable to these situations.
Comment 3 db [inactive,noenotif] 2013-02-14 20:43:12 UTC
A empty group is ignored by Cite extension, so

{{#tag:ref|general|group=}}

is not shown with 

<references group="" />

Looks working for me.
Comment 4 Danny B. 2013-02-15 02:03:27 UTC
(In reply to comment #3)

Where were you testing that?
Comment 5 Danny B. 2013-02-15 02:15:34 UTC
I apologize. I was writing it out of memory, but made a mistake.

The problem was with naming.

(Empty) parameter name="" was the issue.

{{#tag:ref|ref1|name={{{name|}}}}}
{{#tag:ref|ref2|name={{{name|}}}}}
<references />

It *groups* (hence (and Brion's comment) why I was originally writing about group instead) them under the reference number of the first text and show only that one.

However, this is different issue (if it is incorrect and not intended behavior), this bug is about parser functions ignored.
Comment 6 Daniel Friesen 2013-02-15 02:31:58 UTC
Not sure of the best way to fix this.

This actually comes around from an intentional feature.
Templates and parser functions use literal names so that in something like say:
Sandbox: {{A|text=a=b}}}
Template:A: {{B|{{{text}}}}}
Template:B: {{{1}}}

In Template:A the text "a=b" is not interpreted as {{B|a=b}} resulting in Template:B breaking.
Comment 7 db [inactive,noenotif] 2013-02-16 10:09:19 UTC
Yes, a empty name is treated as a valid name, so that does not help here.

I think it is a feature, that a equals sign in the value of a param is treated as plain text and not as key=value, because than you can override param usage in sub templates.

So the example above would work, because Template A is expand to {{B|1=a=b}}, which works and looks expected.

Maybe Cite should be fixed for empty names, it is a breaking change, but the most use of that should be wrong use.

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


Navigation
Links