Subramanya Sastry has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/236548

Change subject: Followup on 10c63bbb: Handle [[[Foo]]] and [[[[Foo]]]] properly
......................................................................

Followup on 10c63bbb: Handle [[[Foo]]] and [[[[Foo]]]] properly

* The old fix was broken. It only dealt with [[[Foo]]] in sol posn.
* I've added FIXME with edge cases -- unsure that they are not
  worthy of attention right away.
* Updated test that passes with this patch but fails without.

Change-Id: I44e05059d807a685095fa0f607b7c9beda83fc1e
---
M lib/pegTokenizer.pegjs.txt
M tests/parserTests.txt
2 files changed, 9 insertions(+), 4 deletions(-)


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

diff --git a/lib/pegTokenizer.pegjs.txt b/lib/pegTokenizer.pegjs.txt
index 767956e..773fef0 100644
--- a/lib/pegTokenizer.pegjs.txt
+++ b/lib/pegTokenizer.pegjs.txt
@@ -288,10 +288,13 @@
           ) { return r; }
     / & '{' r:tplarg_or_template_or_broken { return r; }
     / & '}' r:broken_template { return r; }
-     // Eat three opening brackets as text, but handle '[[[[' differently
-     // so, that '[[[[Foo]]]]' parses as '[[<a..>Foo</a>]]'
-    / (!'[' / sol) '[[[' !'[' { return '[[['; }
-    / & '[' r:( wikilink / extlink ) { return r; }
+    / & '[' r:( wikilink / extlink ) {  return r; }
+     // Eat three opening brackets as text,
+     // but handle [[[[ differently. [[[[Foo]]]] parses as '[[<a..>Foo</a>]]'
+     // FIXME: 5 and higher # of brackets parse differently here and in PHP 
parser
+     // Those are edge cases and I won't bother
+    / '[[' & wikilink { return '[['; }
+    / '[[[' { return '[[['; }
     / & "'" r:quote { return r; }
 
 /* Headings  */
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index fdd2579..0e0af30 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -7161,8 +7161,10 @@
 Link with 3 brackets
 !! wikitext
 [[[Main Page]]]
+Foo [[[Main Page]]]
 !! html
 <p>[[[Main Page]]]
+Foo [[[Main Page]]]
 </p>
 !! end
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I44e05059d807a685095fa0f607b7c9beda83fc1e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to