jenkins-bot has submitted this change and it was merged.
Change subject: Hygiene: Remove old function rmTransclusions()
..
Hygiene: Remove old function rmTransclusions()
Was commented out anyways.
Code has been moved to https://github.com/gwicke/parsoid-dom-utils
Bug: T121881
Change-Id: I72adc418f9ad9e4532fedfb3fcc9abc3eefa41c2
---
M lib/transforms.js
1 file changed, 0 insertions(+), 40 deletions(-)
Approvals:
Mholloway: Verified; Looks good to me, approved
Niedzielski: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/lib/transforms.js b/lib/transforms.js
index 38bd4dc..cde8d8a 100644
--- a/lib/transforms.js
+++ b/lib/transforms.js
@@ -93,41 +93,6 @@
}
}
-//** Remove transclusion data-mw provided by Parsoid. */
-/*
-function rmTransclusions(doc, names) {
-var nodes = doc.querySelectorAll('[typeof~=mw:Transclusion]');
-var dataMW;
-for (var i = 0; i < nodes.length; i++) {
-var node = nodes[i];
-dataMW = node.getAttribute('data-mw');
-if (dataMW) {
-var name;
-try {
-name =
JSON.parse(dataMW).parts[0].template.target.wt.trim().toLowerCase();
-} catch (e) {}
-if (name && names[name]) {
-// remove siblings if the about matches
-var about = node.getAttribute('about');
-var next = node.nextSibling;
-while (next
-&& ( // Skip over inter-element whitespace
-next.nodeType === NodeType.TEXT &&
/^\w+$/.test(next.nodeValue))
-// same about
-|| next.getAttribute && next.getAttribute('about') === about) {
-if (next.nodeType !== 3) {
-node.parentNode.removeChild(next);
-}
-next = node.nextSibling;
-}
-// finally, remove the transclusion node itself
-node.parentNode.removeChild(node);
-}
-}
-}
-}
-*/
-
function rewriteUrlAttribute(doc, selector, attribute) {
var ps = doc.querySelectorAll(selector) || [],
value;
@@ -189,11 +154,6 @@
}
function applyOptionalParsoidSpecificTransformations(doc) {
-// TODO: remove content produced by specific templates. Still needs work
since it removes too much.
-//rmTransclusions(doc, {
-//reflist: true
-//});
-
rmAttributes(doc, 'a:not([rel=nofollow])', ['rel']); // only leave rel
attributes with value nofollow
rmAttributes(doc, 'a', ['about', 'data-mw', 'id', 'typeof', 'title']);
rmAttributes(doc, 'div,ol,p,ul,table', ['about', 'data-mw', 'id',
'typeof']);
--
To view, visit https://gerrit.wikimedia.org/r/271451
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I72adc418f9ad9e4532fedfb3fcc9abc3eefa41c2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: BearND
Gerrit-Reviewer: Dbrant
Gerrit-Reviewer: Fjalapeno
Gerrit-Reviewer: GWicke
Gerrit-Reviewer: Mholloway
Gerrit-Reviewer: Mhurd
Gerrit-Reviewer: Mobrovac
Gerrit-Reviewer: Niedzielski
Gerrit-Reviewer: jenkins-bot <>
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits