jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/405820 )
Change subject: Fix a bug linting content from templated extension tags with
lint handlers
......................................................................
Fix a bug linting content from templated extension tags with lint handlers
The lint handler was only called if the extension tag was the first node
of the template.
Change-Id: I3bac02671130ea0cf61b827247081954768181cc
---
M lib/wt2html/pp/processors/linter.js
M tests/mocha/linter.js
2 files changed, 3 insertions(+), 4 deletions(-)
Approvals:
Subramanya Sastry: Looks good to me, approved
jenkins-bot: Verified
diff --git a/lib/wt2html/pp/processors/linter.js
b/lib/wt2html/pp/processors/linter.js
index 8339b4c..7d093e4 100644
--- a/lib/wt2html/pp/processors/linter.js
+++ b/lib/wt2html/pp/processors/linter.js
@@ -878,12 +878,11 @@
continue;
}
- var nodeTypeOf = null;
+ var nodeTypeOf = node.getAttribute('typeof');
// !tplInfo check is to protect against templated content in
// extensions which might in turn be nested in templated
content.
if (!tplInfo && DU.isFirstEncapsulationWrapperNode(node)) {
- nodeTypeOf = node.getAttribute('typeof');
tplInfo = {
first: node,
last:
JSUtils.lastItem(DU.getAboutSiblings(node, node.getAttribute("about"))),
diff --git a/tests/mocha/linter.js b/tests/mocha/linter.js
index 8889a11..5b3b82f 100644
--- a/tests/mocha/linter.js
+++ b/tests/mocha/linter.js
@@ -910,7 +910,7 @@
});
});
it('should attribute linter issues to the ref tag even when ref
and references are both templated', function() {
- return parseWT('a <ref><b>x</ref> b
<ref>{{1x|<b>x}}</ref> c {{1x|<ref><b>y</ref>}}
{{1x|<references/>}}').then(function(result) {
+ return parseWT('a <ref><b>x</ref> b
<ref>{{1x|<b>x}}</ref> {{1x|c <ref><b>y</ref>}}
{{1x|<references/>}}').then(function(result) {
result.should.have.length(3);
result[0].should.have.a.property("type",
"missing-end-tag");
result[0].dsr.should.deep.equal([ 7, 11, 3, 0
]);
@@ -923,7 +923,7 @@
result[1].should.have.a.property("templateInfo");
result[1].templateInfo.should.have.a.property("name", "Template:1x");
result[2].should.have.a.property("type",
"missing-end-tag");
- result[2].dsr.should.deep.equal([ 45, 67, null,
null]);
+ result[2].dsr.should.deep.equal([ 43, 67, null,
null]);
result[2].should.have.a.property("params");
result[2].params.should.have.a.property("name",
"b");
result[2].should.have.a.property("templateInfo");
--
To view, visit https://gerrit.wikimedia.org/r/405820
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3bac02671130ea0cf61b827247081954768181cc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
Gerrit-Reviewer: C. Scott Ananian <[email protected]>
Gerrit-Reviewer: Sbailey <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits