jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/348507 )

Change subject: T162919: Don't lint fostered rendering-transparent nodes
......................................................................


T162919: Don't lint fostered rendering-transparent nodes

* These fostered nodes don't affect rendering and linting them
  only serves to confuse editors.

Change-Id: I0efd4857e235f9aea12f53c274f6871128ba80ce
---
M lib/wt2html/pp/handlers/linter.js
M tests/mocha/linter.js
2 files changed, 26 insertions(+), 2 deletions(-)

Approvals:
  jenkins-bot: Verified
  Arlolra: Looks good to me, approved



diff --git a/lib/wt2html/pp/handlers/linter.js 
b/lib/wt2html/pp/handlers/linter.js
index 818638d..39624e1 100644
--- a/lib/wt2html/pp/handlers/linter.js
+++ b/lib/wt2html/pp/handlers/linter.js
@@ -398,8 +398,11 @@
        // Log bogus image options
        logBogusImageOptions(env, node, dp, tplInfo);
 
-       if (dp.fostered) {
-               // Log Fostered content
+       // Log fostered content, but skip rendering-transparent nodes
+       //
+       // FIXME: Create a separate emitsRenderingTransparentHTML helper
+       // and use it everywhere where this helper is being used as a proxy.
+       if (dp.fostered && !DU.emitsSolTransparentSingleLineWT(env, node, 
true)) {
                return logFosteredContent(env, node, dp, tplInfo);
        } else {
                return true;
diff --git a/tests/mocha/linter.js b/tests/mocha/linter.js
index 5f52149..80e036b 100644
--- a/tests/mocha/linter.js
+++ b/tests/mocha/linter.js
@@ -138,6 +138,27 @@
                                result[0].dsr.should.deep.equal([ 0, 18, 2, 2 
]);
                        });
                });
+               it('should not lint fostered categories', function() {
+                       return parseWT('{|\n[[Category:Fostered]]\n|-\n| 
bar\n|}').then(function(result) {
+                               result.should.have.length(0);
+                       });
+               });
+               it('should not lint fostered behavior switches', function() {
+                       return parseWT('{|\n__NOTOC__\n|-\n| 
bar\n|}').then(function(result) {
+                               result.should.have.length(0);
+                       });
+               });
+               it('should not lint fostered include directives without 
fostered content', function() {
+                       return 
parseWT('{|\n<includeonly>boo</includeonly>\n|-\n| 
bar\n|}').then(function(result) {
+                               result.should.have.length(0);
+                       });
+               });
+               it('should lint fostered include directives that has fostered 
content', function() {
+                       return parseWT('{|\n<noinclude>boo</noinclude>\n|-\n| 
bar\n|}').then(function(result) {
+                               result.should.have.length(1);
+                               result[0].should.have.a.property("type", 
"fostered");
+                       });
+               });
                it('should lint ignored table attributes Correctly', function() 
{
                        return parseWT('{|\n|- 
foo\n|bar\n|}').then(function(result) {
                                result.should.have.length(1);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0efd4857e235f9aea12f53c274f6871128ba80ce
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org>
Gerrit-Reviewer: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to