Page MenuHomePhabricator

patch_1937_parser_cvs.txt

Authored By
bzimport
Nov 21 2014, 8:21 PM
Size
930 B
Referenced Files
None
Subscribers
None

patch_1937_parser_cvs.txt

Index: Parser.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/Parser.php,v
retrieving revision 1.430
diff -u -r1.430 Parser.php
--- Parser.php 1 May 2005 01:11:15 -0000 1.430
+++ Parser.php 1 May 2005 09:43:26 -0000
@@ -186,7 +186,9 @@
$dashReplace = array(
'/ - /' => " – ", # N dash
- '/(?<=[0-9])-(?=[0-9])/' => "&ndash;", # N dash between numbers
+ '/(?<=\d)(?<!-\d|-\d{2}|-\d{3}|-\d{4}|-\d{5}|-\d{6})-(?=\d+[^-\d])/' => "&ndash;", # N dash between numbers
+ // the lookbehind assertions avoid wrong replacements in ISBN numbers (checking for up to 6 consecutive numbers between dashes)
+ // they can't be written as shorter combination as lookbehinds must have fixed length
'/ -- /' => "&nbsp;&mdash; " # M dash
);
$text = preg_replace( array_keys($dashReplace), array_values($dashReplace), $text );

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1485
Default Alt Text
patch_1937_parser_cvs.txt (930 B)

Event Timeline