Commit graph

17 commits

Author SHA1 Message Date
Brad Jorsch b386038c00 #switch should not match #default as a prefix
For example, "{{#switch:x|#defaultWTF? = This is crazy}}" should not
return "This is crazy".

Bug: 67871
Change-Id: Ie3f2e6b254b9f44028156268bd8d67aa3dd1cc62
2014-07-11 18:16:11 +00:00
Marcus Brinkmann 23dd608020 Fix #switch #default to match next (not last) named parameter.
Bug: 23192
Change-Id: I3a726b3aacb2a598f79c0dbebaa4f400ee2d9aa2
2014-07-11 14:02:12 -04:00
Brian Wolff 5497989886 Add unit tests for #ifexist in NS_MEDIA with file redirects
Bug: 32031
Change-Id: I6be56d9b1942caf85c26af1b08bda37b1f70b82c
2014-07-09 18:10:00 +00:00
Brian Wolff 3c3e0751d7 Decode html entities before comparing strings in #ifeq: and #switch
This makes foo's equal to foo's. This is particularly important
since {{PAGENAME}} and friends html encode certain characters.

This change should be communicated to users before it hits wikis.
I don't think anyone is relying on the current behaviour, but
you never know.

Bug: 35628
Change-Id: I0035ac541d22491fcf15f55f2589aaab394ed0ed
2014-06-25 16:21:58 -03:00
Gabriel Wicke e48bb4b2a9 Add test for special parameter whitespace stripping behavior
ParserFunctions strip whitespace from positional parameters, while normal
templates do not.

Change-Id: I9c736bedf103a668b324e7fd453d205d9824b9e4
2012-11-09 06:39:36 +00:00
Gabriel Wicke ff2801b0df Add a test for the preservation of tags in the #switch default value
This test is inspired by the Parsoid commit
https://gerrit.wikimedia.org/r/#/c/28623/, but applies to the PHP version too.

Change-Id: I4814b98597f2dd6a2279b8cdcc90a26fbbdecc71
2012-11-08 10:43:10 -08:00
Siebrand Mazeland aabd2bf24f Add test and output for {{#time:d F Y|1988-02-28|nl}}. This test should pass.
Would be nice if it was possible to add a test for {{#time:d F Y|1988-02-28|user}} where user language is "nl", because that does not work. Ref bug 28655 comment 10 and comment 17.
2011-12-21 21:59:38 +00:00
Brian Wolff c763bf6ce1 (bug 32351) Make #time[l] support explicitly specified timezones. Patch by Van de Bugger.
This would make something like {{#time:H:i:s| 9:30 January 1, 2012 MST}} convert the time from 9:30 mountatin standard time to whatever it is in UTC.

I made one minor change from the patch on bugzilla in changing an @ to a wfSuppressWarnings. (The @ was already in the code, it wasn't introduced by the patch).
2011-12-07 20:52:41 +00:00
Max Semenik 0055784a24 Follow-up to r67044: moved string function tests to a separate file protected by conditional, tweaked test runner to skip instead of exploding when required function hook is not found. 2010-07-09 21:11:54 +00:00
Max Semenik 1b75afd18d (bug 19940) urldecode dropped during StringFunctions-ParserFunctions merger 2010-05-29 16:12:41 +00:00
Alexandre Emsenhuber 75842e93a2 Follow-up r63906: add test case 2010-03-18 16:31:51 +00:00
Tim Starling 2a677438fa Revert r62436 and associated parser test. If you really want to make {{#ifexist:foo}} work the same way as [[File:foo]], which is presumably what bug 14779 is getting at, then you should do a proper job of it, and not introduce your own special #ifexist-specific syntax for specifying files. 2010-02-19 07:32:11 +00:00
Conrad Irwin 018bc0a353 Prevent duplicate warnings when running lots of parser tests. 2010-02-15 14:45:33 +00:00
Platonides 01ac7b9606 Add parsertests for #if, #ifeq, #iferror, #ifexpr from http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions PD examples. 2010-02-13 15:49:05 +00:00
Platonides 9fbeadd46f (Bug 14779) {{#ifexist}} does not recognise URL encoded filenames
Solution provided by Umherirrender
2010-02-13 15:08:25 +00:00
Aryeh Gregor 6905775132 Make default values fall through in switch
Bug 19093.  Previously {{#switch:foo|bar|#default=baz}} would behave
differently from {{#switch:foo|#default|bar=baz}}, even though they'd
behave identically if "#default" was replaced by "foo".

I changed switchObj but not switchHook.  In testing, switchObj was the
only method that seemed to be used, and I didn't want to make untested
changes to switchHook, so if that's used, the behavior may remain in
some cases.  It seems like code is duplicated between them -- whatever
the difference is, that should probably be factored out.

This passes all existing parser tests for #switch, of which there are
none, so don't blame me if it breaks something.  ;)
2009-06-05 16:53:59 +00:00
Brion Vibber 8a8fcf7466 * (bug 11686) Make #time work with pre-1970 dates
Uses DateTime class in PHP 5.2+ to support dates outside the 1970-2038 range. On earlier versions will still fall back to strtotime with the old 32-bit Unix timestamp range limitations.
Patch by rememberthedot -- https://bugzilla.wikimedia.org/attachment.cgi?id=5416

Added a couple quick parser test cases to confirm the new behavior. However I am seeing some annoyances with how input time zones are handled, so we'll want to clean that up at some point. :)
2008-10-27 17:56:58 +00:00