Subramanya Sastry has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/398902 )
Change subject: Linter: Delete commented out lints + mocha tests
......................................................................
Linter: Delete commented out lints + mocha tests
Change-Id: Iac8460ac7a39c941d6ad560814a950b457d37c41
---
M lib/wt2html/pp/processors/linter.js
M tests/mocha/linter.js
2 files changed, 0 insertions(+), 133 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid
refs/changes/02/398902/1
diff --git a/lib/wt2html/pp/processors/linter.js
b/lib/wt2html/pp/processors/linter.js
index 32cc7c5..4d466e1 100644
--- a/lib/wt2html/pp/processors/linter.js
+++ b/lib/wt2html/pp/processors/linter.js
@@ -74,33 +74,6 @@
return tagsWithChangedMisnestingBehavior;
}
-/*
- * Log Transclusion with more than one parts
- * Ex - {{table-start}}
- * {{cell|unused value|key=used value}}
- * |-
- * {{cell|unused value|key=used value}}
- * |-
- * |<math>1+1</math>
- * |}
- *
https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Transclusion_content
- */
-/*
-function logTransclusions(env, node, dp, tplInfo) {
- var parts = DU.getDataMw(node).parts;
- if (!Array.isArray(parts) || parts.length < 2) { return; }
-
- var type = 'multi-template';
- parts.forEach(function(a) {
- if (typeof a === 'string') {
- type = 'mixed-content';
- }
- });
-
- env.log('lint/' + type, { dsr: tplInfo.dsr });
-}
-*/
-
var getNextMatchingNode, leftMostDescendent;
leftMostDescendent = function(node, match) {
@@ -395,64 +368,8 @@
}
}
}
-
- /* TODO: not sure if this is useful / valid at all. Suppress
for now.
- if (DU.hasLiteralHTMLMarker(dp) &&
- dp.autoInsertedStart === true &&
- (tplInfo || dsr[3] > 0)) {
- lintObj = {
- dsr: dsr,
- templateInfo: templateInfo,
- };
- env.log('lint/missing-start-tag', lintObj);
- }
- */
}
}
-
-/*
- * Log ignored table attributes.
- * This handles cases like:
- *
- * {|
- * |- foo
- * | bar
- * |}
- *
- * Here foo gets ignored and is found in the data-parsoid of <tr> tags.
- */
-
-/* ----------------------------------------------
- * Comment out this whole thing to satisfy eslint
- *
-function logIgnoredTableAttr(env, node, dp, tplInfo) {
- if (!node.nodeName === 'TABLE') {
- return;
- }
-
- var tbody = DU.firstNonSepChildNode(node);
- var c = tbody.firstChild;
- while (c) {
- if (c.nodeName === 'TR') {
- dp = DU.getDataParsoid(c);
- if (dp.sa) {
- // Discard attributes that are only whitespace
and comments
- for (var key in dp.sa) {
- var re =
/^\s*$|^<!--([^-]|-(?!->))*-->([ \t]|<!--([^-]|-(?!->))*-->)*$/;
- if (!re.test(key) ||
!re.test(dp.sa[key])) {
- // FIXME: This is incorrect.
- // We need to check if the key
is absent in dp.a / in the node's attribute
- var templateInfo =
findEnclosingTemplateName(env, tplInfo);
- var lintObj = { dsr:
findLintDSR(templateInfo, tplInfo, dp.dsr), templateInfo: templateInfo };
-
env.log('lint/ignored-table-attr', lintObj);
- }
- }
- }
- }
- c = c.nextSibling;
- }
-}
-*/
/*
* Log fostered content marked by markFosteredContent.js
diff --git a/tests/mocha/linter.js b/tests/mocha/linter.js
index 47dfdcc..afe4183 100644
--- a/tests/mocha/linter.js
+++ b/tests/mocha/linter.js
@@ -230,37 +230,6 @@
});
});
- /*
- describe('IGNORED TABLE ATTRIBUTES', function() {
- it('should lint ignored table attributes correctly', function()
{
- return parseWT('{|\n|-
foo\n|bar\n|}').then(function(result) {
- result.should.have.length(1);
- result[0].should.have.a.property("type",
"ignored-table-attr");
- result[0].dsr.should.deep.equal([ 3, 14, 6, 0
]);
- });
- });
- it('should lint ignored table attributes found in transclusions
correctly', function() {
- return parseWT('{{1x|\n{{{!}}\n{{!}}- foo\n{{!}}
bar\n{{!}}}\n}}').then(function(result) {
- result.should.have.length(1);
- result[0].should.have.a.property("type",
"ignored-table-attr");
- result[0].dsr.should.deep.equal([ 0, 43, null,
null]);
-
result[0].should.have.a.property("templateInfo");
-
result[0].templateInfo.should.have.a.property("name", "Template:1x");
- });
- });
- it('should not lint whitespaces as ignored table attributes',
function() {
- return expectEmptyResults('{|\n|- \n| 1
||style="text-align:left;"| p \n|}');
- });
- it('should lint as ignored table attributes', function() {
- return parseWT('{|\n|- <!--bad
attr-->attr\n|bar\n|}').then(function(result) {
- result.should.have.length(1);
- result[0].should.have.a.property("type",
"ignored-table-attr");
- result[0].dsr.should.deep.equal([ 3, 30, 22, 0
]);
- });
- });
- });
- */
-
describe('BOGUS IMAGE OPTIONS', function() {
it('should lint Bogus image options correctly', function() {
return
parseWT('[[file:a.jpg|foo|bar]]').then(function(result) {
@@ -336,25 +305,6 @@
});
});
});
-
- /*
- describe('MIXED-CONTENT TEMPLATES', function() {
- it('should lint mixed-content templates', function() {
- return parseWT('{{1x|*}}hi').then(function(result) {
- result.should.have.length(1);
- result[0].should.have.a.property("type",
"mixed-content");
- result[0].dsr.should.deep.equal([ 0, 10, null,
null ]);
- });
- });
- it('should lint multi-template', function() {
- return
parseWT('{{1x|*}}{{1x|hi}}').then(function(result) {
- result.should.have.length(1);
- result[0].should.have.a.property("type",
"multi-template");
- result[0].dsr.should.deep.equal([ 0, 17, null,
null ]);
- });
- });
- });
- */
describe('DELETABLE TABLE TAG', function() {
it('should identify deletable table tag for T161341 (1)',
function() {
--
To view, visit https://gerrit.wikimedia.org/r/398902
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac8460ac7a39c941d6ad560814a950b457d37c41
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