X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fparser%2FparserTests.txt;h=e62eb80f1171e096aa5d23acf5bd9ef9f33165de;hb=31a52f9e3d49d452f4aef95491de7ad75ed4ccc3;hp=dacc726ad597cba2eeac3a9a625aa4827a06f7b9;hpb=68d61cac82963f5b96786a82ec1cfa59930b0904;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index dacc726ad5..e62eb80f11 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -65,6 +65,30 @@ Template:inner list * item 1 !! endarticle +!! article +Template:echo +!! text +{{{1}}} +!! endarticle + +!! article +Template:echo_with_span +!! text +{{{1}}} +!! endarticle + +!! article +Template:echo_with_div +!! text +
asdf- +
asdf ++
asdf ++
xyz +
+asdf +xyz +!! end !! test @@ -868,6 +908,127 @@ Bug 6200: Preformatted in
!! end +!!test +Templates: Pre: 1a. Templates that break a line should suppress+!!input + {{echo|}} +!!result + +!!end + +!!test +Templates: Pre: 1b. Templates that break a line should suppress+!!input + {{echo| +foo}} +!!result +foo +
+!!end + +!! test +Templates: Pre: 1c: Wrapping should be based on expanded content +!! input + {{echo|a +b}} +!!result +a ++b +
+!!end + +!! test +Templates: Pre: 1d: Wrapping should be based on expanded content +!! input + {{echo|a +b +c + d +e +}} +!!result +a ++b +c +
+d ++e +
+!!end + +!!test +Templates: Pre: 1e. Wrapping should be based on expanded content +!!input +{{echo| foo}} + +{{echo| foo}} +{{echo| bar}} + +{{echo| foo}} + +{{echo| foo}} + +{{echo|{{echo| }}bar}} +!!result +foo ++foo +bar ++foo ++foo ++bar ++!!end + +### +### Parsoid-centric tests for testing RT edge cases +### around comments and white-space inside pre blocks +### + +!!test +1a. Pre and Comments +!!input + a + +c +!!result +a ++c +
+!!end + +!!test +1b. Pre and Comments +!!input + a + +c +!!result +a ++c +
+!!end + +!!test +1c. Pre and Comments +!!input + a + + a +!!result +a ++a ++!!end ### ### Definition lists @@ -1505,6 +1666,15 @@ second] !!end +!! test +External links: Pipe char between url and text +!! input +[http://example.com | link] +!! result +| link +
+!!end + !! test External links: protocol-relative URL in brackets !! input @@ -2816,6 +2986,16 @@ Blah blah blah !! end +!! test +Parsoid-specific test: Wikilinks with should RT properly +!! options +language=ln +!! input +[[WW II]] +!!result +WW II +
+!! end ## ## XHTML tidiness @@ -2852,6 +3032,47 @@ Failing to transform badly formed HTML into correct XHTML !!end +!! test +Handling html with a div self-closing tag +!! input + + ++ +++!! result +<div title /> +<div title/> +
+++ +!! end + +!! test +Handling html with a br self-closing tag +!! input +<div title=bar /> +<div title=bar/> +
+ +
+
+
+
+
+
+!! result ++!! end + !! test Horizontal ruler (should it add that extra space?) !! input @@ -3843,6 +4064,14 @@ Template parameter as link source !! end +!!test +Template-generated attribute string (k='v') +!!input +bar +!!result +
+
+
+
+
+
+bar +
+!!end !!article Template:paramtest2 @@ -4119,6 +4348,47 @@ section=1 ==Section 1== !! end +### +###and in attributes +### +!!test +0. includeonly around the entire attribute +!!input +id="v1" id="v2" >bar +!!result +bar +
+!!end + +!!test +1. includeonly in html attr key +!!input +idabout ="foo">bar +!!result +bar +
+!!end + +!!test +2. includeonly in html attr value +!!input +bar +"v1""v2" >bar +!!result +bar +bar +
+!!end + +!!test +3. includeonly in part of an attr value +!!input +bar +!!result +bar +
+!!end + ### ### Testing parsing of templates where a template arg ### has the same name as the template itself. @@ -4127,7 +4397,7 @@ section=1 !! article Template:quote !! text -{{{quote|{{{1}}} }}} +{{{quote|{{{1}}}}}} !! endarticle !!test @@ -4135,7 +4405,7 @@ Templates: Template Name/Arg clash: 1. Use of positional param !!input {{quote|foo}} !!result -foo +
foo
!!end @@ -4153,18 +4423,13 @@ Templates: Template Name/Arg clash: 3. Use of named param with empty input !!input {{quote|quote}} !!result -quote +
quote
!!end ### ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged ### -!! article -Template:echo -!! text -{{{1}}} -!! endarticle !!test Templates: 1. Simple use @@ -4456,21 +4721,45 @@ Templates: Tables: 4f. Generating a single tag of a HTML table !!end !!test -Templates: Pre: 1a. Templates that break a line should suppress+Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo) !!input - {{echo|}} +{{echo|''a}}{{echo|b''c''d}}{{echo|''e}} !!result +abcde +
+!!end +!!test +Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span) +(PHP parser generates misnested html) +!! options +disabled +!!input +{{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}} +!!result +abcde
!!end !!test -Templates: Pre: 1b. Templates that break a line should suppress+Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div) +(PHP parser generates misnested html) +!! options +disabled !!input - {{echo| -foo}} +{{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}} !!result -foo -
+a+bcd+e+!!end + +!!test +Templates: Ugly nesting: 4. Divs opened/closed across templates +!!input +ab{{echo|cd}}e +!!result +abcde + !!end !!test @@ -5151,6 +5440,15 @@ Image with caption !! end +!! test +Image with empty attribute +!! input +[[Image:foobar.jpg|right||Caption text]] +!! result + + +!! end + !! test Image with link parameter, wiki target !! input @@ -5245,7 +5543,7 @@ Thumbnail image with link parameter !! input [[Image:foobar.jpg|thumb|link=http://example.com/|Title]] !! result - + !! end @@ -5319,7 +5617,7 @@ Thumbnail image caption with a free URL !! input [[Image:foobar.jpg|thumb|http://example.com]] !! result - + !! end @@ -5328,7 +5626,7 @@ Thumbnail image caption with a free URL and explicit alt !! input [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]] !! result - + !! end @@ -5337,7 +5635,7 @@ BUG 1887: A ISBN with a thumbnail !! input [[Image:foobar.jpg|thumb|ISBN 1235467890]] !! result - + !! end @@ -5346,7 +5644,7 @@ BUG 1887: A RFC with a thumbnail !! input [[Image:foobar.jpg|thumb|This is RFC 12354]] !! result - + !! end @@ -5355,7 +5653,7 @@ BUG 1887: A mailto link with a thumbnail !! input [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]] !! result - + !! end @@ -5428,7 +5726,7 @@ Image caption containing another image !! input [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]] !! result - + !! end @@ -5448,7 +5746,7 @@ Bug 3090: External links other than http: in image captions !! input [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]] !! result - + !! end @@ -5618,6 +5916,39 @@ pst [[Category:Foo (bar)|Foo]] !! end +!! test +Category with template +!! options +cat +pst +!! input +[[Category:{{echo|Foo}}]] +!! result +[[Category:{{echo|Foo}}]] +!! end + +!! test +Category with template in sort key +!! options +cat +pst +!! input +[[Category:Foo|{{echo|Bar}}]] +!! result +[[Category:Foo|{{echo|Bar}}]] +!! end + +!! test +Category with template in sort key and title +!! options +cat +pst +!! input +[[Category:{{echo|Foo}}|{{echo|Bar}}]] +!! result +[[Category:{{echo|Foo}}|{{echo|Bar}}]] +!! end + ### ### Inter-language links ### @@ -5633,6 +5964,19 @@ ill es:Alimento fr:Nourriture zh:é£å !! end +!! test +Duplicate interlanguage links (bug 24502) +!! options +ill +!! input +[[es:1]] +[[es:2]] +[[fr:1]] +[[fr:2]] +!! result +es:1 fr:1 +!! end + ### ### Sections ### @@ -8565,19 +8909,19 @@ image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla. - +Blabla|blabla.
@@ -8597,14 +8941,14 @@ File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt !! result
- @@ -8817,7 +9161,7 @@ Width + Height sized image (using px) (height is ignored) !! input [[Image:foobar.jpg|640x480px]] !! result - !!end @@ -8826,7 +9170,7 @@ Width-sized image (using px, no following whitespace) !! input [[Image:foobar.jpg|640px]] !! result - !!end @@ -8835,7 +9179,7 @@ Width-sized image (using px, with following whitespace - test regression from r3 !! input [[Image:foobar.jpg|640px ]] !! result - !!end @@ -8844,7 +9188,7 @@ Width-sized image (using px, with preceding whitespace - test regression from r3 !! input [[Image:foobar.jpg| 640px]] !! result - !!end @@ -8884,7 +9228,7 @@ Images with the "|" character in the comment !! input [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|¶m2=|x external] URL]] !! result - + !!end @@ -9878,7 +10222,7 @@ Free external link invading image caption !! input [[Image:Foobar.jpg|thumb|http://x|hello]] !! result - + !! end @@ -10801,7 +11145,7 @@ File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink !! result
- +caption
@@ -10820,7 +11164,7 @@ File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org !! result
- +caption
@@ -10839,7 +11183,7 @@ File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascri !! result
- +caption
@@ -10896,6 +11240,24 @@ HttP://MediaWiki.Org/ !! end +### +### Parsoids-specific tests +### Parsoid-PHP parser incompatibilities +### +!!test +1. SOL-sensitive wikitext tokens as template-args +!!options +disabled +!!input +{{echo|*a}} +{{echo|#a}} +{{echo|:a}} +!!result +*a +#a +:a +
+!!end TODO: more images