X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fparser%2FparserTests.txt;h=aa03c0ed9dd7ce42c97c9c4c53092c9196fae723;hb=236488d398046838059f758b0915341648b64c7b;hp=56879ffc74a241a90aae9a3c39be42bc174cc827;hpb=76d072e4813b8d28630d7a3768bccc37bf54f7f5;p=lhc%2Fweb%2Fwiklou.git
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index 56879ffc74..aa03c0ed9d 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -546,15 +546,19 @@ Extra newlines between heading and content are swallowed
Heading with line break in nowiki
!! options
parsoid=wt2html
+!! config
+wgFragmentMode=[ 'html5', 'legacy' ]
!! wikitext
== A
Foo!! | |
Foo!! |
[ftp://%7Cx | ]" onmouseover="alert(document.cookie)">test |
style="color: red !important;" data-contrived="put this here | foo |
style="color: red !important;" data-contrived="put this here | foo |
#Is this great? +Foo#Is this great? +meatball:Foo#Is this great? +
+!! html/parsoid +#Is this great? +Foo#Is this great? +meatball:Foo#Is this great?
+!! end + +!! test +Link scenarios with escaped fragments (legacy) +!! config +wgFragmentMode=[ 'legacy' ] !! wikitext [[#Is this great?]] [[Foo#Is this great?]] @@ -8683,10 +8737,6 @@ Link scenarios with escaped fragments Foo#Is this great? meatball:Foo#Is this great? -!! html/parsoid -#Is this great? -Foo#Is this great? -meatball:Foo#Is this great?
!! end # Ideally the wikipedia: prefix here should be proto-relative too @@ -8711,19 +8761,19 @@ Different interwiki prefixes mapping to the same URL [[ wikiPEdia :Foo]] !! html/parsoid - + - + - + - + - + - + - + !! end !! test @@ -8743,9 +8793,9 @@ Interwiki links that cannot be represented in wiki syntax is just fragment !! html/parsoid -meatball:ok -ok with fragment -ok ending with ? mark +
meatball:ok +ok with fragment +ok ending with ? mark has query is just fragment
!! end @@ -8758,7 +8808,7 @@ Interwiki links: trail !! html/parsoid - + !! end !! test @@ -8812,7 +8862,7 @@ parsoid=wt2html,wt2wt,html2html !! html/parsoid - + !! end !! test @@ -8910,8 +8960,8 @@ Blah blah blah !! html/parsoidBlah blah blah -es:Spanish - zh : Chinese
+es:Spanish + zh : Chinese !! end !! test @@ -8928,7 +8978,7 @@ parsoid=wt2html [[:::es:Spanish]] !! html/parsoid -es:Spanish [[::es:Spanish]] [[:::es:Spanish]]
!! end @@ -9005,7 +9055,7 @@ parsoid=wt2html,wt2wt,html2html Blah blah blah [[zh:Chinese]] !! html/parsoid -Blah blah blah zh:Chinese
+Blah blah blah zh:Chinese
!! end ## PHP parser tests script needs an update @@ -9019,7 +9069,7 @@ parsoid=wt2html,wt2wt,html2html Blah blah blah [[zh:Chinese]] !! html/parsoid -Blah blah blah zh:Chinese
+Blah blah blah zh:Chinese
!! end !! test @@ -9106,7 +9156,7 @@ parsoid=wt2html,wt2wt,html2html !! html/parsoid - + !! end @@ -9134,7 +9184,7 @@ Blah blah blah !! html/parsoidBlah blah blah -local:es:Spanish
+local:es:Spanish !! end !! test @@ -9177,10 +9227,12 @@ Blah blah blah # This tests the Parsoid bail-out code. !! test 3. Other redirect variants +!! options +parsoid=wt2html !! wikitext #REDIRECT [[testing two | three | four | -three | four | -testing="two" | three | four |
testing two | three | four | +three | four | +testing="two" | three | four |
some
1
-2
-3
-4
-5
-6
!! html/parsoid - -1
-2
-3
-4
-5
-6
!! end @@ -12580,6 +12633,19 @@ parsoid=wt2html!! end +!! test +Preprocessor precedence 17: template w/o target shouldn't prevent closing +!! options +parsoid=wt2html +!! wikitext +{{echo|hi {{}}}} +!! html/php +
hi {{}} +
+!! html/parsoid +hi {{}}
+!! end + ### ### Token Stream Patcher tests ### @@ -14264,15 +14330,15 @@ parsoid=wt2html,wt2wt,html2html !! html/parsoid - + !! end !! test -Serialize simple image with figure-inline wrapper +Serialize simple image with span wrapper !! options parsoid=html2wt !! html/parsoid - + !! wikitext [[File:Foobar.jpg]] !! end @@ -14285,7 +14351,7 @@ Simple image (using File: namespace, now canonical) !! html/parsoid - + !! end !! test @@ -14402,7 +14468,7 @@ Linktrails should not work for images: [[File:Foobar.jpg]]sLinktrails should not work for images: s
!! html/parsoid -Linktrails should not work for images: s
+Linktrails should not work for images:
456
!! html/parsoid - +123
456
123
456
!! end @@ -14516,7 +14582,7 @@ Image with multiple widths -- use last !! html/parsoid - + !! end !! test @@ -14533,7 +14599,7 @@ thumbsize=220 !! html/parsoid - + !! end !! test @@ -14566,7 +14632,7 @@ parsoid=wt2html,wt2wt,html2html !! html/parsoid - + !! end !! test @@ -14577,7 +14643,7 @@ Image with link parameter, wiki target !! html/parsoid - + !! end # parsoid T51293 (part 1) @@ -14589,7 +14655,7 @@ Image with link parameter, URL target !! html/parsoid - + !! end # parsoid T51293 (part 2) @@ -14601,7 +14667,7 @@ Image with link parameter, protocol-less URL target !! html/parsoid - + !! end !! test @@ -14673,7 +14739,7 @@ Image with empty link parameter!! html/parsoid -
+
a | b |
c |
The line above must have a trailing space!
But just in case it doesn't...
+!! html/parsoid +The line above must have a trailing space!
+But just in case it doesn't...
!! end !! test @@ -16866,10 +16991,10 @@ section 4 == text " text == section 5 -!! html +!! html/phpThe tooltips shall not show entities to the user (ie. be double escaped)
-section 5
+!! html/parsoid +The tooltips shall not show entities to the user (ie. be double escaped)
+ +section 1
+ +section 2
+ +section 3
+ +section 4
+ +section 5
!! end !! test @@ -16925,10 +17067,10 @@ section 6 [[#Plus-Entity+between+Text]] [[#Underscore_between_Text]] [[#Underscore-Entity_between_Text]] -!! html +!! html/phpId should not contain + for spaces
-Id should not contain + for spaces
+ +section 1
+ +section 2
+ +section 3
+ +section 4
+ +section 5
+ +section 6
+ +#Space between Text +#Space-Entity between Text +#Plus+between+Text +#Plus-Entity+between+Text +#Underscore_between_Text +#Underscore-Entity_between_Text
!! end +# Parsoid html2wt disabled because it adds padding spaces around = !! test Headers with excess '=' characters (Are similar tests necessary beyond the 1st level?) +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext =foo== ==foo= =''italic'' heading== ==''italic'' heading= -!! html -bytebacklink +
bytebacklink
!! html/parsoid -bytebacklink
+bytebacklink
+!! end + +!! test +Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy) +!! config +wgFragmentMode=[ 'legacy' ] +!! wikitext +byte[[#æ: v|backlink]] +!! html/php +bytebacklink +
!! end # In HTML5, the restrictions are that id must contain at least one character, @@ -18480,6 +18692,37 @@ parsoid=wt2html,wt2wt2013
!! end +!! test +Sanitizer: Avoid unnecessary percent encoded characters in interwiki links +!! wikitext +[[meatball:Soft"Security]] +!! html/php + +!! html/parsoid + +!! end + +!! test +Sanitizer: angle brackets are invalid, even in interwiki links (T182338) +!! wikitext +[[meatball:Foo[[meatball:Foo<Bar]] +[[meatball:Foo>Bar]] +[[meatball:Foo<bar]] +[[meatball:Foo>bar]] +
+!! html/parsoid +[[meatball:Foo<Bar]] +[[meatball:Foo>Bar]] +[[meatball:Foo<bar]] +[[meatball:Foo>bar]]
+!! end + !! test Language converter: output gets cut off unexpectedly (T7757) !! options @@ -18513,10 +18756,14 @@ language=sr variant=sr-el -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}- [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]] -!! html +!! html/php+!! html/parsoid + + + !! end !! test @@ -18837,25 +19084,28 @@ Fuzz testing: Parser13 !! end +# Note that Parsoid output differs from the PHP parser here: the PHP +# parser breaks the URL for the magic word, while in Parsoid the URL +# production takes precedence. !! test Fuzz testing: Parser14 !! wikitext == onmouseover= == http://__TOC__ -!! html +!! html/php
http://
foo_bar©#%n +
+!! html/parsoid +foo_bar©#%n
+!! end + +!! test +anchorencode (legacy) +!! config +wgFragmentMode=[ 'legacy' ] +!! wikitext +{{anchorencode:foo bar©#%n}} +!! html/phpfoo_bar.C2.A9.23.25n
!! end !! test anchorencode trims spaces +!! config +wgFragmentMode=[ 'html5', 'legacy' ] !! wikitext {{anchorencode: __pretty__please__}} -!! html +!! html/phppretty_please
+!! html/parsoid +pretty_please
!! end !! test anchorencode deals with links +!! config +wgFragmentMode=[ 'html5', 'legacy' ] !! wikitext {{anchorencode: [[hello|world]] [[hi]]}} -!! html +!! html/phpworld_hi
+!! html/parsoid +world_hi
!! end !! test anchorencode deals with templates +!! config +wgFragmentMode=[ 'html5', 'legacy' ] !! wikitext -{{anchorencode: {{Foo}} }} -!! html -FOO +{{anchorencode: {{Foo}} x}} +!! html/php +
FOO_x
+!! html/parsoid +FOO_x
!! end !! test anchorencode encodes like the TOC generator: (T20431) +!! config +wgFragmentMode=[ 'html5', 'legacy' ] +!! wikitext +=== _ +:.3A%3A _ &&]] x === +{{anchorencode: _ +:.3A%3A _ &&]] x}} +__NOEDITSECTION__ +!! html/php ++:.3A%3A_&&]]_x +
+!! html/parsoid ++:.3A%3A_&&]]_x
+ +!! end + +!! test +anchorencode encodes like the TOC generator: (T20431) (legacy) +!! config +wgFragmentMode=[ 'legacy' ] !! wikitext === _ +:.3A%3A&&]] === {{anchorencode: _ +:.3A%3A&&]] }} __NOEDITSECTION__ -!! html +!! html/php.2B:.3A.253A.26.26.5D.5D
@@ -21754,6 +22084,8 @@ language=sr variant=sr-ec !! test -{}- tags within headlines (within html for parserConvert()) +!! config +wgFragmentMode=[ 'html5', 'legacy' ] !! options language=sr variant=sr-ec !! wikitext @@ -21764,14 +22096,14 @@ conversion: == Latinski == !! html/php -ÐоÑе ÑÑ Ð°Ñ ÐµÐ²ÐµÐ½ ан ÑнпÑоÑеÑÑед Ñ ÐµÐ°Ð´Ð»Ð¸Ð½Ðµ ÐÐ Ð¸Ñ Ð½Ð¾Ñ Ð°ÑÑеÑÑед бy лангÑаге ÑонвеÑÑион:
Note that even an unprotected headline ID is not affected by language conversion:
@@ -22285,7 +22617,7 @@ Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:TaiwNested: Hello Hong Kong!
!! html/parsoid -Nested: !
+Nested: !
!! end !! test @@ -22298,7 +22630,7 @@ language=zh variant=zh-cnA
!! html/parsoid -+
!! end !! test @@ -22311,7 +22643,7 @@ language=zh variant=zh-cn
A
!! html/parsoid -+
!! end # Parsoid and PHP disagree on how to parse this example: Parsoid @@ -22584,15 +22916,9 @@ File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
User:+% Page+title%
%+ %20 %+ %+r
-% +
+% +
Quote== !! html/php -
[edit]
!! html/parsoid -Quote
Quote
Hanc marginis exiguitas non caperet. QED
!! html/parsoid -Hanc marginis exiguitas non caperet. QED
!! end @@ -24056,7 +24384,7 @@ __TOC__ == FooBar== !! html/php -
[edit]
!! html/parsoid -Bar
Bar
tag in TOC, removed by Sanitizer (T92892) __TOC__ == x == !! html/php -
xy
+!! html/parsoid +xy
!! end !! test @@ -24811,23 +25142,66 @@ Headings: 4b. No escaping needed (inside p-tags) !! options parsoid=html2wt !! html/parsoid -=== -=foo= x +
=foo= x
=foo=
=foo= x
+=foo=
+
=== +
+!! wikitext +=== +
+!! end + +# in the html2wt direction we emit '= = =' or '== +== +
+= +==
++
x
-a b - | c | c |
---|---|
x - | y | y |
hiho
!! end +!! test +Catch regression when unpacking with trailing content +!! wikitext +{{echo|FooFoo
bar
+!! end + !! test Use data-parsoid.firstWikitextNode to compute newline constraints for template content !! options @@ -29495,6 +29877,24 @@ wgRawHtml=1 !! test Decoding of HTML entities in headings and links for IDs and link fragments (T103714) +!! config +wgFragmentMode=[ 'html5', 'legacy' ] +!! wikitext +== A&B&C&D&amp;E == +[[#A&B&C&D&amp;E]] +!! html/php +x |
x |
x |
!! end +# this version of the test strips out the ambiguity so Parsoid rts cleanly +!! test +Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196) +!! options +showindicators +!! wikitext +
+!! end + +# This fragment mode is what Parsoid supports. !! test HTML5 ids: fallback to legacy !! config @@ -29539,7 +29968,7 @@ wgFragmentMode=[ 'html5', 'legacy' ] [[#å¤é ]] [[#%E5%95%A4%E9%85%92]] !! html/php -
ð©
+!! html/parsoid +#Foo bar #foo Bar #ТеÑÑ #ÑеÑÑ #Hey < # " > % : '
+ +ð©
+ + + !! end +# Parsoid doesn't support this mode !! test HTML5 ids: legacy with a fallback to modern !! config @@ -29586,7 +30034,7 @@ wgFragmentMode=[ 'legacy', 'html5' ] [[#å¤é ]] [[#%E5%95%A4%E9%85%92]] !! html/php -#[foo] +
+!! html/parsoid + +!! end + +## ------------------------------ +## Parsoid section-wrapping tests +## ------------------------------ +!! test +Section wrapping for well-nested sections (no leading content) +!! options +parsoid={ + "wrapSections": true +} +!! wikitext += 1 = +a + += 2 = +b + +== 2.1 == +c + +== 2.2 == +d + +=== 2.2.1 === +e + += 3 = +f +!! html/parsoid +a
+ +b
+ +c
+ +d
+ +e
+ +f
+ +Para 1.
+ +Para 2 with a
Para 3.
+ +a
+ +b
+ +c
+ +a
+ +b
+c
+ +d
a
+ +b
+d
+e
a
+ +x
+b
+c
+d
+e
a
+ + +b +
+ +c
+a
+ +b
+c
+ +d
+ +e
a
+ +b
+c
+ +d
+e
foo
+ +a
+ +b
+ +c
+d
+ +e
+foo
+ +a
+b
+ +c
+ +d
+e
+ +f
+ +g
+foo
+ +a
+ +b
foo
+