jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/380890 )
Change subject: BadImageRemover: Update for figure-inline change in Parsoid ...................................................................... BadImageRemover: Update for figure-inline change in Parsoid Bug: T173972 Change-Id: I80506d71d3f035fdf3970d7619219791640669e3 --- M includes/Parsoid/Fixer/BadImageRemover.php M tests/phpunit/Parsoid/Fixer/BadImageRemoverTest.php 2 files changed, 25 insertions(+), 1 deletion(-) Approvals: jenkins-bot: Verified Arlolra: Looks good to me, but someone else must approve Jforrester: Looks good to me, approved diff --git a/includes/Parsoid/Fixer/BadImageRemover.php b/includes/Parsoid/Fixer/BadImageRemover.php index 8f97675..3fedf06 100644 --- a/includes/Parsoid/Fixer/BadImageRemover.php +++ b/includes/Parsoid/Fixer/BadImageRemover.php @@ -41,7 +41,7 @@ * @return string */ public function getXPath() { - return '//span[@typeof="mw:Image"]//img[@resource]'; + return '//figure-inline[@typeof="mw:Image"]//img[@resource] | //span[@typeof="mw:Image"]//img[@resource]'; } /** diff --git a/tests/phpunit/Parsoid/Fixer/BadImageRemoverTest.php b/tests/phpunit/Parsoid/Fixer/BadImageRemoverTest.php index 47c9994..251f36a 100644 --- a/tests/phpunit/Parsoid/Fixer/BadImageRemoverTest.php +++ b/tests/phpunit/Parsoid/Fixer/BadImageRemoverTest.php @@ -21,6 +21,18 @@ [ 'Passes through allowed good images', // expected html after filtering + '<p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Image.jpg"><img resource="./File:Image.jpg" src="//upload.wikimedia.org/wikipedia/commons/7/78/Image.jpg" height="500" width="500"></a></figure-inline> and other stuff</p>', + // input html + '<p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Image.jpg"><img resource="./File:Image.jpg" src="//upload.wikimedia.org/wikipedia/commons/7/78/Image.jpg" height="500" width="500"></a></figure-inline> and other stuff</p>', + // accept/decline callback + function () { + return false; + } + ], + + [ + 'Passes through allowed good images (with legacy span markup)', + // expected html after filtering '<p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Image.jpg"><img resource="./File:Image.jpg" src="//upload.wikimedia.org/wikipedia/commons/7/78/Image.jpg" height="500" width="500"></a></span> and other stuff</p>', // input html '<p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Image.jpg"><img resource="./File:Image.jpg" src="//upload.wikimedia.org/wikipedia/commons/7/78/Image.jpg" height="500" width="500"></a></span> and other stuff</p>', @@ -47,6 +59,18 @@ // expected html after filtering '<p> and other stuff</p>', // input html + '<p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Image.jpg"><img resource="./File:Image.jpg" src="//upload.wikimedia.org/wikipedia/commons/7/78/Image.jpg" height="500" width="500"></a></figure-inline> and other stuff</p>', + // accept/decline callback + function () { + return true; + } + ], + + [ + 'Strips declined images (with legacy span markup)', + // expected html after filtering + '<p> and other stuff</p>', + // input html '<p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Image.jpg"><img resource="./File:Image.jpg" src="//upload.wikimedia.org/wikipedia/commons/7/78/Image.jpg" height="500" width="500"></a></span> and other stuff</p>', // accept/decline callback function () { -- To view, visit https://gerrit.wikimedia.org/r/380890 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I80506d71d3f035fdf3970d7619219791640669e3 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: master Gerrit-Owner: Catrope <r...@wikimedia.org> Gerrit-Reviewer: Arlolra <abrea...@wikimedia.org> Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits