X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fparser%2FparserTests.txt;h=6025ce132917a8238ef639463bb27f3a37926529;hb=91f2c1e40e60b4a51e3703f7d45fa3d6934adda3;hp=ac3113e9bb9db24c9fd9dbf044a3eae8be5d2654;hpb=e6626ef8be6de05969aa4e7f27f1d65a5f30e042;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index ac3113e9bb..6025ce1329 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -65,6 +65,18 @@ Template:inner list * item 1 !! endarticle +!! article +Template:tbl-start +!! text +{| +!! endarticle + +!! article +Template:tbl-end +!! text +|} +!! endarticle + !! article Template:! !! text @@ -102,6 +114,12 @@ Template:table_attribs |style="color: red"| Foo !! endarticle +!! article +A?b +!! text +Weirdo titles! +!! endarticle + ### ### Basic tests ### @@ -536,7 +554,7 @@ nowiki 3 ### Comments ### !! test -Comments and Pre +Comments and Indent-Pre !! input asdf @@ -942,7 +960,7 @@ Bug 6200: Preformatted in
!! end !!test -Templates: Pre: 1a. Templates that break a line should suppress
+Templates: Indent-Pre: 1a. Templates that break a line should suppress 
 !!input
  {{echo|}}
 !!result
@@ -950,7 +968,7 @@ Templates: Pre: 1a. Templates that break a line should suppress 
 !!end
 
 !!test
-Templates: Pre: 1b. Templates that break a line should suppress 
+Templates: Indent-Pre: 1b. Templates that break a line should suppress 
 !!input
  {{echo|
 foo}}
@@ -960,7 +978,7 @@ foo}}
 !!end
 
 !! test
-Templates: Pre: 1c: Wrapping should be based on expanded content
+Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
 !! input
  {{echo|a
 b}}
@@ -972,7 +990,7 @@ b}}
 !!end
 
 !! test
-Templates: Pre: 1d: Wrapping should be based on expanded content
+Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
 !! input
  {{echo|a
 b
@@ -993,7 +1011,7 @@ c
 !!end
 
 !!test
-Templates: Pre: 1e. Wrapping should be based on expanded content
+Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
 !!input
 {{echo| foo}}
 
@@ -1024,7 +1042,7 @@ bar
 !!end
 
 !! test
-Templates: Pre: 1f: Wrapping should be based on expanded content
+Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
 !! input
 {{echo| }}a
 
@@ -1114,7 +1132,7 @@ Templates: Strip whitespace from named parameters, but not positional ones
 ###
 
 !!test
-1a. Pre and Comments
+1a. Indent-Pre and Comments
 !!input
  a
 
@@ -1127,7 +1145,7 @@ c
 !!end
 
 !!test
-1b. Pre and Comments
+1b. Indent-Pre and Comments
 !!input
  a
  
@@ -1140,7 +1158,7 @@ c
 !!end
 
 !!test
-1c. Pre and Comments
+1c. Indent-Pre and Comments
 !!input
   a
 
@@ -1153,7 +1171,7 @@ c
 !!end
 
 !!test
-2a. Pre and tables
+2a. Indent-Pre and tables
 !!input
  {|
  |-
@@ -1174,7 +1192,7 @@ c
 !!end
 
 !!test
-2b. Pre and tables
+2b. Indent-Pre and tables
 !!input
   {|
  |-
@@ -1190,7 +1208,7 @@ c
 !!end
 
 !!test
-3a. Pre and block tags (single-line html)
+3a. Indent-Pre and block tags (single-line html)
 !!input
  

foo

foo
@@ -1203,7 +1221,7 @@ c !!end !!test -3b. Pre and block tags (pre-content on separate line) +3b. Indent-Pre and block tags (pre-content on separate line) !!input

foo @@ -1273,6 +1291,80 @@ c !!end +### +### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric) +### + +!!test +HTML-pre: 1. embedded newlines +!!input +

foo
+ +
+foo
+
+ +
+
+foo
+
+ +
+
+
+foo
+
+!!result +
foo
+
+foo
+
+
+
+foo
+
+
+
+
+foo
+
+ +!!end + +!!test +HTML-pre: 2: indented text +!!input +
+ foo
+
+!!result +
+ foo
+
+ +!!end + +!!test +HTML-pre: 3: other wikitext +!!input +
+* foo
+# bar
+= no-h =
+'' no-italic ''
+[[ NoLink ]]
+
+!!result +
+* foo
+# bar
+= no-h =
+'' no-italic ''
+[[ NoLink ]]
+
+ +!!end + ### ### Definition lists ### @@ -1566,6 +1658,66 @@ should be left alone ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html +!! test +Table / list interaction: indented table with lists in table contents +!! input +:{| +|- +| a +* b +|- +| c +* d +|} +!! result +
+ + + + +
a +
  • b +
+
c +
  • d +
+
+ +!! end + +!!test +Table / list interaction: lists nested in tables nested in indented lists +!!input +:{| +| +:a +:b +| +*c +*d +|} + +*e +*f +!!result +
+ + +
+
a +
b +
+
+
  • c +
  • d +
+
+
  • e +
  • f +
+ +!!end + !! test Definition Lists: Nesting: Multi-level (Parsoid only) !! options @@ -2572,6 +2724,31 @@ A table with nothing but a caption !! end +!! test +Table td-cell syntax variations +!! input +{| +| foo bar foo | baz +| foo bar foo || baz +| style='color:red;' | baz +| style='color:red;' || baz +|} +!! result + + + + + + + +
baz + foo bar foo baz + baz + style='color:red;' baz +
+ +!! end + !! test Simple table !! input @@ -2682,25 +2859,104 @@ Multiplication table !! end +!! test +Accept "||" in table headings +!! input +{| +!h1 || h2 +|} +!! result + + + +
h1 h2 +
+ +!! end + +!! test +Accept "||" in indented table headings +!! input +:{| +!h1 || h2 +|} +!! result +
+ + +
h1 h2 +
+ +!! end + +!! test +Accept empty attributes in td/th cells (td/th cells starting with leading ||) +!! input +{| +!| h1 +|| a +|} +!! result + + + +
h1 + a +
+ +!! end + !!test -Allow +/- in 2nd and later cells in a row +Accept "| !" at start of line in tables (ignore !-attribute) !!input {| +|- +| !style="color:red" | bar +|} +!!result + + + +
bar +
+ +!!end + +!!test +Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/- +!!input +{| +|- +|style='color:red;'|+1 +|style='color:blue;'|-1 +|- | 1 || 2 || 3 +| 1 ||+2 ||-3 |- -| 1 || +2 || -3 +| +1 +| -1 |} !!result + + + + + + + - - - +
+1 +-1 +
1 2 3 + 1 +2 -3
1 +2 -3 + +1 + -1
!!end @@ -2869,6 +3125,29 @@ disabled !! end +!! test +Wikitext table with a lot of comments +!! input +{| + +| foo + +|- + +| + +|} +!! result + + + + +
foo +
+
+ +!! end + ### ### Internal links ### @@ -2953,6 +3232,15 @@ Link with suffix

!! end +!! test +Link with HTML entity in suffix / tail +!! input +[[Main Page]]", [[Main Page]]a +!! result +

Main Page", Main Pagea +

+!! end + !! test Link with 3 brackets !! input @@ -3149,6 +3437,18 @@ Plain link to protocol-relative URL with link text

!! end +!! test +Plain link to page with question mark in title +!! input +[[A?b]] + +[[A?b|Baz]] +!! result +

A?b +

Baz +

+!! end + # I'm fairly sure the expected result here is wrong. # We want these to be URL links, not pseudo-pages with URLs for titles.... @@ -3828,6 +4128,20 @@ List interrupted by empty line or heading !!end +!!test +Multiple list tags generated by templates +!!input +{{echo|
  • }}a +{{echo|
  • }}b +{{echo|
  • }}c +!!result +
  • a +
  • b +
  • c
  • + + + +!!end ### ### Magic Words @@ -4274,6 +4588,24 @@ Nonexistent template

    !! end +!! test +Template with invalid target containing tags +!! input +{{ab|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}} +!! result +

    {{ab|foo|a=b|a = b}} +

    +!! end + +!! test +Template with invalid target containing unclosed tag +!! input +{{a|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}} +!! result +

    {{a|foo|a=b|a = b}} +

    +!! end + !! article Template:test !! text @@ -4743,6 +5075,13 @@ Foozarbar

    !! end +!! test +Un-closed +!! input + +!! result +!! end + !! test on a page !! input @@ -4752,6 +5091,47 @@ Foozarbar

    !! end +!! test +Un-closed +!! input + +!! result +!! end + +!!test +Self-closed noinclude, includeonly, onlyinclude tags +!!input + + + +!!result +


    +

    +!!end + +!!test +Unbalanced includeonly and noinclude tags +!!input +{| +|a
    +|b
    +|c +|d +|} +!!result + + + + + +
    a +b +c</includeonly> +d</includeonly></includeonly> +
    + +!!end + !! article Template:Includeonly section !! text @@ -4810,6 +5190,13 @@ section=1 ==Section 1== !! end +!! test +Un-closed +!! input + +!! result +!! end + ### ### and in attributes ### @@ -5224,6 +5611,45 @@ Templates: Wiki Tables: 3. td-content via multiple templates !!end +!!test +Templates: Wiki Tables: 4. Templated tags, no content +!!input +{{tbl-start}} +{{tbl-end}} +!!result + +
    + +!!end + +!!test +Templates: Wiki Tables: 4. Templated tags, regular td-tags +!!input +{{tbl-start}} +|foo +{{tbl-end}} +!!result + + +
    foo +
    + +!!end + +!!test +Templates: Wiki Tables: 4. Templated tags, templated td-tags +!!input +{{tbl-start}} +{{!}}foo +{{tbl-end}} +!!result + + +
    foo +
    + +!!end + !!test Templates: Lists: Multi-line list-items via templates !!input @@ -5291,7 +5717,7 @@ disabled |bar |} !!result - +
    foo
    bar @@ -5323,14 +5749,14 @@ disabled !!result - - - - -
    - - -
    1. foo
    bar 2. baz
    + + + + +
    + + +
    1. foo
    bar 2. baz
    abc @@ -6054,6 +6480,19 @@ Image with multiple captions -- only last one is accepted !! end +!! test +Image with width attribute at different positions +!! input +[[Image:foobar.jpg|200px|right|Caption]] +[[Image:foobar.jpg|right|200px|Caption]] +[[Image:foobar.jpg|right|Caption|200px]] +!! result +
    Caption
    +
    Caption
    +
    Caption
    + +!! end + !! test Image with link parameter, wiki target !! input @@ -7089,6 +7528,10 @@ Namespaced link must have a title (bad fragment version) !!end +### +### HTML tags and HTML attributes +### + !! test div with no attributes !! input @@ -7147,6 +7590,18 @@ disabled !! end +# The PHP parser escapes the opening brace to { for some reason, so +# disabled this test for it. +!! test +div with braces in attribute value +!! options +disabled +!! input +
    Foo
    +!! result +
    Foo
    +!! end + # This it very inconsistent in the PHP parser: it returns # class="class" if there is a space between the name and the equal sign (see # 'div with empty attribute value, space before equals'), but strips the @@ -7197,6 +7652,23 @@ DIV IN UPPERCASE !!end +!! test +Non-ASCII pseudo-tags are rendered as text +!! input + +!! result +

    <khyô> +

    +!! end + +!! test +Pseudo-tag with URL 'name' renders as url link +!! input + +!! result +

    <http://example.com/> +

    +!! end !! test text with amp in the middle of nowhere @@ -10529,6 +11001,29 @@ Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiw

    !! end +!! test +Proper conversion of text in external links +!! options +language=sr variant=sr-ec +!! input +http://www.google.com +gopher://www.google.com +[http://www.google.com http://www.google.com] +[gopher://www.google.com gopher://www.google.com] +[https://www.google.com irc://www.google.com] +[ftp://www.google.com www.google.com/ftp://dir] +[//www.google.com www.google.com] +!! result +

    http://www.google.com +gopher://www.google.com +http://www.google.com +gopher://www.google.com +irc://www.google.com +www.гоогле.цом/фтп://дир +www.гоогле.цом +

    +!! end + !! test Do not convert roman numbers to language variants !! options @@ -11497,22 +11992,6 @@ Bug 31098 Template which includes system messages which includes the template

    !! end -!! test -Deprecated presentational attributes are converted to css -!! input -{| -| valign=top align=left width=100 height=25% | Asdf -|} -
      -!! result - - -
      Asdf -
      -
        - -!! end - !! test Bug31490 Turkish: ucfirst 'blah' !! options @@ -12516,7 +12995,7 @@ disabled !! input [[Foo|Foo''boo'']] !! result -Foo''boo'' +Foo''boo'' !! end !! test @@ -12717,6 +13196,48 @@ Escaping nowikis

        !! end +!! test +Tag-like HTML structures are passed through as text +!! input + + + + + + +1>2 + +xb + +1f +!! result +

        <x y> +

        <x.y> +

        <x-y> +

        1>2 +

        x<y +

        a>b +

        1<d e>f +

        +!! end + + +# This fails in the PHP parser (see bug 40670, +# https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it. +!! test +Tag names followed by punctuation should not be recognized as tags +!! options +disabled +!! input + text +!! result +

        <s.ome> text +

        +!! end + + TODO: more images more tables