[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: Fix a bug linting content from templated extension tags with...

2018-01-22 Thread jenkins-bot (Code Review)
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 x b 
{{1x|x}} c {{1x|y}} 
{{1x|}}').then(function(result) {
+   return parseWT('a x b 
{{1x|x}} {{1x|c y}} 
{{1x|}}').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 
Gerrit-Reviewer: C. Scott Ananian 
Gerrit-Reviewer: Sbailey 
Gerrit-Reviewer: Subramanya Sastry 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: Fix a bug linting content from templated extension tags with...

2018-01-22 Thread Arlolra (Code Review)
Arlolra has uploaded a new change for review. ( 
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(-)


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

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 x b 
{{1x|x}} c {{1x|y}} 
{{1x|}}').then(function(result) {
+   return parseWT('a x b 
{{1x|x}} {{1x|c y}} 
{{1x|}}').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: newchange
Gerrit-Change-Id: I3bac02671130ea0cf61b827247081954768181cc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra 

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