From 6ea1c4e9e8382e62a6c58e60d112e393162a3208 Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Tue, 2 Jun 2009 12:39:14 +0000 Subject: [PATCH] Fix up r49794, make new groups noncapturing, fixing offset problem with linked dates --- includes/parser/DateFormatter.php | 8 ++++---- maintenance/parserTests.txt | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/includes/parser/DateFormatter.php b/includes/parser/DateFormatter.php index 9bd6c68a3e..087fdda468 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 b4be06d63b..acb3c1899a 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -7309,6 +7309,17 @@ Spacing of numbers in formatted dates

!! end +!! test +Spacing of numbers in formatted dates (linked) +!! config +wgUseDynamicDates=true +!! input +[[January 15]] +!! result +

January 15 +

+!! end + # # # -- 2.20.1