Adding the U (ungreedy) param seems to fix this (and not break anything I
know of).
Yeah, it was being greedy on the (.*), swalling the \n if there was any and
then the condition ( \n? ) allowed for it to complete the match.
<div><FONT color=#3333cc>-Aaron Schulz</FONT></div></html>
From: Rotem Liss <rotemliss_public(a)fastmail.fm>
Reply-To: Wikimedia developers <wikitech-l(a)lists.wikimedia.org>
To: wikitech-l(a)lists.wikimedia.org
Subject: Re: [Wikitech-l] [MediaWiki-CVS]
SVN:[22496] trunk/phase3/includes/GlobalFunctions.php
Date: Tue, 29 May 2007 14:47:43 +0300
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.
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org
http://lists.wikimedia.org/mailman/listinfo/wikitech-l
_________________________________________________________________
PC Magazines 2007 editors choice for best Web mailaward-winning Windows
Live Hotmail.