Last modified: 2014-09-24 00:15:04 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 T34746, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 32746 - Template:!, = (( and )) as built-in variables
Template:!, = (( and )) as built-in variables
Status: NEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.20.x
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-reviewed
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-01 02:52 UTC by Daniel A. R. Werner
Modified: 2014-09-24 00:15 UTC (History)
5 users (show)

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


Attachments
This will make "((", "))", "=" and "!" variables available. (1.88 KB, patch)
2011-12-01 02:52 UTC, Daniel A. R. Werner
Details

Description Daniel A. R. Werner 2011-12-01 02:52:46 UTC
Created attachment 9588 [details]
This will make "((", "))", "=" and "!" variables available.

Since most wikis use certain templates as workarounds for things like the pipe character, it might be an good idea to include them directly into MediaWikis core.

First of all, this would perhaps make things more consistent throughout different wikis, at the same time unnecessary to create them first.

But the main reason why I'd like to see this within the core would be, that having "((", "))", "=" and "!" consistently within all wikis would be valuable for extension development.
When passing something to PPFrame->expand() which contains user input, perhaps as value for a generated template/function call as a parameter value, this value should be "escaped" first so the user input can't destroy the code built around it.
Right now this is just somewhat possible with wfEscapeWikiText() but its not good for many cases where you would need all the special characters as on byte characters instead of HTML entities.
So a new function wfEscapeForExpansion() might be interesting as well, but first the decision to include the "((", "))", "=" and "!" variables must be made.

I am not sure about other workaround templates such as "!-", perhaps there are some others which would make sense as well.

Also, some characters as first characters within a string are troublemakers like ":" or ";". Maybe there should be an entirely different way to address this problem.
Comment 1 Sumana Harihareswara 2011-12-01 12:50:23 UTC
Added "patch" and "need-review" keywords to indicate that this patch awaits code review.
Comment 2 Chad H. 2011-12-05 13:22:18 UTC
At the very least, such a change *must* have test cases.

However, introducing new magic syntax generally sounds like a bad idea :(
Comment 3 Daniel A. R. Werner 2011-12-05 13:47:32 UTC
Is it really new syntax we are talking about? I think they are just new magic words which are part of an old syntax generally called brace substitution or more specifically; variables, pretty much built-in templates.

I guess with test cases you are talking about the mentioned problem with PPFrame::expand() where it should be possible to escape some passed stuff? pretty much like you would use preg_quote() if you have user input you want to put as a part of a regular expression.
Comment 4 Andre Klapper 2013-03-14 13:46:14 UTC
Daniel: Interested in putting that patch into Gerrit?
Comment 5 Kunal Mehta (Legoktm) 2014-08-12 19:21:58 UTC
{{!}} is now a native parser function. Unsure if we want to do the same for the other ones in the bug title.

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


Navigation
Links