C. Scott Ananian has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354235 )

Change subject: Allow \r\n in wikilink titles.
......................................................................

Allow \r\n in wikilink titles.

This fixes an RT testing regression on
[[it:Teenage Mutant Ninja Turtles - Tartarughe Ninja]]
caused by this fragment of (bogus) wikitext:

  |autori = [[  Ciro Nieli
  Joshua Sternin
  J. R. Ventimilia]]

In general our practice now is *not* to try to validate the title inside
the tokenizer, but instead to accept the same set of characters here that
the PHP preprocessor does and wait until later title validation to
unlink bogus titles.

Change-Id: I0ed15d6e897d2734ad8436c73de2fdcc4d0f563a
---
M lib/wt2html/pegTokenizer.pegjs
M tests/parserTests.txt
2 files changed, 16 insertions(+), 1 deletion(-)


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

diff --git a/lib/wt2html/pegTokenizer.pegjs b/lib/wt2html/pegTokenizer.pegjs
index 2664c17..72b2d42 100644
--- a/lib/wt2html/pegTokenizer.pegjs
+++ b/lib/wt2html/pegTokenizer.pegjs
@@ -1950,7 +1950,7 @@
 wikilink_preprocessor_text
   = r:( t:$[^<[{\n\r\t|!\]}{ &\-]+
         // XXX gwicke: any more chars we need to allow here?
-        / !inline_breaks wr:( directive / $( !"]]" ( text_char / [!<\-\}\]] ) 
) )
+        / !inline_breaks wr:( directive / $( !"]]" ( text_char / 
[!<\-\}\]\n\r] ) ) )
         { return wr; }
     )+ {
       return tu.flattenStringlist(r);
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 2d107e7..0d93294 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -5332,6 +5332,21 @@
 !! end
 
 !! test
+Wikilinks with embedded newlines are not broken
+!! wikitext
+{{echo|[[ Foo
+B
+C]]}}
+!! html/php
+<p>[[ Foo
+B
+C]]
+</p>
+!! html/parsoid
+<p typeof="mw:Transclusion" 
data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[
 Foo\nB\nC]]"}},"i":0}}]}'>[[ Foo B C]]</p>
+!! end
+
+!! test
 Broken templates
 !! options
 parsoid=wt2html

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ed15d6e897d2734ad8436c73de2fdcc4d0f563a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: C. Scott Ananian <canan...@wikimedia.org>

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

Reply via email to