Subramanya Sastry has uploaded a new change for review.
https://gerrit.wikimedia.org/r/206318
Change subject: [roundtrip-test] Strip <br/> from HTML when comparing wikitext
diffs
......................................................................
[roundtrip-test] Strip <br/> from HTML when comparing wikitext diffs
* <br/> are always added by Parsoid when multiple newlines are
encountered in wikitext. So, they are not really semantic diffs
but more semantic diffs.
* Stripping these during normalization makes for better categorization
of diffs seen in rt-testing.
* Unsure if these should be part of the regular HTML normalization
routines, so not adding there.
* Eliminates false-positive reports on the following pages:
nlwiki:Watergang
iswiki:Fyrsta_ráðuneyti_Geirs_Haarde
iswiki:Jón_Vídalín
and possibly more.
Change-Id: I2097301920d5f1fc5c2cec5150090479ff08a8ad
---
M tests/roundtrip-test.js
1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid
refs/changes/18/206318/1
diff --git a/tests/roundtrip-test.js b/tests/roundtrip-test.js
index ae192f1..7fbb85f 100755
--- a/tests/roundtrip-test.js
+++ b/tests/roundtrip-test.js
@@ -454,7 +454,8 @@
// node need not be an element always!
origOrigHTML += DU.serializeNode(origOut[k], {
smartQuote: false });
}
- origHTML = DU.formatHTML(DU.normalizeOut(origOrigHTML));
+ // Normalize away <br/>'s added by Parsoid because of newlines
in wikitext
+ origHTML =
DU.formatHTML(DU.normalizeOut(origOrigHTML.replace(/<br\s*\/?>/g, '')));
res = findMatchingNodes(newBody, offset[1] || {}, newWt.length);
newOut = res ? res.nodes : [];
@@ -462,7 +463,8 @@
// node need not be an element always!
origNewHTML += DU.serializeNode(newOut[k], {
smartQuote: false });
}
- newHTML = DU.formatHTML(DU.normalizeOut(origNewHTML));
+ // Normalize away <br/>'s added by Parsoid because of newlines
in wikitext
+ newHTML =
DU.formatHTML(DU.normalizeOut(origNewHTML.replace(/<br\s*\/?>/g, '')));
// compute wt diffs
var wt1 = oldWt.substring(offset[0].start, offset[0].end);
--
To view, visit https://gerrit.wikimedia.org/r/206318
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2097301920d5f1fc5c2cec5150090479ff08a8ad
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits