X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fparser%2FparserTests.txt;h=7af3a3655be3c79f06eca1c49946047efc06b288;hb=c8e482371407477ecd4f0a1b5778e565d3963a93;hp=3c861ea10b33494b8bed013a650c70ca904eb6cd;hpb=f58546ef6e55342ff2d54bdf9e421102aed7aa76;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 3c861ea10b..7af3a3655b 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -1912,6 +1912,33 @@ a
b
!! end +!! test +No p-wrappable content +!! wikitext +x
+!! end + !! test Block tag on one line () !! wikitext @@ -4806,8 +4833,11 @@ foo//example.com/Foo !! end +## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia: !! test External links: with no contents +!! options +parsoid=wt2html,wt2wt !! wikitext [http://en.wikipedia.org/wiki/Foo] @@ -4911,7 +4941,7 @@ External links: Free with trailing quotes (T113666) news:'a'b''c''d e !! html/phpNews: Stuff here -
news:'a'bcd e +
news:'a'bcd e
!! html/parsoidNews: Stuff here
@@ -5557,8 +5587,8 @@ External link containing a single quote. (T65947) [//foo.org/bar'baz bang] !! html/php -[1] -
bang +
[1] +
!! html/parsoid @@ -5676,7 +5706,7 @@ Examples from RFC 2732, section 2: !! html/phphttp://[2404:130:0:1000::187:2]/index.php -
Examples from RFC 2373, section 2.2: +
Examples from RFC 2373, section 2.2:
-
- http://[1080::8:800:200C:417A]/unicast
- http://[FF01::101]/multicast
@@ -5684,7 +5714,7 @@ Examples from RFC 2732, section 2:- http://[::]/unspecified
- http://[::13.1.68.3]/ipv4compat
- http://[::FFFF:129.144.52.38]/ipv4compat
Examples from RFC 2732, section 2: +
Examples from RFC 2732, section 2:
- http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
- http://[1080:0:0:0:8:800:200C:417A]/index.html
@@ -5697,7 +5727,7 @@ Examples from RFC 2732, section 2: !! html/parsoidhttp://[2404:130:0:1000::187:2]/index.php
-Examples from RFC 2373, section 2.2:
+Examples from RFC 2373, section 2.2:
-
- http://[1080::8:800:200C:417A]/unicast
- http://[FF01::101]/multicast
- http://[::1]/loopback
@@ -5705,7 +5735,7 @@ Examples from RFC 2732, section 2:- http://[::13.1.68.3]/ipv4compat
- http://[::FFFF:129.144.52.38]/ipv4compat
Examples from RFC 2732, section 2:
+Examples from RFC 2732, section 2:
@@ -29530,9 +29689,458 @@ wgFragmentMode=[ 'html5' ]
- http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
- http://[1080:0:0:0:8:800:200C:417A]/index.html
- http://[3ffe:2a00:100:7031::1]
@@ -5739,7 +5769,7 @@ Examples from RFC 2732, section 2: !! html/phptest -
Examples from RFC 2373, section 2.2: +
Examples from RFC 2373, section 2.2:
-
- unicast
- multicast
@@ -5747,7 +5777,7 @@ Examples from RFC 2732, section 2:- unspecified
- ipv4compat
- ipv4compat
Examples from RFC 2732, section 2: +
Examples from RFC 2732, section 2:
@@ -29436,8 +29595,8 @@ wgFragmentMode=[ 'html5', 'legacy' ]
- 1
- 2
@@ -5760,7 +5790,7 @@ Examples from RFC 2732, section 2: !! html/parsoid -Examples from RFC 2373, section 2.2:
+Examples from RFC 2373, section 2.2:
-
- unicast
- multicast
- loopback
@@ -5768,7 +5798,7 @@ Examples from RFC 2732, section 2:- ipv4compat
- ipv4compat
Examples from RFC 2732, section 2:
+Examples from RFC 2732, section 2:
+!! html/parsoid + !! end !! test @@ -9411,7 +9474,7 @@ Handling html with a div self-closing tag !! html/parsoid - + @@ -10935,10 +10998,10 @@ Magic links: RFC (T2479) !! wikitext RFC 822 !! html/php -
- 1
- 2
- 3
@@ -5935,11 +5965,11 @@ parsoid=html2wt !! wikitext [[Foo|Bar]] [[Foo|Bar]] -[[wikipedia:Foo|Bar]] -[[wikipedia:Foo|Bar]] +[[:en:Foo|Bar]] +[[:en:Foo|Bar]] -[[wikipedia:European_Robin|European Robin]] -[[wikipedia:European_Robin|European Robin]] +[[:en:European_Robin|European Robin]] +[[:en:European_Robin|European Robin]] !! end !! test @@ -6320,7 +6350,7 @@ Accept "!!" in table data !! html/parsoid-
!! end @@ -6596,7 +6626,7 @@ parsoid=wt2html,html2html !! html/parsoid+ Foo!! Foo!! +
- [ftp://%7Cx ]" onmouseover="alert(document.cookie)">test [ftp://%7Cx ]" onmouseover="alert(document.cookie)">test !! end !! test @@ -6653,7 +6683,7 @@ parsoid=wt2html !! html/parsoid-
!! end @@ -7973,7 +8003,7 @@ Link containing double-single-quotes '' (T6598) !! wikitext [[Lista d''e paise d''o munno]] !! html/php - !! html/parsoid @@ -8038,9 +8068,9 @@ Link with double quotes in title part (literal) and alternate part (interpreted) [[''Pentecoste''|''Pentecoste'']] !! html/php+ style="color: red !important;" data-contrived="put this here foo style="color: red !important;" data-contrived="put this here foo File:Denys Savchenko Pentecoste.jpg -
!! html/parsoid @@ -8333,7 +8363,7 @@ language=kaa !! wikitext [[Something]]'nice !! html - !! end @@ -8517,6 +8547,31 @@ parsoid=html2wt,html2html Aðrir mótmælenda[[söfnuður]] !! end +!! test +Parsoid link bracket escaping +!! options +parsoid=html2wt,html2html +!! html/parsoid + + [Test]
+[[Test]]
+[[[Test]]]
+[[[[Test]]]]
+[[[[[Test]]]]]
+!! wikitext +[[Test]] + +[[[Test]]] + +[[[[Test]]]] + +[[[ [[Test]]]]] + +[[[[[[Test]]]]]] + +[[[[[ [[Test]]]]]]] +!! end + !! test Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved !! wikitext @@ -8584,8 +8639,11 @@ parsoid=wt2html,wt2wt,html2html !! end +## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia: !! test Interwiki link encoding conversion (T3636) +!! options +parsoid=wt2html,wt2wt !! wikitext *[[Wikipedia:ro:Olteniţa]] *[[Wikipedia:ro:Olteniţa]] @@ -8598,6 +8656,11 @@ Interwiki link encoding conversion (T3636) - Wikipedia:ro:OlteniÅ£a
- Wikipedia:ro:Olteniţa
RFC 822 +
!! html/parsoid - + !! end !! test @@ -10946,10 +11009,10 @@ Magic links: RFC (T67278) !! wikitext This is RFC 822 but thisRFC 822 is not RFC 822linked. !! html/php -This is RFC 822 but thisRFC 822 is not RFC 822linked. +
This is RFC 822 but thisRFC 822 is not RFC 822linked.
!! html/parsoid -This is RFC 822 but thisRFC 822 is not RFC 822linked.
+This is RFC 822 but thisRFC 822 is not RFC 822linked.
!! end !! test @@ -10959,12 +11022,12 @@ RFC 822 RFC 822 !! html/php -RFC 822 +
RFC 822 RFC 822
!! html/parsoid -RFC Â Â Â Â Â 822 RFC 822
!! end @@ -11060,14 +11123,14 @@ Magic links: use appropriate serialization for "almost" magic links. !! wikitext X[[Special:BookSources/0978739256|foo]] -X[//tools.ietf.org/html/rfc1234 foo] +X[https://tools.ietf.org/html/rfc1234 foo] !! html/phpXfoo -
Xfoo +
Xfoo
!! html/parsoidXfoo
-Xfoo
+Xfoo
!! end !! test @@ -11324,6 +11387,15 @@ Templates with templated name!! end +## Regression test; the output here isn't really that interesting. +!! test +Templates with templated name and top level template args +!! wikitext +{{1{{2{{{3}}}|4=5}}}} +!! html/parsoid +
- item 1
{{1{{2{{{3}}}|4=5}}}}
+!! end + # Parsoid markup is deliberate "broken". This is an edge case. # See long comment in TemplateHandler.js:convertAttribsToString. !! test @@ -11420,9 +11492,9 @@ Abort table cell attribute parsing on wikilink !! html/parsoid-
!! end @@ -14759,7 +14831,65 @@ Alt image option should handle most kinds of wikitext without barfing !! html/parsoid - + +!! end + +!! test +Image with table with attributes in caption +!! options +parsoid=wt2html,html2html +!! wikitext +[[File:Foobar.jpg|thumb| +{| class="123" | +|- class="456" | +| ha +|} +]] +!! html/parsoid + +!! end + +!! test +Image with table with rows from templates in caption +!! wikitext +[[File:Foobar.jpg|thumb| +{| +{{echo|{{!}} hi}} +|} +]] +!! html/parsoid + +!! end + +!! test +Image with nested tables in caption +!! wikitext +[[File:Foobar.jpg|thumb|Foo+ testing two | three four -three four -testing="two" | three four testing two | three four +three four +testing="two" | three four
+{| +| +{| +|z +|} +|} +]] +!! html/parsoid + !! end ################### @@ -15046,12 +15176,12 @@ SVG thumbnails with invalid language code !! options parsoid=wt2html,wt2wt,html2html !! wikitext -[[File:Foobar.svg|thumb|caption|lang=invalid.language.code]] +[[File:Foobar.svg|thumb|caption|lang=invalid:language:code]] !! html/php - + !! html/parsoid - + !! end !! test @@ -15070,10 +15200,10 @@ T3887: A RFC with a thumbnail !! wikitext [[File:Foobar.jpg|thumb|This is RFC 12354]] !! html/php - + !! html/parsoid - + !! end !! test @@ -15615,9 +15745,9 @@ T93580: 2. inside inline images!! html/parsoid - + - +
- â foo
!! end !! test @@ -15627,9 +15757,9 @@ T93580: 3. Templated inside inline images
- â foo
!! html/parsoid - + - +
- â foo
!! end ### @@ -15817,7 +15947,7 @@ Link to category !! wikitext [[:Category:MediaWiki User's Guide]] !! html -
- â foo
Category:MediaWiki User's Guide +
Category:MediaWiki User's Guide
!! end @@ -16794,7 +16924,7 @@ section 5text & text[edit]
section 3
-text ' text[edit]
+text ' text[edit]
section 4
text " text[edit]
@@ -17644,7 +17774,7 @@ T4304: HTML attribute safety (link) !! wikitext !! html - + !! end @@ -17707,7 +17837,7 @@ T4304: HTML attribute safety (named web link) !! wikitext !! html - + !! end @@ -18272,18 +18402,16 @@ Nested template calls ### Sanitizer ### -# HTML+Tidy effectively strips out the empty tags completely -# But since Parsoid doesn't it wraps thetags in p-tags -# which Tidy would have done for the PHP parser had there been content inside it. +# HTML+Tidy strips out empty tags completely. Parsoid doesn't. +# FIXME: Wikitext for this first test doesn't match its title. !! test Sanitizer: Closing of open tags !! wikitext-!! html -
+!! html/php+tidy !! html/parsoid -
+
!! end !! test @@ -18413,6 +18541,24 @@ all additional text is vanished
all additional text is vanished
!! end +!! test +Language converter glossary rules inside attributes (T119158) +!! options +language=sr variant=sr-el +!! wikitext +-{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}- + +[[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]] +!! html/php ++
+!! html/parsoid + + + +!! end + !! test Self closed html pairs (T7487) !! wikitext @@ -19993,7 +20139,7 @@ parsoid=wt2html ''''' !! html/php !! html/parsoid -+ !! end # same html as previous, but wikitext adjusted to match parsoid html2wt @@ -20886,7 +21032,7 @@ Double RFC !! wikitext RFC RFC 1234 !! html -
RFC RFC 1234 +
RFC RFC 1234
!! end @@ -20904,10 +21050,10 @@ RFC code coverage !! wikitext RFC 983 987 !! html -RFC 983 987 +
RFC 983 987
!! html+tidy -RFC 983 987
+RFC 983 987
!! end !! test @@ -22179,7 +22325,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 @@ -22192,7 +22338,7 @@ language=zh variant=zh-cnA
!! html/parsoid -+
!! end !! test @@ -22205,7 +22351,7 @@ language=zh variant=zh-cn
A
!! html/parsoid -+
!! end # Parsoid and PHP disagree on how to parse this example: Parsoid @@ -22298,7 +22444,7 @@ parsoid={ |} !! end -# Tests LanguageVariantText._fromSelser +# Tests LanguageVariantText._fromSelSer !! test LanguageConverter selser (4) !! options @@ -22672,6 +22818,21 @@ a:b=>c xyz !! end +!! test +T179579: Nowiki and lc interaction +!! options +parsoid=wt2html +language=sr +!! wikitext +-{123}- + +-{123
| 456}- +!! html/parsoid ++ +
+!! end + !! test T2529: Uncovered bullet !! wikitext @@ -24448,9 +24609,7 @@ parsoid=wt2html,wt2wt !! wikitext '''[[Image:Foobar.jpg|right|300px]]''' !! html/parsoid -
- - + !! end #### ---------------------------------------------------------------- @@ -25649,9 +25808,9 @@ Links 8. Add
s between text-nodes and RFC-links when required (T66300) !! options parsoid=html2wt !! html/parsoid - + !! wikitext RFC 123 4 RFC 123 y @@ -25663,18 +25822,18 @@ Links 9. Don't add spurious s between text-nodes and RFC-links (T66300) !! options parsoid=html2wt !! html/parsoid - RFC 123?foo -RFC 123&foo --RFC 123- +
RFC 123?foo +RFC 123&foo +-RFC 123-
!! wikitext RFC 123?foo RFC 123&foo -RFC 123- !! html/php -RFC 123?foo -RFC 123&foo --RFC 123- +
RFC 123?foo +RFC 123&foo +-RFC 123-
!! end @@ -27935,9 +28094,9 @@ Edited RFC links not serializable as RFC links should serialize as extlinks !! options parsoid=html2wt !! html/parsoid -New RFC +New RFC !! wikitext -[//tools.ietf.org/html/rfc123 New RFC] +[https://tools.ietf.org/html/rfc123 New RFC] !! end !! test @@ -28081,7 +28240,7 @@ Magic links inside image captions (autolinked)@@ -28100,7 +28259,7 @@ Magic links inside image captions (autolinked)!! html/parsoid - + !! end @@ -28200,17 +28359,17 @@ parsoid=html2wt+ a b - c c + x
-y y !! wikitext {| @@ -29427,7 +29586,7 @@ wgFragmentMode=[ 'html5', 'legacy' ]
+ a b - c c + x -
y y - 3 ТеÑÑ
- 4 ТеÑÑ
- 5 ÑеÑÑ
-- 6 Hey < # " > % : '
+- 6 Hey < # " > % : '
ТеÑÑ[edit]
ТеÑÑ[edit]
ÑеÑÑ[edit]
-Hey < # " > % : '[edit]
-#Foo bar #foo Bar #ТеÑÑ #ÑеÑÑ #Hey < # " > % : ' +
Hey < # " > % : '[edit]
+#Foo bar #foo Bar #ТеÑÑ #ÑеÑÑ #Hey < # " > % : '
ð©
@@ -29483,7 +29642,7 @@ wgFragmentMode=[ 'legacy', 'html5' ]ТеÑÑ[edit]
ТеÑÑ[edit]
ÑеÑÑ[edit]
-Hey < # " > % : '[edit]
+Hey < # " > % : '[edit]
#Foo bar #foo Bar #ТеÑÑ #ÑеÑÑ #Hey < # " > % : '
.F0.9F.92.A9
#å¤é #å¤é @@ -29521,7 +29680,7 @@ wgFragmentMode=[ 'html5' ]
- 3 ТеÑÑ
- 4 ТеÑÑ
- 5 ÑеÑÑ
-- 6 Hey < # " > % : '
+- 6 Hey < # " > % : '
ТеÑÑ[edit]
ТеÑÑ[edit]
ÑеÑÑ[edit]
-Hey < # " > % : '[edit]
-#Foo bar #foo Bar #ТеÑÑ #ÑеÑÑ #Hey < # " > % : ' +
Hey < # " > % : '[edit]
+#Foo bar #foo Bar #ТеÑÑ #ÑеÑÑ #Hey < # " > % : '
ð©
!! end + +!! test +T90902: Normalize weird characters in section IDs +!! config +wgFragmentMode=[ 'html5', 'legacy' ] +!! wikitext +== Foo bar == +[[#Foo bar]] + +!! html/php +Foo bar[edit]
+#Foo bar +
+!! end + +!! test +T51672: Test for brackets in attributes of elements in external link texts +!! wikitext +[http://example.com/ link span] +[http://example.com/ link span] + +!! html/php + +!! end + +!! test +T72875: Test for brackets in attributes of elements in internal link texts +!! wikitext +[[Foo|link span]] +[[Foo|link span]] + +!! html/php + +!! end + +!! test +T179544: {{anchorencode:}} output should be always usable in links +!! config +wgFragmentMode=[ 'html5' ] +!! wikitext +[[#{{anchorencode:[foo]}}]] +!! html/php +#[foo] +
+!! 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 +1
+a
+ +2
+b
+ +2.1
+c
+ +2.2
+d
+ +2.2.1
+e
+ ++!! end + +!! test +Section wrapping for well-nested sections (with leading content) +!! options +parsoid={ + "wrapSections": true +} +!! wikitext +Para 1. + +Para 2 with a 3
+f
+ +nested in it+ +Para 3. + += 1 = +a + += 2 = +b + +== 2.1 == +c +!! html/parsoid +Para 1.
+ +Para 2 with a
nested in it+ +Para 3.
+ +1
+a
+ ++!! end + +!! test +Section wrapping with template-generated sections (good nesting 1) +!! options +parsoid={ + "wrapSections": true +} +!! wikitext += 1 = +a + +{{echo|1= +== 1.1 == +b +}} + +== 1.2 == +c + += 2 = +d +!! html/parsoid + 2
+b
+ +2.1
+c
+ +1
+a
+ +1.1
+b
+1.2
+c
+ ++!! end + +# In this example, the template scope is mildly expanded to incorporate the +# trailing newline after the transclusion since that is part of section 1.1.1 +!! test +Section wrapping with template-generated sections (good nesting 2) +!! options +parsoid={ + "wrapSections": true, + "modes": ["wt2html", "wt2wt"] +} +!! wikitext += 1 = +a + +{{echo|1= +== 1.1 == +b +=== 1.1.1 === +d +}} += 2 = +e +!! html/parsoid + 2
+d
1
+a
+ +1.1
+b
+1.1.1
+d
++!! end + +# In this example, the template scope is mildly expanded to incorporate the +# trailing newline after the transclusion since that is part of section 1.2.1 +!! test +Section wrapping with template-generated sections (good nesting 3) +!! options +parsoid={ + "wrapSections": true, + "modes": ["wt2html", "wt2wt"] +} +!! wikitext += 1 = +a + +{{echo|1= +x +== 1.1 == +b +==1.2== +c +===1.2.1=== +d +}} += 2 = +e +!! html/parsoid + 2
+e
1
+a
+ +x
+1.1
+b
+1.2
+c
+1.2.1
+d
++!! end + +# Because of section-wrapping and template-wrapping interactions, +# the scope of the template is expanded so that the template markup +# is valid in the presence of 2
+e
tags. +!! test +Section wrapping with template-generated sections (bad nesting 1) +!! options +parsoid={ + "wrapSections": true +} +!! wikitext += 1 = +a + +{{echo|1= += 2 = +b +== 2.1 == +c +}} + +d + += 3 = +e +!! html/parsoid + 1
+a
+ +2
+b
+2.1
+c
+ +d
+ ++!! end + +# Because of section-wrapping and template-wrapping interactions, +# additional template wrappers are added to 3
+e
tags +# so that template wrapping semantics are valid whether section +# tags are retained or stripped. But, the template scope can expand +# greatly when accounting for section tags. +!! test +Section wrapping with template-generated sections (bad nesting 2) +!! options +parsoid={ + "wrapSections": true, + "modes": ["wt2html", "wt2wt"] +} +!! wikitext += 1 = +a + +{{echo|1= +== 1.2 == +b += 2 = +c +}} + +d + += 3 = +e +!! html/parsoid + 1
+a
+ +1.2
+b
+2
+c
+ +d
++!! end + +!! test +Section wrapping with uneditable lead section + div wrapping multiple sections +!! options +parsoid={ + "wrapSections": true +} +!! wikitext +foo + + 3
+e
+= 1 = +a + +== 1.1 == +b + += 2 = +c ++ += 3 = +d + +== 3.1 == +e +!! html/parsoid +foo
+ + ++ +1
+a
+ +1.1
+b
+ +2
+c
++!! end + +!! test +Section wrapping with editable lead section + div overlapping multiple sections +!! options +parsoid={ + "wrapSections": true +} +!! wikitext +foo + += 1 = +a + 3
+d
+ +3.1
+e
++b + +== 1.1 == +c + += 2 = +d ++e + += 3 = +f + +== 3.1 == +g +!! html/parsoid +foo
+ +1
+a
+ ++b
+ +1.1
+c
+ +2
+d
+e
+ ++!! end + +!! test +HTML header tags should not be wrapped in section tags +!! options +parsoid={ + "wrapSections": true +} +!! wikitext +foo + + 3
+f
+ +3.1
+g
+a
+ += b = + +c
+ += d = +!! html/parsoid +foo
+ +a
+ +b
+ +c
+ ++!! end d