Arlolra has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/379679 )

Change subject: T170832: Don't emit template info in lint for extension tags
......................................................................

T170832: Don't emit template info in lint for extension tags

 * We could probably provide finer grained dsr for native extensions
   but hold off on that for now.

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


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

diff --git a/lib/wt2html/pp/handlers/linter.js 
b/lib/wt2html/pp/handlers/linter.js
index 8e95440..2a8bb3d 100644
--- a/lib/wt2html/pp/handlers/linter.js
+++ b/lib/wt2html/pp/handlers/linter.js
@@ -89,6 +89,10 @@
  * @return {string}
  */
 function findEnclosingTemplateName(env, tplInfo) {
+       var typeOf = tplInfo.first.getAttribute('typeof');
+       if (!/(?:^|\s)mw:Transclusion(?=$|\s)/.test(typeOf)) {
+               return undefined;
+       }
        var dmw = DU.getDataMw(tplInfo.first);
        if (dmw.parts && dmw.parts.length === 1) {
                var p0 = dmw.parts[0];
diff --git a/tests/mocha/linter.js b/tests/mocha/linter.js
index f1ad362..ec1f91b 100644
--- a/tests/mocha/linter.js
+++ b/tests/mocha/linter.js
@@ -171,6 +171,14 @@
                                result[1].params.should.have.a.property("name", 
"tt");
                        });
                });
+               it('should not have template info for extension tags', 
function() {
+                       return 
parseWT('<gallery>\nFile:Test.jpg|<tt>foo</tt>\n</gallery>')
+                       .then(function(result) {
+                               result.should.have.length(1);
+                               result[0].should.have.a.property('type', 
'obsolete-tag');
+                               
result[0].should.not.have.a.property('templateInfo');
+                       });
+               });
        });
 
        describe('FOSTERED CONTENT', function() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie21c79e0193feef43a3a657a62dc53a4366191d9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <abrea...@wikimedia.org>

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

Reply via email to