Subramanya Sastry has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/401424 )
Change subject: Linter: Simplify logic a bit for readability + fix file comment
......................................................................
Linter: Simplify logic a bit for readability + fix file comment
Change-Id: I2e9d578474ca73928634f55517106bc82aed23f4
---
M lib/wt2html/pp/processors/linter.js
1 file changed, 9 insertions(+), 25 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid
refs/changes/24/401424/1
diff --git a/lib/wt2html/pp/processors/linter.js
b/lib/wt2html/pp/processors/linter.js
index f705cab..aa2a945 100644
--- a/lib/wt2html/pp/processors/linter.js
+++ b/lib/wt2html/pp/processors/linter.js
@@ -1,14 +1,6 @@
/*
- * DOM pass that walks the DOM tree and places a call to logger
- * with logtype 'lint/*' to log the following scenarios:
- *
- * 1. Treebuilder fixups
- * 2. Fostered content
- * 3. Ignored table attributes
- * 4. Multi-template blocks
- * 5. Mixed content in template markup
- * 6. Obsolete HTML tags
- * 7. Self-closed HTML tags
+ * DOM pass that walks the DOM tree, detects specific wikitext patterns,
+ * and emits them as linter events via the lint/* logger type.
*/
'use strict';
@@ -897,23 +889,15 @@
};
}
- // Let native extensions lint their content
var nextNode;
- var done = false;
+ var nativeExt;
var match = (nodeTypeOf || '').match(/\bmw:Extension\/(.+?)\b/);
- if (match) {
- var extTag = match[1];
- var nativeExt = env.conf.wiki.extensionTags.get(extTag);
- if (nativeExt && nativeExt.lintHandler) {
- nextNode = nativeExt.lintHandler(node, env,
tplInfo, findLints);
- done = true;
- }
- }
-
- // Default node handler
- // Don't rely on the presence or well-behavedness of the native
lint handler
- // That is the reason for if (!done) instead of if (!nextNode)
- if (!done) {
+ if (match &&
+ (nativeExt = env.conf.wiki.extensionTags.get(match[1]))
&&
+ nativeExt.lintHandler
+ ) { // Let native extensions lint their content
+ nextNode = nativeExt.lintHandler(node, env, tplInfo,
findLints);
+ } else { // Default node handler
// Lint this node
nextNode = logWikitextFixups(node, env, tplInfo);
if (tplInfo && tplInfo.clear) {
--
To view, visit https://gerrit.wikimedia.org/r/401424
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2e9d578474ca73928634f55517106bc82aed23f4
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