jenkins-bot has submitted this change and it was merged.

Change subject: T141905: Fix crasher and other bugs of that category
......................................................................


T141905: Fix crasher and other bugs of that category

 * Only transclusions have parts.

 * Should we even be marking up mw:Params?

 * From 
/ar.wikipedia.org/v3/page/html/%D9%86%D9%82%D8%A7%D8%B4_%D8%A7%D9%84%D9%85%D8%B3%D8%AA%D8%AE%D8%AF%D9%85:TheEgyptian/17688207

Change-Id: I7e18f52b67f51bcb1ecd2c04257dbcc5ac5ba755
---
M lib/wt2html/pp/handlers/handleLinkNeighbours.js
M lib/wt2html/pp/handlers/tableFixups.js
2 files changed, 7 insertions(+), 5 deletions(-)

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



diff --git a/lib/wt2html/pp/handlers/handleLinkNeighbours.js 
b/lib/wt2html/pp/handlers/handleLinkNeighbours.js
index c7a98dc..ae8087c 100644
--- a/lib/wt2html/pp/handlers/handleLinkNeighbours.js
+++ b/lib/wt2html/pp/handlers/handleLinkNeighbours.js
@@ -117,7 +117,6 @@
  */
 var linkTypes = new Set([ 'mw:ExtLink', 'mw:WikiLink' ]);
 function handleLinkNeighbours(node, env) {
-
        var rel = node.getAttribute('rel');
        if (!linkTypes.has(rel)) {
                return true;
@@ -138,7 +137,7 @@
                }
                if (prefix.src.length > 0) {
                        dp.prefix = prefix.src;
-                       if (DU.isFirstEncapsulationWrapperNode(node)) {
+                       if 
(/(?:^|\s)mw:Transclusion(?:\s|$)/.test(node.getAttribute('typeof'))) {
                                // only necessary if we're the first
                                dataMW = DU.getDataMw(node);
                                dataMW.parts.unshift(prefix.src);
@@ -164,7 +163,8 @@
                                // only if we're the last. otherwise can assume
                                // template encapsulation will handle it
                                var wrapper = 
DU.findFirstEncapsulationWrapperNode(node);
-                               if (wrapper !== null) {
+                               if (wrapper !== null &&
+                                               
/(?:^|\s)mw:Transclusion(?:\s|$)/.test(wrapper.getAttribute('typeof'))) {
                                        dataMW = DU.getDataMw(wrapper);
                                        dataMW.parts.push(trail.src);
                                }
diff --git a/lib/wt2html/pp/handlers/tableFixups.js 
b/lib/wt2html/pp/handlers/tableFixups.js
index 101f936..17fb389 100644
--- a/lib/wt2html/pp/handlers/tableFixups.js
+++ b/lib/wt2html/pp/handlers/tableFixups.js
@@ -52,7 +52,7 @@
                !DU.isLiteralHTMLNode(nextNode) &&
                DU.nodeEssentiallyEmpty(node) &&
                (// FIXME: will not be set for nested templates
-               DU.isFirstEncapsulationWrapperNode(nextNode) ||
+               
/(?:^|\s)mw:Transclusion(?:\s|$)/.test(nextNode.getAttribute('typeof')) ||
                // Hacky work-around for nested templates
                /^{{.*?}}$/.test(DU.getDataParsoid(nextNode).src))
        ) {
@@ -375,7 +375,9 @@
 
        if (!hasAttrs) {
                about = node.getAttribute("about");
-               var templateWrapper = about && Util.isParsoidObjectId(about) ? 
node : null;
+               var typeOf = node.getAttribute('typeof');
+               var templateWrapper = 
/(?:^|\s)mw:Transclusion(?:\s|$)/.test(typeOf) ?
+                               node : null;
                this.reparseTemplatedAttributes(env, node, templateWrapper);
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7e18f52b67f51bcb1ecd2c04257dbcc5ac5ba755
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: C. Scott Ananian <canan...@wikimedia.org>
Gerrit-Reviewer: Subramanya Sastry <ssas...@wikimedia.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