jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/394608 )
Change subject: Fix crasher with lonely `=` and `==`
......................................................................
Fix crasher with lonely `=` and `==`
This was a regression introduced in c167933204016ff1a2830623234423ad553e98c6
caused by a think-o about how our stops inc/dec logic works in pegjs.
Added test case to be extra safe for the future.
Change-Id: I4d6ba0f72fc9345915a7447132020d56b92ac9b6
---
M lib/wt2html/pegTokenizer.pegjs
M tests/parserTests.txt
2 files changed, 10 insertions(+), 2 deletions(-)
Approvals:
jenkins-bot: Verified
Arlolra: Looks good to me, approved
diff --git a/lib/wt2html/pegTokenizer.pegjs b/lib/wt2html/pegTokenizer.pegjs
index 3f3edd6..e1bd3f9 100644
--- a/lib/wt2html/pegTokenizer.pegjs
+++ b/lib/wt2html/pegTokenizer.pegjs
@@ -487,20 +487,21 @@
heading = & "=" // guard, to make sure '='+ will match.
// XXX: Also check to end to avoid inline parsing?
r:(
- s:$'='+ // moved in here to make s accessible to inner action
& { return stops.inc('h'); }
+ s:$'='+ // moved in here to make s accessible to inner action
ce:(
nested_block_line
$'='+
)?
+ & { return ce || s.length > 2; }
endTPos:("" { return endOffset(); })
spc:(spaces / comment)*
- & { stops.dec('h'); return ce || s.length > 2; }
&eolf
{
var c;
var e;
var level;
+ stops.dec('h');
if (ce) {
c = ce[0];
e = ce[1];
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index a72a32f..c208a00 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -25128,15 +25128,22 @@
!! options
parsoid=wt2html,html2html
!! wikitext
+=
+==
===
====
=====
!! html/php
+<p>=
+==
+</p>
<h1><span class="mw-headline" id=".3D">=</span><span
class="mw-editsection"><span class="mw-editsection-bracket">[</span><a
href="/index.php?title=Parser_test&action=edit&section=1" title="Edit
section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
<h1><span class="mw-headline" id=".3D.3D">==</span><span
class="mw-editsection"><span class="mw-editsection-bracket">[</span><a
href="/index.php?title=Parser_test&action=edit&section=2" title="Edit
section: ==">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
<h2><span class="mw-headline" id=".3D_2">=</span><span
class="mw-editsection"><span class="mw-editsection-bracket">[</span><a
href="/index.php?title=Parser_test&action=edit&section=3" title="Edit
section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
!! html/parsoid
+<p>=
+==</p>
<h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
<h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
<h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
--
To view, visit https://gerrit.wikimedia.org/r/394608
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4d6ba0f72fc9345915a7447132020d56b92ac9b6
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: C. Scott Ananian <[email protected]>
Gerrit-Reviewer: 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