Last modified: 2014-09-24 00:15:04 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.
Added "patch" and "need-review" keywords to indicate that this patch awaits code review.
At the very least, such a change *must* have test cases. However, introducing new magic syntax generally sounds like a bad idea :(
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.
Daniel: Interested in putting that patch into Gerrit?
{{!}} is now a native parser function. Unsure if we want to do the same for the other ones in the bug title.