aaron(a)svn.wikimedia.org wrote:
Revision: 22496
Author: aaron
Date: 2007-05-27 21:23:59 -0700 (Sun, 27 May 2007)
Log Message:
-----------
*use /s modifier for parseinline regexp, <p> tags were being left on some messages
Modified Paths:
--------------
trunk/phase3/includes/GlobalFunctions.php
Modified: trunk/phase3/includes/GlobalFunctions.php
===================================================================
--- trunk/phase3/includes/GlobalFunctions.php 2007-05-28 02:57:35 UTC (rev 22495)
+++ trunk/phase3/includes/GlobalFunctions.php 2007-05-28 04:23:59 UTC (rev 22496)
@@ -592,7 +592,7 @@
} elseif ( in_array('parseinline', $options) ) {
$string = $wgOut->parse( $string, true, true );
$m = array();
- if( preg_match( "~^<p>(.*)\n?</p>$~", $string, $m ) ) {
+ if( preg_match( '/^<p>(.*)\n?<\/p>$/s', $string, $m ) ) {
$string = $m[1];
}
} elseif ( in_array('parsemag', $options) ) {
This change caused a regression in the watchlist: it added a whitespace in the
page, between "Below are the last x changes..." and "Show last 1 | 2 | 6 |
12
hours...". It is so because the parsed message (rcnote, I think) contains after
the parse a newline mark before the </p> tag, and it is not stripped (because
included in the brackets, thus in $m[1]). Since the "\n" mark (after the
brackets in the regexp) is optional, the regexp engine seems to think the "\n"
char is not the "\n?", but included in "(.*)" (as "." can
include a newline).
This should be somehow fixed, as the newline causes this whitespace.