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

Change subject: Fix up conditions when consuming nowiki tokens in tmpl args
......................................................................


Fix up conditions when consuming nowiki tokens in tmpl args

 * Nowiki span end tokens require a proper typeof.

 * An error was being suppressed on cawiki/2011_en_els_vols_espacials

 * Uncaught errors in domHandlers should panic.

Change-Id: Icad18c7d2c22714ddbb2aef96b643bfd22c4aeb9
---
M lib/mediawiki.WikitextSerializer.js
M lib/pegTokenizer.pegjs.txt
M lib/wts.escapeWikitext.js
3 files changed, 8 insertions(+), 5 deletions(-)

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



diff --git a/lib/mediawiki.WikitextSerializer.js 
b/lib/mediawiki.WikitextSerializer.js
index 4837248..2567afc 100644
--- a/lib/mediawiki.WikitextSerializer.js
+++ b/lib/mediawiki.WikitextSerializer.js
@@ -1019,7 +1019,7 @@
                                                        nextNode = 
domHandler.handle(node, state, cb, wrapperUnmodified);
                                                }
                                        } catch(e) {
-                                               this.env.log("error", e);
+                                               this.env.log("fatal", e);
                                        }
                                        // The handler is responsible for 
serializing its children
                                } else {
diff --git a/lib/pegTokenizer.pegjs.txt b/lib/pegTokenizer.pegjs.txt
index 3fc8f32..9944db1 100644
--- a/lib/pegTokenizer.pegjs.txt
+++ b/lib/pegTokenizer.pegjs.txt
@@ -943,7 +943,7 @@
 {
     return [
         new TagTk('span', [ new KV('typeof', 'mw:Nowiki') ], { tsr: 
[peg$reportedPos, peg$reportedPos], src: input.substring(peg$reportedPos, 
peg$currPos) } )]
-            .concat(v, [new EndTagTk( 'span', [], { tsr: [peg$currPos, 
peg$currPos] }) ]);
+            .concat(v, [new EndTagTk( 'span', [ new KV('typeof', 'mw:Nowiki') 
], { tsr: [peg$currPos, peg$currPos] }) ]);
 }
 
 
diff --git a/lib/wts.escapeWikitext.js b/lib/wts.escapeWikitext.js
index b94b1cf..dd562d0 100644
--- a/lib/wts.escapeWikitext.js
+++ b/lib/wts.escapeWikitext.js
@@ -686,9 +686,10 @@
        }
 
        var tokens = tokenizeStr(state, arg, false);
-       var buf = '';
+       var t, da, buf = '';
        for (var i = 0, n = tokens.length; i < n; i++) {
-               var t = tokens[i], da = t.dataAttribs;
+               t = tokens[i];
+               da = t.dataAttribs;
 
                // For mw:Entity spans, the opening and closing tags have 0 
width
                // and the enclosed content is the decoded entity. Hence the
@@ -704,7 +705,9 @@
                                while (i < n && (tokens[i].constructor !== 
pd.EndTagTk || tokens[i].getAttribute("typeof") !== "mw:Nowiki")) {
                                        i++;
                                }
-                               buf += arg.substring(da.tsr[0], 
tokens[i].dataAttribs.tsr[1]);
+                               if (i < n) {
+                                       buf += arg.substring(da.tsr[0], 
tokens[i].dataAttribs.tsr[1]);
+                               }
                                continue;
                        }
                }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Icad18c7d2c22714ddbb2aef96b643bfd22c4aeb9
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: GWicke <gwi...@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