Arlolra has uploaded a new change for review.

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

Change subject: Allow stop characters as quoted attribute delimiters
......................................................................

Allow stop characters as quoted attribute delimiters

 * Matches Parsoid in Ibdaa51f94eadc640278594a3eb5dd43356c286ea

Change-Id: I51b6861d7232d857b75881966091ae1e662c13a9
---
M includes/Sanitizer.php
M tests/parser/parserTests.txt
2 files changed, 8 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/51/234151/1

diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php
index fbf3234..3591504 100644
--- a/includes/Sanitizer.php
+++ b/includes/Sanitizer.php
@@ -346,8 +346,8 @@
                                  ($space*=$space*
                                        (?:
                                         # The attribute value: quoted or alone
-                                         \"([^<\"]*)\"
-                                        | '([^<']*)'
+                                         \"([^<\"]*)(?:\"|\$)
+                                        | '([^<']*)(?:'|\$)
                                         |  
([a-zA-Z0-9!#$%&()*,\\-.\\/:;<>?@[\\]^_`{|}~]+)
                                        )
                                )?(?=$space|\$)/sx";
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index f70a1b0..8fe8c61 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -6859,9 +6859,6 @@
 </tbody></table>
 !! end
 
-
-# PHP throws away the (semi-broken) "foo" class here; Parsoid
-# preserves it.
 !!test
 Parsoid: Recover better from broken table attributes
 !!options
@@ -6872,7 +6869,7 @@
 foo
 |}
 !!html/php+tidy
-<table>
+<table class="foo">
 <tr>
 <td class="bar">
 <p>foo</p>
@@ -20616,7 +20613,7 @@
 </div>
 
 <h2><span class="mw-headline" id="Hello"><sup 
class="in-h2">Hello</sup></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: Hello">edit</a><span 
class="mw-editsection-bracket">]</span></span></h2>
-<h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> 
b"&gt;Evilbye</sup></span><span class="mw-editsection"><span 
class="mw-editsection-bracket">[</span><a 
href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit 
section: b&quot;&gt;Evilbye">edit</a><span 
class="mw-editsection-bracket">]</span></span></h2>
+<h2><span class="mw-headline" id="b.22.3EEvilbye"><sup class="a"> 
b"&gt;Evilbye</sup></span><span class="mw-editsection"><span 
class="mw-editsection-bracket">[</span><a 
href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit 
section: b&quot;&gt;Evilbye">edit</a><span 
class="mw-editsection-bracket">]</span></span></h2>
 
 !! end
 
@@ -23407,20 +23404,9 @@
 !! wikitext
 <span title="Hello world>Foo</span>
 !! html/php
-<p><span>Foo</span>
-</p>
-!! html/parsoid
 <p><span title="Hello world">Foo</span>
 </p>
-!! end
-
-!! test
-Parsoid-only: HTML tag with broken attribute value quoting
-!! options
-parsoid
-!! wikitext
-<span title="Hello world>Foo</span>
-!! html
+!! html/parsoid
 <p><span title="Hello world">Foo</span>
 </p>
 !! end
@@ -23434,7 +23420,7 @@
 !! html/php
 <table>
 <tr>
-<td>Foo
+<td title="Hello world">Foo
 </td></tr></table>
 
 !! html/parsoid
@@ -23455,9 +23441,9 @@
 !! html/php
 <table>
 <tr>
-<td>Foo
+<td title="Hello world">Foo
 </td>
-<td>Bar
+<td style="color:red">Bar
 </td></tr></table>
 
 !! html/parsoid

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I51b6861d7232d857b75881966091ae1e662c13a9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to