Last modified: 2014-10-25 19:00:57 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 T72077, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 70077 - Order of named parameters passed to parser functions is lost
Order of named parameters passed to parser functions is lost
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
Scribunto (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-08-27 02:32 UTC by Jackmcbarn
Modified: 2014-10-25 19:00 UTC (History)
5 users (show)

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


Attachments

Description Jackmcbarn 2014-08-27 02:32:29 UTC
It's impossible to convert the statement "frame:preprocess('{{#switch:' .. v .. '|red|orange=1|yellow|green=2|blue|indigo=3|violet=4|5}}')" to use frame:callParserFunction. Here are two attempts that don't work:

frame:callParserFunction('#switch', {v, 'red', 'orange=1', 'yellow', 'green=2', 'blue', 'indigo=3', 'violet=4', '5'})

This one doesn't work because the values aren't split at the equals sign, which isn't a bad thing.

frame:callParserFunction('#switch', {v, 'red', orange='1', 'yellow', green='2', 'blue', indigo='3', violet='4', '5'})

This one doesn't work because Lua can't maintain order in an associative array, which is the cause of this bug. To fix this, I propose the following new syntax:

frame:callParserFunction('#switch', {v, 'red', {'orange', '1'}, 'yellow', {'green', '2'}, 'blue', {'indigo', '3'}, {'violet', '4'}, '5'})

Although only parser functions can "see" order like this, I also propose that for consistency's sake, all brace-substitution functions (newChild, expandTemplate, etc.) should support taking arguments in this format, or a similar one that accomplishes the same thing.

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


Navigation
Links