From: Andrew Garrett Date: Fri, 24 Apr 2009 04:01:24 +0000 (+0000) Subject: Fix spacing issues with autoformatted dates. Includes a parser test for the specific... X-Git-Tag: 1.31.0-rc.0~42063 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=6de14e92467406c4c66813aae70ffa05a03bd49d;p=lhc%2Fweb%2Fwiklou.git Fix spacing issues with autoformatted dates. Includes a parser test for the specific failure case which was fixed. --- diff --git a/includes/parser/DateFormatter.php b/includes/parser/DateFormatter.php index aa6415e47a..9bd6c68a3e 100644 --- a/includes/parser/DateFormatter.php +++ b/includes/parser/DateFormatter.php @@ -48,10 +48,10 @@ class DateFormatter $this->prxISO2 = '\[\[(-?\d{4})-(\d{2})-(\d{2})\]\]'; # Real regular expressions - $this->regexes[self::DMY] = "/{$this->prxDM} *,? *{$this->prxY}{$this->regexTrail}"; - $this->regexes[self::YDM] = "/{$this->prxY} *,? *{$this->prxDM}{$this->regexTrail}"; - $this->regexes[self::MDY] = "/{$this->prxMD} *,? *{$this->prxY}{$this->regexTrail}"; - $this->regexes[self::YMD] = "/{$this->prxY} *,? *{$this->prxMD}{$this->regexTrail}"; + $this->regexes[self::DMY] = "/{$this->prxDM}( *, *| +){$this->prxY}{$this->regexTrail}"; + $this->regexes[self::YDM] = "/{$this->prxY}( *, *| +){$this->prxDM}{$this->regexTrail}"; + $this->regexes[self::MDY] = "/{$this->prxMD}( *, *| +){$this->prxY}{$this->regexTrail}"; + $this->regexes[self::YMD] = "/{$this->prxY}( *, *| +){$this->prxMD}{$this->regexTrail}"; $this->regexes[self::DM] = "/{$this->prxDM}{$this->regexTrail}"; $this->regexes[self::MD] = "/{$this->prxMD}{$this->regexTrail}"; $this->regexes[self::ISO1] = "/{$this->prxISO1}{$this->regexTrail}"; diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index c19a6f706e..1d4a95eaa5 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -7289,7 +7289,16 @@ wgUseDynamicDates=false !! result

2009-03-24

-!!end +!! end + +!! test +Spacing of numbers in formatted dates +!! input +{{#formatdate:January 15}} +!! result +

January 15 +

+!! end # #