Tim Starling has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316617

Change subject: Add dotall modifier to EDITSECTION_REGEX
......................................................................

Add dotall modifier to EDITSECTION_REGEX

The regex failed to match for input text like

==<nowiki>
</nowiki>==

resulting in <mw:editsection> tags being leaked into the output.

Change-Id: I3daade920d2de8cd3fc31fcaabf46ffe14b047d5
---
M includes/parser/ParserOutput.php
M tests/parser/parserTests.txt
2 files changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/17/316617/1

diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php
index 9dfa97c..e9cdfcf 100644
--- a/includes/parser/ParserOutput.php
+++ b/includes/parser/ParserOutput.php
@@ -213,7 +213,7 @@
        private $mMaxAdaptiveExpiry = INF;
 
        const EDITSECTION_REGEX =
-               '#<(?:mw:)?editsection page="(.*?)" 
section="(.*?)"(?:/>|>(.*?)(</(?:mw:)?editsection>))#';
+               '#<(?:mw:)?editsection page="(.*?)" 
section="(.*?)"(?:/>|>(.*?)(</(?:mw:)?editsection>))#s';
 
        // finalizeAdaptiveCacheExpiry() uses TTL = MAX( m * PARSE_TIME + b, 
MIN_AR_TTL)
        // Current values imply that m=3933.333333 and b=-333.333333
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index ba7b0d4..e12bc03 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -514,6 +514,17 @@
 !! end
 
 !! test
+Heading with line break in nowiki
+!! wikitext
+== A <nowiki>B
+C</nowiki> ==
+!! html
+<h2><span class="mw-headline" id="A_B.0AC">A B
+C</span><span class="mw-editsection"><span 
class="mw-editsection-bracket">[</span><a 
href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit 
section: A B&#10;C">edit</a><span 
class="mw-editsection-bracket">]</span></span></h2>
+
+!! end
+
+!! test
 Parsing an URL
 !! wikitext
 http://fr.wikipedia.org/wiki/🍺

-- 
To view, visit https://gerrit.wikimedia.org/r/316617
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3daade920d2de8cd3fc31fcaabf46ffe14b047d5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <tstarl...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to