Fix up r49794, make new groups noncapturing, fixing offset problem with linked dates
authorAndrew Garrett <werdna@users.mediawiki.org>
Tue, 2 Jun 2009 12:39:14 +0000 (12:39 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Tue, 2 Jun 2009 12:39:14 +0000 (12:39 +0000)
includes/parser/DateFormatter.php
maintenance/parserTests.txt

index 9bd6c68..087fdda 100644 (file)
@@ -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}";
index b4be06d..acb3c18 100644 (file)
@@ -7309,6 +7309,17 @@ Spacing of numbers in formatted dates
 </p>
 !! end
 
+!! test
+Spacing of numbers in formatted dates (linked)
+!! config
+wgUseDynamicDates=true
+!! input
+[[January 15]]
+!! result
+<p><span class="mw-formatted-date" title="01-15"><a href="/index.php?title=January_15&amp;action=edit&amp;redlink=1" class="new" title="January 15 (page does not exist)">January 15</a></span>
+</p>
+!! end
+
 #
 #
 #