Last modified: 2014-06-13 16:37:27 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 T45685, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 43685 - Tag magic word has problem handling empty parameter
Tag magic word has problem handling empty parameter
Status: NEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.19.2
All All
: Low minor with 2 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-06 17:51 UTC by Huji
Modified: 2014-06-13 16:37 UTC (History)
3 users (show)

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


Attachments

Description Huji 2013-01-06 17:51:40 UTC
Please take a look at this example: https://test.wikipedia.org/wiki/User:Huji/tag:ref

For some reason, when an empty parameter "name" is passed, despite the fact that it is empty, the output of the tag changes.
Comment 1 Bawolff (Brian Wolff) 2013-03-10 16:31:33 UTC
That doesnt look wrong to me.... you are passing the empty string...
Comment 2 Dalba 2013-03-10 19:54:23 UTC
Maybe not wrong but is this behavior really needed?

For example when trying to create a wrapper template for <ref> tag, if the tag treated emptiness the same as  undefinedness, something like this could work:

{{
#tag:ref
|{{{1}}}
|name={{{{name|{{{2|}}}}}}}
|group={{{group|{{{3|}}}}}}
}}

But currently I can't find a way to write it without name and group interference (Mainly because it is needed to use an #if function to determine empty strings AND pipe characters in #if functions will interfere with those of the ref tag)
Comment 3 Dalba 2013-03-11 07:22:18 UTC
I stand corrected. You can ignore my last comment.
I think I finally found a way to do it:

{{#if:{{{group|{{{3|}}}}}}
   |{{#if:{{{name|{{{2|}}}}}}
      |{{#tag:ref|{{{1}}}|name="{{{name|{{{2}}}}}}"|group="{{{group|{{{3}}}}}}"}}
      |{{#tag:ref|{{{1}}}|group="{{{group|{{{3}}}}}}"}}
      }}
   |{{#if:{{{name|{{{2|}}}}}}
      |{{#tag:ref|{{{1}}}|name="{{{name|{{{2}}}}}}"}}
      |{{#tag:ref|{{{1}}}}}
      }}
   }}

(Use #if outside of #tag, not inside it)
Comment 4 Bawolff (Brian Wolff) 2013-03-11 19:34:20 UTC
Another method (hacky) that might work is append extra junk to the name parameter if its not used so that the param becomes some other param.

|name{{#if:{{{name|}}}||pad}}={{{name}}}

(Have not tested)

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


Navigation
Links