Subramanya Sastry has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/401515 )

Change subject: T183893: Linter: Suppress multiple-unclosed-formatting-tags 
false positives
......................................................................

T183893: Linter: Suppress multiple-unclosed-formatting-tags false positives

Change-Id: Ia9eb0db638d76855b81cafab7afe81b59182e8d3
---
M lib/wt2html/pp/processors/linter.js
M tests/mocha/linter.js
2 files changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/15/401515/1

diff --git a/lib/wt2html/pp/processors/linter.js 
b/lib/wt2html/pp/processors/linter.js
index aa2a945..90c21c2 100644
--- a/lib/wt2html/pp/processors/linter.js
+++ b/lib/wt2html/pp/processors/linter.js
@@ -353,6 +353,9 @@
                                        env.log('lint/misnested-tag', lintObj);
                                } else if (!endTagOptional(c)) {
                                        lintObj.params.inTable = 
DU.hasAncestorOfName(c, 'TABLE');
+                                       if (dp.autoInsertedStart) {
+                                               lintObj.params.aiStart = true;
+                                       }
                                        env.log('lint/missing-end-tag', 
lintObj);
                                        if 
(Consts.HTML.FormattingTags.has(c.nodeName) && matchedOpenTagPairExists(c, dp)) 
{
                                                
env.log('lint/multiple-unclosed-formatting-tags', lintObj);
@@ -755,7 +758,7 @@
        var multiUnclosedTagName = null;
        lints.find(function(item) {
                // Unclosed tags in tables don't leak out of the table
-               if (item.type === 'missing-end-tag' && !item.params.inTable) {
+               if (item.type === 'missing-end-tag' && !item.params.aiStart && 
!item.params.inTable) {
                        if (item.params.name === 'small' || item.params.name 
=== 'big') {
                                var tagName = item.params.name;
                                if (!firstUnclosedTag[tagName]) {
diff --git a/tests/mocha/linter.js b/tests/mocha/linter.js
index c90047a..8889a11 100644
--- a/tests/mocha/linter.js
+++ b/tests/mocha/linter.js
@@ -801,6 +801,9 @@
                                result[4].params.should.have.a.property("name", 
"small");
                        });
                });
+               it('should not flag undetected misnesting of formatting tags as 
multiple unclosed formatting tags', function() {
+                       return noLintsOfThisType('<br><small>{{1x|<div>\n*item 
1\n</div>}}</small>', "multiple-unclosed-formatting-tags");
+               });
                it("should detect Tidy's smart auto-fixup of paired unclosed 
formatting tags", function() {
                        return parseWT('<b>foo<b>\n<code>foo <span>x</span> 
bar<code>').then(function(result) {
                                result.should.have.length(6);

-- 
To view, visit https://gerrit.wikimedia.org/r/401515
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia9eb0db638d76855b81cafab7afe81b59182e8d3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to