r51339 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51338‎ | r51339 | r51340 >
Date:12:39, 2 June 2009
Author:werdna
Status:ok
Tags:
Comment:
Fix up r49794, make new groups noncapturing, fixing offset problem with linked dates
Modified paths:
  • /trunk/phase3/includes/parser/DateFormatter.php (modified) (history)
  • /trunk/phase3/maintenance/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/parserTests.txt
@@ -7309,6 +7309,17 @@
73107310 </p>
73117311 !! end
73127312
 7313+!! test
 7314+Spacing of numbers in formatted dates (linked)
 7315+!! config
 7316+wgUseDynamicDates=true
 7317+!! input
 7318+[[January 15]]
 7319+!! result
 7320+<p><span class="mw-formatted-date" title="01-15"><a href="https://www.mediawiki.org/index.php?title=January_15&amp;action=edit&amp;redlink=1" class="new" title="January 15 (page does not exist)">January 15</a></span>
 7321+</p>
 7322+!! end
 7323+
73137324 #
73147325 #
73157326 #
Index: trunk/phase3/includes/parser/DateFormatter.php
@@ -48,10 +48,10 @@
4949 $this->prxISO2 = '\[\[(-?\d{4})-(\d{2})-(\d{2})\]\]';
5050
5151 # Real regular expressions
52 - $this->regexes[self::DMY] = "/{$this->prxDM}( *, *| +){$this->prxY}{$this->regexTrail}";
53 - $this->regexes[self::YDM] = "/{$this->prxY}( *, *| +){$this->prxDM}{$this->regexTrail}";
54 - $this->regexes[self::MDY] = "/{$this->prxMD}( *, *| +){$this->prxY}{$this->regexTrail}";
55 - $this->regexes[self::YMD] = "/{$this->prxY}( *, *| +){$this->prxMD}{$this->regexTrail}";
 52+ $this->regexes[self::DMY] = "/{$this->prxDM}(?: *, *| +){$this->prxY}{$this->regexTrail}";
 53+ $this->regexes[self::YDM] = "/{$this->prxY}(?: *, *| +){$this->prxDM}{$this->regexTrail}";
 54+ $this->regexes[self::MDY] = "/{$this->prxMD}(?: *, *| +){$this->prxY}{$this->regexTrail}";
 55+ $this->regexes[self::YMD] = "/{$this->prxY}(?: *, *| +){$this->prxMD}{$this->regexTrail}";
5656 $this->regexes[self::DM] = "/{$this->prxDM}{$this->regexTrail}";
5757 $this->regexes[self::MD] = "/{$this->prxMD}{$this->regexTrail}";
5858 $this->regexes[self::ISO1] = "/{$this->prxISO1}{$this->regexTrail}";

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r49794Fix spacing issues with autoformatted dates. Includes a parser test for the s...werdna04:01, 24 April 2009

Status & tagging log