Brion VIBBER has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/354607 )
Change subject: Add \b to regexes in BlockLevelPass to avoid confusing tr & track ...................................................................... Add \b to regexes in BlockLevelPass to avoid confusing tr & track With TimedMediaHandler in video.js mode, videos can be inline, without a wrapper div. Previously, in this mode two paragraphs where one contained a video would end up merged into one paragraph, due to BlockLevelPass matching "<track .../>" against "<tr" in its regexes. Added \b to a couple of the regexes to protect against such errors, and corrected a parser test case that had bad output listed, where "<link .../>" matched against "<li". Bug: T165820 Change-Id: I06e82b881f5ebddae5e7df7fb940adfa54f6b659 --- M includes/parser/BlockLevelPass.php M tests/parser/parserTests.txt 2 files changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/07/354607/1 diff --git a/includes/parser/BlockLevelPass.php b/includes/parser/BlockLevelPass.php index 2023d13..599fbf6 100644 --- a/includes/parser/BlockLevelPass.php +++ b/includes/parser/BlockLevelPass.php @@ -286,14 +286,14 @@ # @todo consider using a stack for nestable elements like span, table and div $openMatch = preg_match( '/(?:<table|<h1|<h2|<h3|<h4|<h5|<h6|<pre|<tr|' - . '<p|<ul|<ol|<dl|<li|<\\/tr|<\\/td|<\\/th)/iS', + . '<p|<ul|<ol|<dl|<li|<\\/tr|<\\/td|<\\/th)\\b/iS', $t ); $closeMatch = preg_match( '/(?:<\\/table|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|' . '<td|<th|<\\/?blockquote|<\\/?div|<hr|<\\/pre|<\\/p|<\\/mw:|' . Parser::MARKER_PREFIX - . '-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)/iS', + . '-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)\\b/iS', $t ); diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 2d107e7..368dc0d 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -17552,10 +17552,10 @@ <p> <meta itemprop="hello" content="world" /> <meta http-equiv="refresh" content="5"> <meta itemprop="hello" content="5" /> -</p> <link itemprop="hello" href="http://example.org" /> <link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"> <link itemprop="hello" href="http://example.org" /> +</p> </div> !! end -- To view, visit https://gerrit.wikimedia.org/r/354607 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I06e82b881f5ebddae5e7df7fb940adfa54f6b659 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Brion VIBBER <br...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits