From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001
From: Pierre Schmitz
a +b +
+a +b +
+a +b +
+a +
b +
+a +
b +
+a +
+b
+
a +
+b
+
a +
b +
+a +
+b
+
a +b +
+a +b +
+a +
b +
+a +
+b
+
a +
+b
+
a +
+
a +
+
a +
+!! end + !! test Parsing an URL !! input @@ -180,9 +404,12 @@ Simple list * Item 1 * Item 2 !! result -obtained by Lunar Prospector's gamma-ray spectrometer +
+!! end + +# this example taken from [[en:Flaming Pie]] (bug 49926) +!! test +Italics and possessives (2) +!! input +'''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes +!! result +Flaming Pie is ... released in 1997. In Flaming Pie's liner notes +
+!! end +# this example taken from [[en:Dictionary]] (bug 49926) +!! test +Italics and possessives (3) +!! input +The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''. +!! result +The first monolingual dictionary written in a Romance language was Sebastián Covarrubias' Tesoro de la lengua castellana o española, published in 1611 in Madrid. In 1612 the first edition of the Vocabolario dell'Accademia della Crusca, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the Dictionnaire Universel. +
!! end + ### ### 2-quote opening sequence tests ### @@ -258,13 +532,26 @@ Italics and bold: 2-quote opening sequence: (2,4) !! test -Italics and bold: 2-quote opening sequence: (2,5) +Italics and bold: 2-quote opening sequence: (2,5) (php) +!! options +php !! input ''foo''''' !! resultfoo
!!end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +Italics and bold: 2-quote opening sequence: (2,5) (parsoid) +!! options +parsoid +!! input +''foo''''' +!! result +foo +
+!!end ### @@ -302,13 +589,26 @@ Italics and bold: 3-quote opening sequence: (3,4) !! test -Italics and bold: 3-quote opening sequence: (3,5) +Italics and bold: 3-quote opening sequence: (3,5) (php) +!! options +php !! input '''foo''''' !! resultfoo
!!end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +Italics and bold: 3-quote opening sequence: (3,5) (parsoid) +!! options +parsoid +!! input +'''foo''''' +!! result +foo +
+!!end ### @@ -346,13 +646,26 @@ Italics and bold: 4-quote opening sequence: (4,4) !! test -Italics and bold: 4-quote opening sequence: (4,5) +Italics and bold: 4-quote opening sequence: (4,5) (php) +!! options +php !! input ''''foo''''' !! result'foo
!!end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +Italics and bold: 4-quote opening sequence: (4,5) (parsoid) +!! options +parsoid +!! input +''''foo''''' +!! result +'foo +
+!!end ### @@ -361,6 +674,7 @@ Italics and bold: 4-quote opening sequence: (4,5) !! test Italics and bold: 5-quote opening sequence: (5,2) +!! options !! input '''''foo'' !! result @@ -432,23 +746,49 @@ Italics and bold: multiple quote sequences: (2,4,4) !! test -Italics and bold: multiple quote sequences: (3,4,2) +Italics and bold: multiple quote sequences: (3,4,2) (php) +!! options +php !! input '''foo''''bar'' !! resultfoo'bar
!!end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +Italics and bold: multiple quote sequences: (3,4,2) (parsoid) +!! options +parsoid +!! input +'''foo''''bar'' +!! result +foo'bar +
+!!end + - !! test -Italics and bold: multiple quote sequences: (3,4,3) +Italics and bold: multiple quote sequences: (3,4,3) (php) +!! options +php !! input '''foo''''bar''' !! resultfoo'bar
!!end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +Italics and bold: multiple quote sequences: (3,4,3) (parsoid) +!! options +parsoid +!! input +'''foo''''bar''' +!! result +foo'bar +
+!!end ### ### other quote tests @@ -485,6 +825,7 @@ Italics and bold: other quote tests: (3,2,3,2) !! test Italics and bold: other quote tests: (3,2,3,3) +!! options !! input '''this is about ''foo'''s family''' !! result @@ -512,6 +853,23 @@ The ''[[Main Page]]'''s talk page. !! end +!! test +Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line +(Requires tidy for PHP parser output to be fixed up) +!! options +parsoid=wt2html,wt2wt +!! input +{| +!''a!!''b +|''a||''b +|} +!! result +a | b | +a | b |
---|
strike
+
s
+
<b→> doesn't work! </b> +
<bä> doesn't work! </b> +
<boo> works fine </b> +
<s.foo>foo</s> +
<s.foo>s.foo</s.foo> +
<sub-ID#1> +
+!! end + +### +### Special characters +### + +!! test +Bare pipe character (bug 52363) +!! input +| +!! result +| +
+!! end + +!! test +Bare pipe character from a template (bug 52363) +!! input +{{pipe}} +!! result +| +
+!! end + ### ###– +
+!! end ### ### Comments @@ -781,7 +1226,7 @@ b !! end ### -### paragraph wraping tests +### paragraph wrapping tests ### !! test No block tags @@ -794,8 +1239,9 @@ bb
!! end + !! test -Block tag on one line +Block tag on one line () +!! input +afoo+ +b +!! result +afoo+b +
+!! end + +!! test +Block tag on both lines () !! input afoo@@ -818,6 +1276,18 @@ bfoo!! end +!! test +Block tag on both lines () +!! input +a+foo+ +bfoo+!! result +afoo+bfoo+ +!! end + !! test Multiple lines without block tags !! input @@ -837,7 +1307,7 @@ xfooz !! end !! test -Empty lines between block tags to test open p-tags are closed between the block tags +Empty lines between lines with block tags !! input @@ -845,6 +1315,12 @@ Empty lines between block tags to test open p-tags are closed between the block a b +ab + +bd + + +e!! resulta
@@ -852,6 +1328,12 @@ bb
+ab +bd ++
+e+ !! end ### @@ -874,6 +1356,22 @@ And a link !! end +!! test +Tabs don't trigger preformatted text +!! input + This is not + preformatted text. + This is preformatted text. + So is this. +!! result +This is not + preformatted text. +
+This is preformatted text. + So is this. ++!! end + !! test Ident preformatting with inline content !! input @@ -916,17 +1414,61 @@ Regression with preformatted in!! end -# Expected output in the following test is not really expected (there should be -# in the output) -- it's only testing for well-formedness. !! test -Bug 6200: Preformatted in!!end +# TODO / maybe: fix wt2wt for this !! test -Templates: Single-line variant of parameter whitespace stripping test +Parsoid: Don't paragraph-wrap fosterable content +!! options +parsoid=wt2html !! input -{{echo| a}} +{| ++Bug 52763: Preformatted in!! inputBlah!! result- Blah ++ +!! end + +!! test +Bug 51086: Double newlines in blockquotes should be turned into paragraphs +!! input +Blah +
++Foo + +Bar ++!! result +++ +!! end + +!! test +Bug 15491: /Foo +
Bar +
+in blockquote +!! input ++Foo+!! result +barbaz quux +++ +!! end + +# Note that the p-wrapping is newline sensitive, which could be +# considered a bug: tidy will wrap only the 'Foo' in the example +# below in aFoo
+barbaz quux +tag. (see comment 23-25 of bug #6200) +!! test +Bug 15491: /
in blockquote (2) +!! input +Foo+!! result +barbaz quux +Foo!! end @@ -1156,82 +1698,253 @@ Templates: Indent-Pre: 1f: Wrapping should be based on expanded contentbarbaz quux+ -{{echo|1= a}} -{{echo|{{echo| a}}}} -{{echo|1={{echo| a}}}} +|} !! result - a --a -
-a --a -
++ + +
!! end !! test -Templates: Strip whitespace from named parameters, but not positional ones +Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced +!! options +parsoid=wt2html !! input -{{echo| - foo}} +{| ++ + + + ++ + + + -{{echo| -* foo}} + + +|} +!! result ++ + +
+!! end + + +#-------------------------------------------------------------------- +# Transclusion parameter whitespace stripping tests +# Behavior is different for positional and named parameters +#-------------------------------------------------------------------- +!! test +Templates: Strip leading and trailing whitespace from named-param values +!! input +{{echo|1= a }} + +{{echo|1= {{echo|b}} }} {{echo| 1 = - foo}} + c }} {{echo| 1 = -* foo}} +* d +}} !! result -+ + + + ++ + + foo ---
--
- foo -
foo +
a +
b +
c
-+
- foo -
+
!! end -### -### Parsoid-centric tests for testing RT edge cases for pre -### +!! test +Templates: Don't strip whitespace from positional-param values +!! input +{{echo|a }} -!!test -1a. Indent-Pre and Comments -!!input - a - -c -!!result -- d +
+a +{{echo|{{echo|b}} }} + +{{echo| c +}} + +{{echo| {{echo|d}} +}} + +{{echo| + e}} + +{{echo| +* f}} + +{{echo| + }}g +!! result +a +
b +
+c-c +
-!!end - -!!test -1b. Indent-Pre and Comments -!!input - a - -c -!!result -
a +d-c +
+
+e +++
++
+- f +
++
+g ++!! end + +!! test +Templates: Handle empty comment-and-ws-only lines correctly +!! input +{{echo|foo + + +bar}} +!! result +foo +bar +
+!! end + +#-------------------------------------------------------------------- +# Transclusion parameter escaping tests +#-------------------------------------------------------------------- +!! test +Templates: Parsoid parameter escaping test 1 +!! options +parsoid +!! input +{{echo|[foo]|{{echo|[bar]}}}} +!! result +[foo]
+!! end + +!! test +Parsoid: Pipes in external links in template parameter +!! options +parsoid +!! input +{{echo|[{{echo|http://example.com}} link]}} +!! result + +!! end + +!! test +Parsoid: pipe in transclusion parameter +!! options +parsoid +!! input +{{echo|http://foo.com/a|b}} +!! result + +!! end + +!! test +Parsoid: Pipe in external link target and content in template parameter +!! options +parsoid=html2wt,wt2wt +!! input +{{echo|[http://foo.com/a|b a|b]}} +!! result + +!! end + +!! test +Templates: Dont escape already nowiki-escaped text in template parameters +!! options +parsoid=html2wt,wt2wt +!! input +{{echo|foo| bar}} +{{echo|<div> }} +{{echo|}} +!! result + foo|bar +<div> + +
+!! end + +## Bug 52824 +!! test +Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param +!! options +parsoid=html2wt,wt2wt +!! input +{{echo|{{echo|1=bar}}}} +!! result +bar
+!! end + +### +### Parsoid-centric tests for testing RT edge cases for pre +### + +!!test +1a. Indent-Pre and Comments +!!input + a + +c +!!result +a ++c +
+!!end + +!!test +1b. Indent-Pre and Comments +!!input + a + +c +!!result +a ++c
!!end @@ -1248,6 +1961,20 @@ c !!end +!!test +1d. Indent-Pre and Comments +(Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order) +!!input + a + + b +!!result +a ++b ++!!end + !!test 2a. Indent-Pre and tables !!input @@ -1307,10 +2034,12 @@ c !!inputfoo
foo+foofoo !!resultfoo
foo+foofoo
!!end @@ -1334,6 +2063,12 @@ c foo+++foo ++@@ -1355,7 +2090,13 @@ c
foo - foo ++foo +
+++foo +!! end @@ -1812,18 +2680,27 @@ Table / list interaction: lists nested in tables nested in indented lists
foo @@ -1400,6 +2141,56 @@ b!! end +!! test +6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content +!! input + a + + + b + + c + +d +!! result +a + +b ++c + ++d +
+!! end + +!! test +7a. Indent-pre and category links +!! options +parsoid=wt2html,wt2wt +!! input + [[Category:foo]] +{{echo| [[Category:foo]]}} +!! result + + + +!! end + +!! test +7b. Indent-pre and category links +!! options +parsoid=wt2html,wt2wt +!! input + [[Category:foo]] a + [[Category:foo]] {{echo|b}} +!! result ++ a + + b
+!! end + ### ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric) ### @@ -1482,8 +2273,11 @@ Simple definition !! input ; name : Definition !! result -+
- name
- Definition -
+
!! end @@ -1492,8 +2286,10 @@ Definition list for indentation only !! input : Indented text !! result -- name
+- Definition +
++
- Indented text -
+
!! end @@ -1502,8 +2298,11 @@ Definition list with no space !! input ;name:Definition !! result -- Indented text +
++
- name
- Definition -
+
!!end @@ -1512,8 +2311,11 @@ Definition list with URL link !! input ; http://example.com/ : definition !! result -- name
+- Definition +
++
- http://example.com/
- definition -
+
!! end @@ -1522,8 +2324,11 @@ Definition list with bracketed URL link !! input ;[http://www.example.com/ Example]:Something about it !! result -- http://example.com/
+- definition +
++
- Example
- Something about it -
+
!! end @@ -1532,8 +2337,11 @@ Definition list with wikilink containing colon !! input ; [[Help:FAQ]]: The least-read page on Wikipedia !! result -- Example
+- Something about it +
++
- Help:FAQ
- The least-read page on Wikipedia -
+
!! end @@ -1543,8 +2351,11 @@ Definition list with news link containing colon !! input ; news:alt.wikipedia.rox: This isn't even a real newsgroup! !! result -- Help:FAQ
+- The least-read page on Wikipedia +
++
- news:alt.wikipedia.rox
- This isn't even a real newsgroup! -
+
!! end @@ -1553,8 +2364,10 @@ Malformed definition list with colon !! input ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop !! result -- news:alt.wikipedia.rox
+- This isn't even a real newsgroup! +
++
- news:alt.wikipedia.rox -- don't crash or enter an infinite loop -
+
!! end @@ -1563,8 +2376,11 @@ Definition lists: colon in external link text !! input ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up !! result -- news:alt.wikipedia.rox -- don't crash or enter an infinite loop +
++
- Wikipedia : The Next Generation
- OK, I made that up -
+
!! end @@ -1573,8 +2389,10 @@ Definition lists: colon in HTML attribute !! input ;bold !! result -- Wikipedia : The Next Generation
+- OK, I made that up +
++
- bold -
+
!! end @@ -1583,8 +2401,11 @@ Definition lists: self-closed tag !! input ;one- bold +
+
two : two-line fun !! result -+
- one
two- two-line fun -
+
!! end @@ -1613,16 +2434,19 @@ Definition and unordered list using wiki syntax nested in unordered list using h- one
+
two- two-line fun +
++ !! result
- ; term : description * unordered -
-!! end @@ -1633,8 +2457,11 @@ Definition list with empty definition and following paragraph ; term: Paragraph text !! result -
- -
-
- term
- description -
+
- unordered -
+
+- term
+- description +
++
+- unordered
+
- term
- -
+
- term
+- +
+Paragraph text
!! end @@ -1663,10 +2490,14 @@ Definition Lists: No nesting: Multiple dd's :a :b !! result -+
- x -
- a -
- b -
+
!! end @@ -1677,12 +2508,18 @@ Definition Lists: Indentation: Regular ::i2 :::i3 !! result -- x +
+- a +
+- b +
++
- i1 -
-
- i2 -
-
- i3 -
+
!! end @@ -1692,11 +2529,17 @@ Definition Lists: Indentation: Missing 1st level ::i2 :::i3 !! result -- i1 +
++
+- i2 +
++
+- i3 +
++
-
- i2 -
-
- i3 -
+
!! end @@ -1705,10 +2548,16 @@ Definition Lists: Indentation: Multi-level indent !! input :::i3 !! result -- +
+
+- i2 +
++
+- i3 +
++
-
-
- i3 -
+
!! end @@ -1732,6 +2581,21 @@ should be left alone should be left alone !! end + +# Bug 52473 +!! test +Definition Lists: Hacky use to indent tables (WS-insensitive) +!! options +parsoid +!! input +: {| +|a +|} +!! result +- +
+
+- +
+
+- i3 +
++
+!! end ## The PHP parser treats : items (dd) without a corresponding ; item (dt) ## as an empty dt item. It also ignores all but the last ";" when followed ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in @@ -1783,13 +2647,17 @@ Table / list interaction: indented table with lists in table contents- +
a a - +
- b -
+
- b +
+c - +
- d -
+
- d +
+-
- +
- a -
- b -
+
- a +
+- b +
+- +
- c -
- d -
+
- c +
+- d +
++
- e -
- f -
+
!!end @@ -1911,43 +2788,91 @@ Definition Lists: Nesting: Test 4 ::;t3 :::d3 !! result -- e +
+- f +
++
-
-
- t3 -
- d3 -
+
!! end +## The Parsoid team believes the following three test exposes a +## bug in the PHP parser. (Parsoid team thinks the PHP parser is +## wrong to close the- +
+
+- +
+
+- t3 +
+- d3 +
+after the
-- containing the
.) !! test -Definition Lists: Mixed Lists: Test 1 +Definition Lists: Mixed Lists: Test 1 (php) +!! options +php !! input :;* foo ::* bar :; baz !! result -
- -!! end - - +
-
-
- foo -
- bar -
-
- baz -
+
+ +!! end +!! test +Definition Lists: Mixed Lists: Test 1 (parsoid) +!! options +parsoid +!! input +:;* foo +::* bar +:; baz +!! result +- +
+
+- +
+
+- foo +
+- bar +
++
+- baz +
++
+!! end + !! test Definition Lists: Mixed Lists: Test 2 !! input *: d1 *: d2 !! result -- +
+
- +
+
- foo +
+- +
+
- bar +
+- baz
++
-
- d1 -
- d2 -
+
!! end @@ -1958,12 +2883,21 @@ Definition Lists: Mixed Lists: Test 3 *::: d1 *::: d2 !! result -- +
+
+- d1 +
+- d2 +
++
-
-
-
- d1 -
- d2 -
+
!! end @@ -1974,10 +2908,17 @@ Definition Lists: Mixed Lists: Test 4 *;d1 :d2 *;d3 :d4 !! result -- +
+
+- +
+
+- +
+
+- d1 +
+- d2 +
++
-
- d1
- d2 -
- d3
- d4 -
+
!! end @@ -1988,11 +2929,17 @@ Definition Lists: Mixed Lists: Test 5 *:d1 *:: d2 !! result -- +
+
+- d1
+- d2 +
+- d3
+- d4 +
++
-
- d1 -
-
- d2 -
+
!! end @@ -2003,13 +2950,23 @@ Definition Lists: Mixed Lists: Test 6 #*:d1 #*::: d3 !! result -- +
+
+- d1 +
++
+- d2 +
++
-
-
- d1 -
-
-
- d3 -
+
!! end @@ -2020,10 +2977,15 @@ Definition Lists: Mixed Lists: Test 7 :* d1 :* d2 !! result -- +
+
+- +
+
+- d1 +
++
+- +
+
+- d3 +
++
-
- d1 -
- d2 -
+
!! end @@ -2034,12 +2996,20 @@ Definition Lists: Mixed Lists: Test 8 :* d1 ::* d2 !! result -- +
+
+- d1 +
+- d2 +
++
-
- d1 -
-
-
- d2 -
+
!! end @@ -2049,9 +3019,14 @@ Definition Lists: Mixed Lists: Test 9 !! input *;foo :bar !! result -- +
+
+- d1 +
++
+- +
+
+- d2 +
++
-
- foo
- bar -
+
!! end @@ -2061,50 +3036,171 @@ Definition Lists: Mixed Lists: Test 10 !! input *#;foo :bar !! result -- +
+
+- foo
+- bar +
++
-
-
- foo
- bar -
+
!! end +# The Parsoid team disagrees with the PHP parser's seemingly-random +# rules regarding dd/dt on the next two tests. Parsoid is more +# consistent, and recognizes the shared nesting and keeps the +# still-open tags around until the nesting is complete. !! test -Definition Lists: Mixed Lists: Test 11 +Definition Lists: Mixed Lists: Test 11 (php) +!! options +php !! input *#*#;*;;foo :bar *#*#;boo :baz !! result -- +
+
+- +
+
+- foo
+- bar +
+
-
-
- foo
-
- bar -
- - - - +
- boo
- baz -
+
+ + + + !! end +!! test +Definition Lists: Mixed Lists: Test 11 (parsoid) +!! options +parsoid +!! input +*#*#;*;;foo :bar +*#*#;boo :baz +!! result +- +
+
+- +
+
+ + ++
- +
+
+- foo
+- +
+
+
+
+- bar +
++
+- boo
+- baz +
++
+ + +!! end !! test -Definition Lists: Weird Ones: Test 1 +Definition Lists: Weird Ones: Test 1 (php) +!! options +php !! input *#;*::;; foo : bar (who uses this?) !! result -- +
++
- +
++
+- +
+
- +
++
- +
++
- +
+
- +
+
- foo
+- bar
+- boo
+- baz
+- - - +
-
- foo
-
-
-
- bar (who uses this?) -
+
+ + + + + + +!! end +!! test +Definition Lists: Weird Ones: Test 1 (parsoid) +!! options +parsoid +!! input +*#;*::;; foo : bar (who uses this?) +!! result ++
- +
+
+- foo
+- +
+
+
+- +
+
+- +
+
+
+- bar (who uses this?) +
++
+ + + !! end ### @@ -2269,6 +3365,17 @@ External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png !! end +!! test +External image (when not allowed) +!! options +wgAllowExternalImages=0 +!! input +External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png +!! result +- +
+
- +
++
+ +- +
++
- +
+
- +
+
- +
+
- +
+
- foo
+- bar (who uses this?)
+External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png +
+!! end + !! test Link to non-http image, no img tag !! input @@ -2691,6 +3798,15 @@ External link containing double-single-quotes with no space separating the url f !! end +!! test +External link with comments in link text +!! input +[http://www.google.com Google ] +!! result +Google +
+!! end + !! test URL-encoding in URL functions (single parameter) !! input @@ -2763,6 +3879,28 @@ Non-extlinks in brackets !! end +!! test +Parsoid: Percent encoding in external links +!! options +parsoid +!! input +[https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search] +!! result + +!! end + +!! test +Parsoid: use url link syntax for links where the content is equal the link +target +!! options +parsoid +!! input +http://example.com +!! result + +!! end + ### ### Quotes ### @@ -2781,7 +3919,9 @@ Normal text. '''''Bold italic text.''''' Normal text. !! test -Unclosed and unmatched quotes +Unclosed and unmatched quotes (php) +!! options +php !! input '''''Bold italic text '''with bold deactivated''' in between.''''' @@ -2816,6 +3956,47 @@ Plain ''italic'''s plainPlain italic's plain
!! end +# Parsoid inserts an empty bold tag pair at the end of the line, that the PHP +# parser strips. The wikitext contains just the first half of the bold +# quote pair. +!! test +Unclosed and unmatched quotes (parsoid) +!! options +parsoid +!! input +'''''Bold italic text '''with bold deactivated''' in between.''''' + +'''''Bold italic text ''with italic deactivated'' in between.''''' + +'''Bold text.. + +..spanning two paragraphs (should not work).''' + +'''Bold tag left open + +''Italic tag left open + +Normal text. + + +'''This year''''s election ''should'' beat '''last year''''s. + +''Tom'''s car is bigger than ''Susan'''s. + +Plain ''italic'''s plain +!! result +Bold italic text with bold deactivated in between. +
Bold italic text with italic deactivated in between. +
Bold text.. +
..spanning two paragraphs (should not work). +
Bold tag left open +
Italic tag left open +
Normal text. +
This year's election should beat last year's. +
Toms car is bigger than Susans. +
Plain italic's plain +
+!! end ### ### Tables @@ -2824,19 +4005,33 @@ Plain ''italic'''s plain ### # This should not produceas
-# is the bare minimun required by the spec, see: +# is the bare minimum required by the spec, see: # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables !! test -A table with no data. +A table with no data. (php) +!! options +php +!! input +{||} +!! result +!! end +# Parsoid team replies: empty table tags are legal in HTML5 +!! test +A table with no data. (parsoid) +!! options +parsoid !! input {||} !! result +
!! end # A table with nothing but a caption is invalid XHTML, we might want to render # this as
caption
!! test -A table with nothing but a caption +A table with nothing but a caption (php) +!! options +php !! input {| |+ caption @@ -2847,13 +4042,25 @@ A table with nothing but a caption!! end - +# Parsoid team replies: table with only a caption is legal in HTML5 !! test -A table with caption with default-spaced attributes and a table row +A table with nothing but a caption (parsoid) +!! options +parsoid !! input {| -|+ style="color: red;" | caption1 -|- +|+ caption +|} +!! result + +!! end + +!! test +A table with caption with default-spaced attributes and a table row +!! input +{| +|+ style="color: red;" | caption1 +|- | foo |} !! result @@ -3243,11 +4450,44 @@ Template-generated table cell attributes and cell content !! input {| |{{table_attribs}} +| {{table_attribs}} |} !! result
caption + +!! end + +!! test +Template-generated table cell attributes and cell content (2) +!! input +{| +|align=center {{table_attribs}} +|} +!! result +
Foo + +Foo + +
+ +!! end + +!! test +Template-generated table cell attributes and cell content (3) +!! input +{| +|align=center {{table_cells}} +|} +!! result ++ Foo + +
!! end @@ -3270,21 +4510,40 @@ Table with row followed by newlines and table heading !! end +!! test +Table with empty line following the start tag +!! input +{| + +|- +| foo +|} +!! result ++ Foo +Bar +Baz + + +
+ +!! end + # FIXME: Preserve the attribute properly (with an empty string as value) in # the PHP parser. Parsoid implements the behavior below. !! test Table attributes with empty value !! options -disabled +parsoid !! input {| | style=| hello |} !! result+ foo + +
+ !! end @@ -3311,6 +4570,159 @@ Wikitext table with a lot of comments !! end +!! test +Wikitext table with double-line table cell +!! input +{| +|a +b +|} +!! result +hello - +
+ +!! end + +!! test +Table cell with a single comment +!! input +{| +| +| a +|} +!! result ++ a + b +
++
+ +!! end + +# The expected HTML structure in this test is debatable. The PHP parser does +# not parse this kind of table at all. The main focus for Parsoid is on +# round-tripping, so this output is ok for now. TODO: revisit! +!! test +Wikitext table with html-syntax row (Parsoid) +!! options +parsoid +!! input +{| +|- ++ + +a + foo +|} +!! result ++ +
+!! end + +!! test +Implicit+ foo after a |- +(PHP parser relies on Tidy to add the missing tags) +!! options +parsoid=wt2html,wt2wt +!! input +{| +|- +a +|} +!! result + +
+!! end + +!! test +Pres should be recognized in an explicit+ a context, but not in an implicit context +(PHP parser relies on Tidy to add the missing tags) +!! options +parsoid=wt2html,wt2wt +!! input +{| +|- +| + a +|- + b +|} +!! result + + +
+!! end + +!! test +Lists should be recognized in an implicit+ a+ + b context +(PHP parser relies on Tidy to add the missing tags) +!! options +parsoid=wt2html,wt2wt +!! input +{| +|- +*a +|} +!! result + +
+!! end + +!! test +Parsoid: Round-trip tables directly followed by content (bug 51219) +!! options +parsoid=wt2html,wt2wt +!! input +{| +|foo +|} bar + +{| +|baz +|}quux +!! result ++ ++ +
- a
++
bar ++ foo + +
quux +!! end + +!! test +Parsoid: Default to a newline after tables in new content (bug 51219) +!! options +parsoid=html2wt +!! input +{| +|foo +|} ++ baz bar +{| +|baz +|} +'''quux''' +!! result + +
bar +foo +
quux +!! end + ### ### Internal links ### @@ -3341,6 +4753,15 @@ Piped link !! end +!! test +Piped link with comment in link text +!! input +[[Main Page|The Main Page]] +!! result + +!! end + !! test Broken link !! input @@ -3462,6 +4883,22 @@ Link to namespaces !! end +!! article +MemoryAlpha:AlphaTest +!! text +This is an article in the MemoryAlpha namespace +(which shadows the memoryalpha interwiki link). +!! endarticle + +!! test +Namespace takes precedence over interwiki link (bug 51680) +!! input +[[MemoryAlpha:AlphaTest]] +!! result + +!! end + !! test Piped link to namespace !! input @@ -3526,6 +4963,33 @@ Link containing "<#" and ">#" as a hex sequences !! end +!! test +Link containing an equals sign +!! input +[[Special:BookSources/isbn=4-00-026157-6]] +!! result +baz Special:BookSources/isbn=4-00-026157-6 +
+!! end + +!! article +Foo~bar +!! text +Just a test of an article title containing a tilde. +!! endarticle + +# note that links containing signatures, like [[Foo~~~~]], are +# massaged by the pre-save transform (PST) and so the tildes are never +# seen by the parser. +!! test +Link containing a tilde +!! input +[[Foo~bar]] +!! result +Foo~bar +
+!! end + !! test Link containing double-single-quotes '' (bug 4598) !! input @@ -3787,6 +5251,69 @@ language=kaa !! end +!! article +Söfnuður +!! text +Test. +!! endarticle + +!! test +Internal link with is link prefix +!! options +language=is +!! input +Aðrir mótmælenda[[söfnuður|söfnuðir]] og +!! result +Aðrir mótmælendasöfnuðir og +
+!! end + +!! article +Mótmælendatrú +!! text +Test. +!! endarticle + +!! test +Internal link with is link trail and link prefix +!! options +language=is +!! input +[[mótmælendatrú|xxx]]ar +[[mótmælendatrú]]ar +mótmælenda[[söfnuður]] +mótmælenda[[söfnuður|söfnuðir]] +mótmælenda[[söfnuður|söfnuðir]]xxx +!! result +xxxar +mótmælendatrúar +mótmælendasöfnuður +mótmælendasöfnuðir +mótmælendasöfnuðirxxx +
+!! end + +!! test +Parsoid link trail escaping +!! options +parsoid=html2wt,html2html +!! input +[[apple]]s +!! result + +!! end + +!! test +Parsoid link prefix escaping +!! options +language=is +parsoid=html2wt,html2html +!! input +Aðrir mótmælenda [[söfnuður]] +!! result + Aðrir mótmælendasöfnuður
+!! end + !! test Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved !! input @@ -3833,9 +5360,12 @@ Interwiki link encoding conversion (bug 1636) *[[Wikipedia:ro:Olteniţa]] *[[Wikipedia:ro:Olteniţa]] !! result - + !! end @@ -3848,6 +5378,12 @@ Interwiki link with fragment (bug 2130) !! end + +### +### Interlanguage links +### Language links (so that searching for '### language' matches..) +### + !! test Interlanguage link !! input @@ -3905,21 +5441,206 @@ language=ln !! end -## -## XHTML tidiness -### - !! test -
to
+Parsoid bug 53221: Wikilinks should be properly entity-escaped +!! options +parsoid=html2wt !! input -1
2
3 -!! result -1
+He llo [[Foo|He llo]] + +He llo [[He llo]] +!!result +
2
3 -He llo He llo
+He llo He llo
!! end !! test -Broken br tag sanitization +Parsoid: handle constructor well +!! options +parsoid +!! input +[[constructor]] + +[[constructor:foo]] +!! result + + + + +!! end + +!! test +Parsoid: recognize interlanguage links without a target page +!! options +parsoid +!! input +[[ko:]] +!! result ++
+!! end + +!! test +Parsoid: recognize interwiki links without a target page +!! options +parsoid +!! input +[[:ko:]] +!! result + +!! end + +### +### Redirects, Parsoid-only +### +!! test +Simple redirect to page +!! options +parsoid +!! input +#REDIRECT [[Main Page]] +!! result + +!! end + +!! test +Optional colon in #REDIRECT +!! options +# the colon is archaic syntax. we support it for wt2html, but we +# don't care that it roundtrips back to the modern syntax. +parsoid=wt2html,html2html +!! input +#REDIRECT:[[Main Page]] +!! result + +!! end + +!! test +Whitespace in #REDIRECT with optional colon +!! options +# the colon and gratuitous whitespace is archaic syntax. we support +# it for wt2html, but we don't care that it roundtrips back to the +# modern syntax (without extra whitespace) +parsoid=wt2html,html2html +!! input + + #REDIRECT +: +[[Main Page]] +!! result + +!! end + +!! test +Piped link in #REDIRECT +!! options +# content after piped link is ignored. we support this syntax, +# but don't care that the piped link is lost when we roundtrip this. +parsoid=wt2html +!! input +#REDIRECT [[Main Page|bar]] +!! result + +!! end + +!! test +Redirect to category +!! options +parsoid=wt2html +!! input +#REDIRECT [[Category:Foo]] +!! result + +!! end + +!! test +Redirect to category with URL encoding +!! options +parsoid=wt2html +!! input +#REDIRECT [[Category%3AFoo]] +!! result + +!! end + +!! test +Redirect to category page +!! options +parsoid=wt2html,html2html +!! input +#REDIRECT [[:Category:Foo]] +!! result + +!! end + +!! test +Redirect to image page (1) +!! options +parsoid +!! input +#REDIRECT [[File:Wiki.png]] +!! result + +!! end + +!! test +Redirect to image page (2) +!! options +parsoid +!! input +#REDIRECT [[Image:Wiki.png]] +!! result + +!! end + +!! test +Redirect to language +!! options +parsoid +!! input +#REDIRECT [[en:File:Wiki.png]] +!! result + +!! end + +!! test +Redirect to interwiki +!! options +parsoid +!! input +#REDIRECT [[meatball:File:Wiki.png]] +!! result + +!! end + +!! test +Non-English #REDIRECT +!! options +parsoid +language=is +!! input +#TILVÍSUN [[Main Page]] +!! result + +!! end + +## +## XHTML tidiness +### + +!! test +
to
+!! input +1
2
3 +!! result +1
+!! end + +!! test +Broken br tag sanitization +!! options +php !! input !! result @@ -3927,6 +5648,17 @@ Broken br tag sanitization !! end +# TODO: Fix html2html mode (bug 51055)! +!! test +Parsoid: Broken br tag recognition +!! options +parsoid=wt2html +!! input + +!! result +
2
3 ++!! end + !! test Incorrecly removing closing slashes from correctly formed XHTML !! input @@ -4023,7 +5755,7 @@ Horizontal ruler -- eats additional dashes on the same line !! end !! test -Horizontal ruler -- does not collaps dashes on consecutive lines +Horizontal ruler -- does not collapse dashes on consecutive lines !! input ---- ---- @@ -4061,10 +5793,14 @@ Common list * item 2 *item 3 !! result -
+
- Common list -
- item 2 -
- item 3 -
+
!! end @@ -4075,10 +5811,14 @@ Numbered list #item 2 # item 3 !! result -- Common list +
+- item 2 +
+- item 3 +
++
- Numbered list -
- item 2 -
- item 3 -
+
!! end @@ -4101,35 +5841,67 @@ Mixed list *** Level 3 #** Level 3, but ordered !! result -- Numbered list +
+- item 2 +
+- item 3 +
+-
- Mixed list -
-
- with numbers -
-
- and bullets -
-
- and numbers -
- bullets again -
-
- bullet level 2 -
-
- bullet level 3 -
-
- Number on level 4 -
- bullet level 2 -
-
- Number on level 3 -
- Number on level 3 -
-
- number level 2 -
- Level 1 -
-
-
- Level 3 -
+
-
-
- Level 3, but ordered -
+
+- Mixed list +
++
+- with numbers +
++
+- and bullets +
++
+- and numbers +
+- bullets again +
++
+- bullet level 2 +
++
+- bullet level 3 +
++
+- Number on level 4 +
+- bullet level 2 +
++
+- Number on level 3 +
+- Number on level 3 +
++
+- number level 2 +
+- Level 1 +
++
+- +
+
+- Level 3 +
++
!! end @@ -4139,10 +5911,14 @@ Nested lists 1 *foo **bar !! result -- +
+
+- +
+
+- Level 3, but ordered +
++
- foo -
-
- bar -
+
!! end @@ -4152,10 +5928,15 @@ Nested lists 2 **foo *bar !! result -- foo +
++
+- bar +
++
-
- foo -
- bar -
+
!! end @@ -4165,10 +5946,14 @@ Nested lists 3 (first element empty) * **bar !! result -- +
+
+- foo +
+- bar +
++
- -
-
- bar -
+
!! end @@ -4178,10 +5963,15 @@ Nested lists 4 (first element empty) ** *bar !! result -- +
++
+- bar +
++
-
- -
- bar -
+
!! end @@ -4191,10 +5981,15 @@ Nested lists 5 (both elements empty) ** * !! result -- +
+
+- +
+- bar +
++
-
- -
- -
+
!! end @@ -4204,10 +5999,14 @@ Nested lists 6 (both elements empty) * ** !! result -- +
+
+- +
+- +
++
- -
-
- -
+
!! end @@ -4216,10 +6015,16 @@ Nested lists 7 (skip initial nesting levels) !! input *** foo !! result -- +
++
+- +
++
-
-
- foo -
+
!! end @@ -4231,16 +6036,24 @@ Nested lists 8 (multiple nesting transitions) ** baz * boo !! result -- +
+
+- +
+
+- foo +
+- -!! end - +
- foo -
-
-
- bar -
- baz -
- boo -
+
+ +!! end + !! test 1. Lists with start-of-line-transparent tokens before bullets: Comments !! input @@ -4248,10 +6061,14 @@ Nested lists 8 (multiple nesting transitions) *bar *baz !! result -- foo +
++
+- +
+
+- bar +
+- baz +
+- boo +
++
- foo -
- bar -
- baz -
+
!! end @@ -4261,78 +6078,14 @@ Nested lists 8 (multiple nesting transitions) *foo {{echo|bar }}*baz !! result -- foo +
+- bar +
+- baz +
+- -!! end - -!! test -Unbalanced closing block tags break a list -(Disabled since php parser generates broken html -- relies on Tidy to fix up) -!! options -disabled -!! input -
- foo bar -
- baz -
-*a-*b-!! result --
- a -
--!! end - -!! test -Unbalanced closing non-block tags don't break a list -(Disabled since php parser generates broken html -- relies on Tidy to fix up) -!! options -disabled -!! input - -*a -*b -!! result -
- b -
-
--!! end - -!! test -Unclosed formatting tags that straddle lists are closed and reopened -(Disabled since php parser generates broken html -- relies on Tidy to fix up) -!! options -disabled -!! input -#
- a -
- b -
a -# b-!! result --!! end - -!!test -List embedded in a non-block tag -(Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy) -!! options -parsoid -!!input - -* foo - -!!result - -
a-b--
- - -!!end + +!! end !! test List items are not parsed correctly following a- foo
+- foo bar +
+- baz +
block (bug 785) @@ -4341,10 +6094,14 @@ List items are not parsed correctly following ablock (bug 785) *bar* zar !! result -+
foo- bar-- zar -
+
!! end @@ -4363,18 +6120,30 @@ List items from template * notSOL{{inner list}} * item 2 !! result -- +
foo+- +
bar+- zar +
+-
- item 1 -
- item 2 -
-
- item 0 -
- item 1 -
- item 2 -
+
- item 0 -
- notSOL -
- item 1 -
- item 2 -
+
+- item 1 +
+- item 2 +
++
+- item 0 +
+- item 1 +
+- item 2 +
++
!! end @@ -4387,14 +6156,22 @@ List interrupted by empty line or heading == A heading == * Another list item !! result -- item 0 +
+- notSOL +
+- item 1 +
+- item 2 +
+-
- foo -
-
-
- bar -
[edit] A heading
-+
- Another list item -
+
+- foo +
++
+- +
+
+- bar +
+A heading[edit]
++
!!end @@ -4413,1629 +6190,2281 @@ Multiple list tags generated by templates !!end -### -### Magic Words -### +!!test +Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines +!!input +*a + +*b + +*c + +*d +!!result +- Another list item +
++
-!! test -Magic Word: {{CURRENTDAY}} -!! input -{{CURRENTDAY}} -!! result -- a +
+- b +
+- c +
+- d +
+1 -
-!! end +!!end -!! test -Magic Word: {{CURRENTDAY2}} -!! input -{{CURRENTDAY2}} -!! result -01 -
-!! end +!!test +Replacing whitespace with tabs still doesn't break the list (gerrit 78327) +!!input +*a + +*b + +*c + +*d +!!result ++
+ +!!end + +!!test +Test the li-hack +(Cannot test this with PHP parser since it relies on Tidy for the hack) +!!options +parsoid=wt2html,wt2wt +!!input +* foo +*- a +
+- b +
+- c +
+- d +
+li-hack +* {{echo| templated li-hack}} +* unsupported li-hack with preceding comments + + +
+!!result +- not a li-hack +
++
+ +- foo
+- li-hack
+- templated li-hack
+- +
- li-hack with preceding comments
++ +
+!!end !! test -Magic Word: {{CURRENTDAYNAME}} +Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines +!! options +parsoid !! input -{{CURRENTDAYNAME}} +# foo +## bar +* foo +** bar +: foo +:: bar !! result -- not a li-hack +
+Thursday -
++
- foo
++
- bar
++
- foo
++
- bar
++
!! end !! test -Magic Word: {{CURRENTDOW}} +Parsoid: Test of whitespace serialization with Templated bullets +!! options +parsoid !! input -{{CURRENTDOW}} +* {{bullet}} !! result -- foo
++
- bar
+4 -
++
!! end +# ------------------------------------------------------------------------ +# The next set of tests are about Parsoid's ability to handle badly nested +# tags (parse, minimize scope of fixup, and roundtrip back) +# ------------------------------------------------------------------------ + !! test -Magic Word: {{CURRENTMONTH}} +Unbalanced closing block tags break a list +(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up) +!! options +parsoid !! input -{{CURRENTMONTH}} +- Bar
++*a+*b!! result -01 -
+++
- a +
++!! end !! test -Magic Word: {{CURRENTMONTHABBREV}} +Unbalanced closing non-block tags don't break a list +(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up) +!! options +parsoid !! input -{{CURRENTMONTHABBREV}} + +*a +*b !! result -+
- b +
+Jan +
+
+
!! end !! test -Magic Word: {{CURRENTMONTHNAME}} +Unclosed formatting tags that straddle lists are closed and reopened +(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up) +!! options +parsoid !! input -{{CURRENTMONTHNAME}} +#- a +
+- b +
+a +# b!! result -January -
++
!! end -!! test -Magic Word: {{CURRENTMONTHNAMEGEN}} -!! input -{{CURRENTMONTHNAMEGEN}} -!! result -- +
a+- +
b+January -
-!! end +!!test +List embedded in a non-block tag +(Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy) +!! options +parsoid +!!input + +* foo + +!!result + + ++
+ + +!!end !! test -Magic Word: {{CURRENTTIME}} +Table with missing opening- foo
+tag +!! options +parsoid=wt2html,wt2wt !! input -{{CURRENTTIME}} + +
!! result -foo + +00:02 -
++
!! end +### +### Magic Words +### + +# Note that the current date is hard-coded as +# 1970-01-01T00:02:03Z (a Thursday) +# when running parser tests. The timezone is also fixed to GMT, so +# local date will be identical to current date. + !! test -Magic Word: {{CURRENTWEEK}} (@bug 4594) +Magic Word: {{CURRENTDAY}} !! input -{{CURRENTWEEK}} +{{CURRENTDAY}} !! result+ +foo +1
!! end !! test -Magic Word: {{CURRENTYEAR}} +Magic Word: {{CURRENTDAY2}} !! input -{{CURRENTYEAR}} +{{CURRENTDAY2}} !! result -1970 +
01
!! end !! test -Magic Word: {{FULLPAGENAME}} -!! options -title=[[User:Ævar Arnfjörð Bjarmason]] +Magic Word: {{CURRENTDAYNAME}} !! input -{{FULLPAGENAME}} +{{CURRENTDAYNAME}} !! result -User:Ævar Arnfjörð Bjarmason +
Thursday
!! end !! test -Magic Word: {{FULLPAGENAMEE}} -!! options -title=[[User:Ævar Arnfjörð Bjarmason]] +Magic Word: {{CURRENTDOW}} !! input -{{FULLPAGENAMEE}} +{{CURRENTDOW}} !! result -User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason +
4
!! end !! test -Magic Word: {{NAMESPACE}} -!! options -title=[[User:Ævar Arnfjörð Bjarmason]] +Magic Word: {{CURRENTMONTH}} !! input -{{NAMESPACE}} +{{CURRENTMONTH}} !! result -User +
01
!! end !! test -Magic Word: {{NAMESPACEE}} -!! options -title=[[User:Ævar Arnfjörð Bjarmason]] +Magic Word: {{CURRENTMONTH1}} !! input -{{NAMESPACEE}} +{{CURRENTMONTH1}} !! result -User +
1
!! end !! test -Magic Word: {{NAMESPACENUMBER}} -!! options -title=[[User:Ævar Arnfjörð Bjarmason]] +Magic Word: {{CURRENTMONTHABBREV}} !! input -{{NAMESPACENUMBER}} +{{CURRENTMONTHABBREV}} !! result -2 +
Jan
!! end !! test -Magic Word: {{NUMBEROFFILES}} +Magic Word: {{CURRENTMONTHNAME}} !! input -{{NUMBEROFFILES}} +{{CURRENTMONTHNAME}} !! result -2 +
January
!! end !! test -Magic Word: {{PAGENAME}} -!! options -title=[[User:Ævar Arnfjörð Bjarmason]] +Magic Word: {{CURRENTMONTHNAMEGEN}} !! input -{{PAGENAME}} +{{CURRENTMONTHNAMEGEN}} !! result -Ævar Arnfjörð Bjarmason +
January
!! end !! test -Magic Word: {{PAGENAME}} with metacharacters -!! options -title=[['foo & bar = baz']] +Magic Word: {{CURRENTTIME}} !! input -''{{PAGENAME}}'' +{{CURRENTTIME}} !! result -'foo & bar = baz' +
00:02
!! end !! test -Magic Word: {{PAGENAME}} with metacharacters (bug 26781) -!! options -title=[[*RFC 1234 http://example.com/]] +Magic Word: {{CURRENTHOUR}} !! input -{{PAGENAME}} +{{CURRENTHOUR}} !! result -*RFC 1234 http://example.com/ +
00
!! end !! test -Magic Word: {{PAGENAMEE}} -!! options -title=[[User:Ævar Arnfjörð Bjarmason]] +Magic Word: {{CURRENTWEEK}} (@bug 4594) !! input -{{PAGENAMEE}} +{{CURRENTWEEK}} !! result -%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason +
1
!! end !! test -Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781) -!! options -title=[[*RFC 1234 http://example.com/]] +Magic Word: {{CURRENTYEAR}} !! input -{{PAGENAMEE}} +{{CURRENTYEAR}} !! result -*RFC_1234_http://example.com/ +
1970
!! end !! test -Magic Word: {{REVISIONID}} +Magic Word: {{CURRENTTIMESTAMP}} !! input -{{REVISIONID}} +{{CURRENTTIMESTAMP}} !! result -1337 +
19700101000203
!! end !! test -Magic Word: {{SCRIPTPATH}} +Magic Words LOCAL (UTC) !! input -{{SCRIPTPATH}} +* {{LOCALMONTH}} +* {{LOCALMONTH1}} +* {{LOCALMONTHNAME}} +* {{LOCALMONTHNAMEGEN}} +* {{LOCALMONTHABBREV}} +* {{LOCALDAY}} +* {{LOCALDAY2}} +* {{LOCALDAYNAME}} +* {{LOCALYEAR}} +* {{LOCALTIME}} +* {{LOCALHOUR}} +* {{LOCALWEEK}} +* {{LOCALDOW}} +* {{LOCALTIMESTAMP}} !! result -/ +
+
+ +!! end + +!! test +Magic Word: {{FULLPAGENAME}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] +!! input +{{FULLPAGENAME}} +!! result +- 01 +
+- 1 +
+- January +
+- January +
+- Jan +
+- 1 +
+- 01 +
+- Thursday +
+- 1970 +
+- 00:02 +
+- 00 +
+- 1 +
+- 4 +
+- 19700101000203 +
+User:Ævar Arnfjörð Bjarmason
!! end !! test -Magic Word: {{SERVER}} +Magic Word: {{FULLPAGENAMEE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{SERVER}} +{{FULLPAGENAMEE}} !! result -User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
!! end !! test -Magic Word: {{SERVERNAME}} +Magic Word: {{TALKSPACE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{SERVERNAME}} +{{TALKSPACE}} !! result -example.org +
User talk
!! end !! test -Magic Word: {{SITENAME}} +Magic Word: {{TALKSPACE}}, same namespace +!! options +title=[[User talk:Ævar Arnfjörð Bjarmason]] !! input -{{SITENAME}} +{{TALKSPACE}} !! result -MediaWiki +
User talk
!! end !! test -Namespace 1 {{ns:1}} +Magic Word: {{TALKSPACE}}, main namespace +!! options +title=[[Parser Test]] !! input -{{ns:1}} +{{TALKSPACE}} !! resultTalk
!! end !! test -Namespace 1 {{ns:01}} +Magic Word: {{TALKSPACEE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{ns:01}} +{{TALKSPACEE}} !! result -Talk +
User_talk
!! end !! test -Namespace 0 {{ns:0}} (bug 4783) +Magic Word: {{SUBJECTSPACE}} +!! options +title=[[User talk:Ævar Arnfjörð Bjarmason]] !! input -{{ns:0}} +{{SUBJECTSPACE}} !! result +User +
+!! end +!! test +Magic Word: {{SUBJECTSPACE}}, same namespace +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] +!! input +{{SUBJECTSPACE}} +!! result +User +
!! end !! test -Namespace 0 {{ns:00}} (bug 4783) +Magic Word: {{SUBJECTSPACE}}, main namespace +!! options +title=[[Parser Test]] !! input -{{ns:00}} +{{SUBJECTSPACE}} !! result !! end !! test -Namespace -1 {{ns:-1}} +Magic Word: {{SUBJECTSPACEE}} +!! options +title=[[User talk:Ævar Arnfjörð Bjarmason]] !! input -{{ns:-1}} +{{SUBJECTSPACEE}} !! result -Special +
User
!! end !! test -Namespace User {{ns:User}} +Magic Word: {{NAMESPACE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{ns:User}} +{{NAMESPACE}} !! resultUser
!! end !! test -Namespace User talk {{ns:User_talk}} +Magic Word: {{NAMESPACEE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{ns:User_talk}} +{{NAMESPACEE}} !! result -User talk +
User
!! end !! test -Namespace User talk {{ns:uSeR tAlK}} +Magic Word: {{NAMESPACENUMBER}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{ns:uSeR tAlK}} +{{NAMESPACENUMBER}} !! result -User talk +
2
!! end !! test -Namespace File {{ns:File}} +Magic Word: {{SUBPAGENAME}} +!! options +title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage !! input -{{ns:File}} +{{SUBPAGENAME}} !! result -File +
sub ö
!! end !! test -Namespace File {{ns:Image}} +Magic Word: {{SUBPAGENAMEE}} +!! options +title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage !! input -{{ns:Image}} +{{SUBPAGENAMEE}} !! result -File +
sub_%C3%B6
!! end !! test -Namespace (lang=de) Benutzer {{ns:User}} +Magic Word: {{ROOTPAGENAME}} !! options -language=de +title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage !! input -{{ns:User}} +{{ROOTPAGENAME}} !! result -Benutzer +
Ævar Arnfjörð Bjarmason
!! end !! test -Namespace (lang=de) Benutzer Diskussion {{ns:3}} +Magic Word: {{ROOTPAGENAMEE}} !! options -language=de +title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage !! input -{{ns:3}} +{{ROOTPAGENAMEE}} !! result -Benutzer Diskussion +
%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
!! end - !! test -Urlencode +Magic Word: {{BASEPAGENAME}} +!! options +title=[[Ævar Arnfjörð Bjarmason/sub]] subpage !! input -{{urlencode:hi world?!}} -{{urlencode:hi world?!|WIKI}} -{{urlencode:hi world?!|PATH}} -{{urlencode:hi world?!|QUERY}} +{{BASEPAGENAME}} !! result -hi+world%3F%21 -hi_world%3F! -hi%20world%3F%21 -hi+world%3F%21 +
Ævar Arnfjörð Bjarmason
!! end -### -### Magic links -### !! test -Magic links: internal link to RFC (bug 479) +Magic Word: {{BASEPAGENAMEE}} +!! options +title=[[Ævar Arnfjörð Bjarmason/sub]] subpage !! input -[[RFC 123]] +{{BASEPAGENAMEE}} !! result -RFC 123 +
%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
!! end !! test -Magic links: RFC (bug 479) +Magic Word: {{TALKPAGENAME}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -RFC 822 +{{TALKPAGENAME}} !! result -RFC 822 +
User talk:Ævar Arnfjörð Bjarmason
!! end !! test -Magic links: ISBN (bug 1937) +Magic Word: {{TALKPAGENAMEE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -ISBN 0-306-40615-2 +{{TALKPAGENAMEE}} !! result -User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
!! end !! test -Magic links: PMID incorrectly converts space to underscore +Magic Word: {{SUBJECTPAGENAME}} +!! options +title=[[User talk:Ævar Arnfjörð Bjarmason]] !! input -PMID 1234 +{{SUBJECTPAGENAME}} !! result -User:Ævar Arnfjörð Bjarmason
!! end -### -### Templates -#### - !! test -Nonexistent template +Magic Word: {{SUBJECTPAGENAMEE}} +!! options +title=[[User talk:Ævar Arnfjörð Bjarmason]] !! input -{{thistemplatedoesnotexist}} +{{SUBJECTPAGENAMEE}} !! result -Template:Thistemplatedoesnotexist +
User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
!! end !! test -Template with invalid target containing tags +Magic Word: {{NUMBEROFFILES}} !! input -{{ab|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}} +{{NUMBEROFFILES}} !! result -{{ab|foo|a=b|a = b}} +
4
!! end !! test -Template with invalid target containing unclosed tag +Magic Word: {{PAGENAME}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{a|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}} +{{PAGENAME}} !! result -{{a|foo|a=b|a = b}} +
Ævar Arnfjörð Bjarmason
!! end -!! article -Template:test -!! text -This is a test template -!! endarticle - !! test -Simple template +Magic Word: {{PAGENAME}} with metacharacters +!! options +title=[['foo & bar = baz']] !! input -{{test}} +''{{PAGENAME}}'' !! result -This is a test template +
'foo & bar = baz'
!! end !! test -Template with explicit namespace +Magic Word: {{PAGENAME}} with metacharacters (bug 26781) +!! options +title=[[*RFC 1234 http://example.com/]] !! input -{{Template:test}} +{{PAGENAME}} !! result -This is a test template +
*RFC 1234 http://example.com/
!! end - -!! article -Template:paramtest -!! text -This is a test template with parameter {{{param}}} -!! endarticle - !! test -Template parameter +Magic Word: {{PAGENAMEE}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] !! input -{{paramtest|param=foo}} +{{PAGENAMEE}} !! result -This is a test template with parameter foo +
%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
!! end -!! article -Template:paramtestnum -!! text -[[{{{1}}}|{{{2}}}]] -!! endarticle - !! test -Template unnamed parameter +Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781) +!! options +title=[[*RFC 1234 http://example.com/]] !! input -{{paramtestnum|Main Page|the main page}} +{{PAGENAMEE}} !! result -*RFC_1234_http://example.com/
!! end -!! article -Template:templatesimple -!! text -(test) -!! endarticle - -!! article -Template:templateredirect -!! text -#redirect [[Template:templatesimple]] -!! endarticle - -!! article -Template:templateasargtestnum -!! text -{{{{{1}}}}} -!! endarticle - -!! article -Template:templateasargtest -!! text -{{template{{{templ}}}}} -!! endarticle - -!! article -Template:templateasargtest2 -!! text -{{{{{templ}}}}} -!! endarticle - !! test -Template with template name as unnamed argument +Magic Word: {{REVISIONID}} !! input -{{templateasargtestnum|templatesimple}} +{{REVISIONID}} !! result -(test) +
1337
!! end !! test -Template with template name as argument +Magic Word: {{SCRIPTPATH}} !! input -{{templateasargtest|templ=simple}} +{{SCRIPTPATH}} !! result -(test) +
/
!! end !! test -Template with template name as argument (2) +Magic Word: {{STYLEPATH}} !! input -{{templateasargtest2|templ=templatesimple}} +{{STYLEPATH}} !! result -(test) +
/skins
!! end -!! article -Template:templateasargtestdefault -!! text -{{{{{templ|templatesimple}}}}} -!! endarticle - -!! article -Template:templa -!! text -'''templ''' -!! endarticle - !! test -Template with default value +Magic Word: {{SERVER}} !! input -{{templateasargtestdefault}} +{{SERVER}} !! result -(test) +
!! end !! test -Template with default value (value set) +Magic Word: {{SERVERNAME}} !! input -{{templateasargtestdefault|templ=templa}} +{{SERVERNAME}} !! result -templ +
example.org
!! end !! test -Template redirect +Magic Word: {{SITENAME}} !! input -{{templateredirect}} +{{SITENAME}} !! result -(test) +
MediaWiki
!! end !! test -Template with argument in separate line +Case-sensitive magic words, when cased differently, should just be template transclusions !! input -{{ templateasargtest | - templ = simple }} +{{CurrentMonth}} +{{currentday}} +{{cURreNTweEK}} +{{currentHour}} !! result -(test) +
Template:CurrentMonth +Template:Currentday +Template:CURreNTweEK +Template:CurrentHour
!! end !! test -Template with complex template as argument +Case-insensitive magic words should still work with weird casing. !! input -{{paramtest| - param ={{ templateasargtest | - templ = simple }}}} +{{sErVeRNaMe}} +{{LCFirst:AOEU}} +{{ucFIRST:aoeu}} +{{SERver}} !! result -This is a test template with parameter (test) +
example.org +aOEU +Aoeu +http://example.org
!! end !! test -Template with thumb image (with link in description) +Namespace 1 {{ns:1}} !! input -{{paramtest| - param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}} +{{ns:1}} !! result -This is a test template with parameter - +Talk +
!! end -!! article -Template:complextemplate -!! text -{{{1}}} {{paramtest| - param ={{{param}}}}} -!! endarticle - !! test -Template with complex arguments +Namespace 1 {{ns:01}} !! input -{{complextemplate| - param ={{ templateasargtest | - templ = simple }}|[[Template:complextemplate|link]]}} +{{ns:01}} !! result -link This is a test template with parameter (test) +
Talk
!! end !! test -BUG 553: link with two variables in a piped link +Namespace 0 {{ns:0}} (bug 4783) !! input -{| -|[[{{{1}}}|{{{2}}}]] -|} +{{ns:0}} !! result --
!! end !! test -Magic variable as template parameter +Namespace 0 {{ns:00}} (bug 4783) !! input -{{paramtest|param={{SITENAME}}}} +{{ns:00}} !! result -- [[{{{1}}}|{{{2}}}]] - This is a test template with parameter MediaWiki -
-!! end -!! article -Template:linktest -!! text -[[{{{param}}}|link]] -!! endarticle +!! end !! test -Template parameter as link source +Namespace -1 {{ns:-1}} !! input -{{linktest|param=Main Page}} +{{ns:-1}} !! result -link +
Special
!! end -!!test -Template-generated attribute string (k='v') -!!input -bar -!!result -bar +!! test +Namespace User {{ns:User}} +!! input +{{ns:User}} +!! result +
User
-!!end - -!!article -Template:paramtest2 -!! text -including another template, {{paramtest|param={{{arg}}}}} -!! endarticle +!! end !! test -Template passing argument to another template +Namespace User talk {{ns:User_talk}} !! input -{{paramtest2|arg='hmm'}} +{{ns:User_talk}} !! result -including another template, This is a test template with parameter 'hmm' +
User talk
!! end -!! article -Template:Linktest2 -!! text -Main Page -!! endarticle - !! test -Template as link source +Namespace User talk {{ns:uSeR tAlK}} !! input -[[{{linktest2}}]] - -[[{{linktest2}}|Main Page]] - -[[{{linktest2}}]]Page +{{ns:uSeR tAlK}} !! result -Main PagePage +
User talk
!! end +!! test +Namespace File {{ns:File}} +!! input +{{ns:File}} +!! result +File +
+!! end -!! article -Template:loop1 -!! text -{{loop2}} -!! endarticle - -!! article -Template:loop2 -!! text -{{loop1}} -!! endarticle +!! test +Namespace File {{ns:Image}} +!! input +{{ns:Image}} +!! result +File +
+!! end !! test -Template infinite loop +Namespace (lang=de) Benutzer {{ns:User}} +!! options +language=de !! input -{{loop1}} +{{ns:User}} !! result -Template loop detected: Template:Loop1 +
Benutzer
!! end !! test -Template from main namespace +Namespace (lang=de) Benutzer Diskussion {{ns:3}} +!! options +language=de !! input -{{:Main Page}} +{{ns:3}} !! result -blah blah +
Benutzer Diskussion
!! end -!! article -Template:table -!! text -{| -| 1 || 2 -|- -| 3 || 4 -|} -!! endarticle !! test -BUG 529: Template with table, not included at beginning of line +Urlencode !! input -foo {{table}} +{{urlencode:hi world?!}} +{{urlencode:hi world?!|WIKI}} +{{urlencode:hi world?!|PATH}} +{{urlencode:hi world?!|QUERY}} !! result -foo +
hi+world%3F%21 +hi_world%3F! +hi%20world%3F%21 +hi+world%3F%21
--
+!! end +### +### Magic links +### +!! test +Magic links: internal link to RFC (bug 479) +!! input +[[RFC 123]] +!! result +- -1 -2 - - 3 -4 - RFC 123 +
!! end !! test -BUG 523: Template shouldn't eat newline (or add an extra one before table) +Magic links: RFC (bug 479) !! input -foo -{{table}} +RFC 822 !! result -foo +
--
+!! end +!! test +Magic links: ISBN (bug 1937) +!! input +ISBN 0-306-40615-2 +!! result + !! end !! test -BUG 41: Template parameters shown as broken links +Magic links: PMID incorrectly converts space to underscore !! input -{{{parameter}}} +PMID 1234 !! result -- -1 -2 - - 3 -4 - {{{parameter}}} +
!! end +### +### Templates +#### + !! test -Template with targets containing wikilinks +Nonexistent template !! input -{{[[foo]]}} +{{thistemplatedoesnotexist}} +!! result +Template:Thistemplatedoesnotexist +
+!! end -{{[[{{echo|foo}}]]}} +!! 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 -{{{{echo|[[foo}}]]}} +!! test +Template with invalid target containing unclosed tag +!! input +{{a|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}} !! result -{{foo}} -
{{foo}} -
{{[[foo}}]] +
{{a|foo|a=b|a = b}}
!! end !! article -Template:MSGNW test +Template:test !! text -''None'' of '''this''' should be -* interpreted - but rather passed unmodified -{{test}} +This is a test template !! endarticle -# hmm, fix this or just deprecate msgnw and document its behavior? !! test -msgnw keyword -!! options -disabled +Simple template !! input -{{msgnw:MSGNW test}} -!! result -''None'' of '''this''' should be -* interpreted - but rather passed unmodified {{test}} +!! result +
This is a test template
!! end !! test -int keyword +Template with explicit namespace !! input -{{int:youhavenewmessages|lots of money|not!}} +{{Template:test}} !! result -You have lots of money (not!). +
This is a test template
!! end + !! article -Template:Includes +Template:paramtest !! text -Foozar bar +This is a test template with parameter {{{param}}} !! endarticle !! test -and -|d -|} -!!result -being included +Template parameter !! input -{{Includes}} +{{paramtest|param=foo}} !! result - Foobar +
This is a test template with parameter foo
!! end !! article -Template:Includes2 +Template:paramtestnum !! text -Foo bar +[[{{{1}}}|{{{2}}}]] !! endarticle !! test -being included +Template unnamed parameter !! input -{{Includes2}} +{{paramtestnum|Main Page|the main page}} !! result - Foo +
!! end +!! article +Template:templatesimple +!! text +(test) +!! endarticle + +!! article +Template:templateredirect +!! text +#redirect [[Template:templatesimple]] +!! endarticle !! article -Template:Includes3 +Template:templateasargtestnum !! text -Foo barzar +{{{{{1}}}}} +!! endarticle + +!! article +Template:templateasargtest +!! text +{{template{{{templ}}}}} +!! endarticle + +!! article +Template:templateasargtest2 +!! text +{{{{{templ}}}}} !! endarticle !! test -and being included +Template with template name as unnamed argument !! input -{{Includes3}} +{{templateasargtestnum|templatesimple}} !! result - Foo +
(test)
!! end !! test -and on a page +Template with template name as argument !! input -Foo -|czar bar +{{templateasargtest|templ=simple}} !! result -Foozar +
(test)
!! end !! test -Un-closed+Template with template name as argument (2) !! input - +{{templateasargtest2|templ=templatesimple}} !! result + -|b(test) +
!! end +!! article +Template:templateasargtestdefault +!! text +{{{{{templ|templatesimple}}}}} +!! endarticle + +!! article +Template:templa +!! text +'''templ''' +!! endarticle + !! test -on a page +Template with default value !! input - Foo bar +{{templateasargtestdefault}} !! result -Foobar +
(test)
!! end !! test -Un-closed+Template with default value (value set) !! input - +{{templateasargtestdefault|templ=templa}} !! result + templ +
!! end -!!test -Self-closed noinclude, includeonly, onlyinclude tags -!!input -- - -!!result -
+!! test +Template redirect +!! input +{{templateredirect}} +!! result +(test)
-!!end - -!!test -Unbalanced includeonly and noinclude tags -!!input -{| -|a-
- -!!end - -!! article -Template:Includeonly section -!! text -- a - -b - -c</includeonly> - -d</includeonly></includeonly> - -==Includeonly section== - -==Section T-1== -!!endarticle +!! end !! test -Bug 6563: Edit link generation for section shown by+Template with argument in separate line !! input -{{includeonly section}} +{{ templateasargtest | + templ = simple }} !! result - [edit] Includeonly section
-[edit] Section T-1
- +(test) +
!! end -# Uses same input as the contents of [[Template:Includeonly section]] !! test -Bug 6563: Section extraction for section shown by-!! options -section=T-2 +Template with complex template as argument !! input - -==Includeonly section== - -==Section T-2== +{{paramtest| + param ={{ templateasargtest | + templ = simple }}}} !! result -==Section T-2== +This is a test template with parameter (test) +
!! end !! test -Bug 6563: Edit link generation for section suppressed by+Template with thumb image (with link in description) !! input - -==Includeonly section== - -==Section 1== +{{paramtest| + param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}} !! result -[edit] Section 1
+This is a test template with parameter !! end +!! article +Template:complextemplate +!! text +{{{1}}} {{paramtest| + param ={{{param}}}}} +!! endarticle + !! test -Bug 6563: Section extraction for section suppressed by-!! options -section=1 +Template with complex arguments !! input - -==Includeonly section== - -==Section 1== +{{complextemplate| + param ={{ templateasargtest | + templ = simple }}|[[Template:complextemplate|link]]}} !! result -==Section 1== +link This is a test template with parameter (test) +
!! end !! test -Un-closed+BUG 553: link with two variables in a piped link !! input - +|} !!result -+{| +|[[{{{1}}}|{{{2}}}]] +|} !! result + +
+ !! end -### -###+ [[{{{1}}}|{{{2}}}]] + and in attributes -### -!!test -0. includeonly around the entire attribute -!!input -id="v1" id="v2" >bar -!!result -bar +!! test +Magic variable as template parameter +!! input +{{paramtest|param={{SITENAME}}}} +!! result +
This is a test template with parameter MediaWiki
-!!end +!! end -!!test -1. includeonly in html attr key -!!input -idabout ="foo">bar -!!result -bar +!! article +Template:linktest +!! text +[[{{{param}}}|link]] +!! endarticle + +!! test +Template parameter as link source +!! input +{{linktest|param=Main Page}} +!! result +
-!!end +!! end !!test -2. includeonly in html attr value +Template-generated attribute string (k='v') !!input -bar -"v1""v2" >bar +bar !!resultbar -bar
!!end -!!test -3. includeonly in part of an attr value -!!input -bar -!!result -bar -
-!!end +!!article +Template:paramtest2 +!! text +including another template, {{paramtest|param={{{arg}}}}} +!! endarticle -### -### Testing parsing of templates where a template arg -### has the same name as the template itself. -### +!! test +Template passing argument to another template +!! input +{{paramtest2|arg='hmm'}} +!! result +including another template, This is a test template with parameter 'hmm' +
+!! end !! article -Template:quote +Template:Linktest2 !! text -{{{quote|{{{1}}}}}} +Main Page !! endarticle -!!test -Templates: Template Name/Arg clash: 1. Use of positional param -!!input -{{quote|foo}} -!!result -foo -
-!!end +!! test +Template as link source +!! input +[[{{linktest2}}]] -!!test -Templates: Template Name/Arg clash: 2. Use of named param -!!input -{{quote|quote=foo}} -!!result -foo -
-!!end +[[{{linktest2}}|Main Page]] -!!test -Templates: Template Name/Arg clash: 3. Use of named param with empty input -!!input -{{quote|quote}} -!!result -quote +[[{{linktest2}}]]Page +!! result +
Main PagePage
-!!end +!! end -### -### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged -### -!!test -Templates: 1. Simple use -!!input -{{echo|Foo}} -!!result -Foo -
-!!end - -!!test -Templates: 2. Inside a block tag -!!input -{{echo|Foo}}-!!result -Foo+!! article +Template:loop1 +!! text +{{loop2}} +!! endarticle -!!end +!! article +Template:loop2 +!! text +{{loop1}} +!! endarticle -!!test -Templates: P-wrapping: 1a. Templates on consecutive lines -!!input -{{echo|Foo}} -{{echo|bar}} -!!result -Foo -bar +!! test +Template infinite loop +!! input +{{loop1}} +!! result +
Template loop detected: Template:Loop1
-!!end - -!!test -Templates: P-wrapping: 1b. Templates on consecutive lines -!!input -Foo +!! end -{{echo|bar}} -{{echo|baz}} -!!result -Foo -
bar -baz +!! test +Template from main namespace +!! input +{{:Main Page}} +!! result +
blah blah
-!!end +!! end -!!test -Templates: P-wrapping: 1c. Templates on consecutive lines -!!input -{{echo|Foo}} -{{echo|bar}}baz-!!result -Foo +!! article +Template:table +!! text +{| +| 1 || 2 +|- +| 3 || 4 +|} +!! endarticle + +!! test +BUG 529: Template with table, not included at beginning of line +!! input +foo {{table}} +!! result +
foo
-barbaz++
-!!end +!! end -!!test -Templates: Inline Text: 1. Multiple tmeplate uses -!!input -{{echo|Foo}}bar{{echo|baz}} -!!result -+ +1 +2 + + 3 +4 + Foobarbaz +!! test +BUG 523: Template shouldn't eat newline (or add an extra one before table) +!! input +foo +{{table}} +!! result +
foo
-!!end ++
-!!test -Templates: Inline Text: 2. Back-to-back template uses -!!input -{{echo|Foo}}{{echo|bar}} -!!result -+ +1 +2 + + 3 +4 + Foobar +!! end + +!! test +BUG 41: Template parameters shown as broken links +!! input +{{{parameter}}} +!! result +
{{{parameter}}}
-!!end +!! end -!!test -Templates: Block Tags: 1. Multiple template uses -!!input -{{echo|Foo}}bar{{echo|baz}} -!!result -Foobarbaz+!! test +Template with targets containing wikilinks +!! input +{{[[foo]]}} -!!end +{{[[{{echo|foo}}]]}} -!!test -Templates: Block Tags: 2. Back-to-back template uses -!!input -{{echo|Foo}}{{echo|bar}} -!!result -Foobar+{{{{echo|[[foo}}]]}} +!! result +{{foo}} +
{{foo}} +
{{[[foo}}]] +
+!! end -!!end +!! article +Template:MSGNW test +!! text +''None'' of '''this''' should be +* interpreted + but rather passed unmodified +{{test}} +!! endarticle -!!test -Templates: Links: 1. Simple example -!!input -{{echo|[[Foo|bar]]}} -!!result -bar +# hmm, fix this or just deprecate msgnw and document its behavior? +!! test +msgnw keyword +!! options +disabled +!! input +{{msgnw:MSGNW test}} +!! result +
''None'' of '''this''' should be +* interpreted + but rather passed unmodified +{{test}}
-!!end +!! end -!!test -Templates: Links: 2. Generation of link href -!!input -[[{{echo|Foo}}|bar]] -!!result -bar +!! test +int keyword +!! input +{{int:youhavenewmessages|lots of money|not!}} +!! result +
You have lots of money (not!).
-!!end - -!!test -Templates: Links: 3. Generation of part of a link href -!!input -[[Fo{{echo|o}}|bar]] - -[[Foo{{echo|bar}}]] +!! end -[[Foo{{echo|bar}}baz]] +!! article +Template:Includes +!! text +Foozar bar +!! endarticle -[[Foo{{echo|bar}}|bar]] +!! test +and +|dbeing included +!! input +{{Includes}} +!! result + Foobar +
+!! end -[[:Foo{{echo|bar}}]] +!! article +Template:Includes2 +!! text +Foo bar +!! endarticle -[[:Foo{{echo|bar}}|bar]] -!!result -bar -
Foobar -
bar -
Foobar -
bar +!! test +
being included +!! input +{{Includes2}} +!! result + Foo
-!!end +!! end -!!test -Templates: Links: 4. Multiple templates generating link href -!!input -[[{{echo|F}}{{echo|o}}ob{{echo|ar}}]] -!!result -Foobar -
-!!end -!!test -Templates: Links: 5. Generation of link text -!!input -[[Foo|{{echo|bar}}]] -!!result -bar +!! article +Template:Includes3 +!! text +
Foo barzar +!! endarticle + +!! test +and being included +!! input +{{Includes3}} +!! result + Foo
-!!end +!! end + +!! test +and on a page +!! input +Foo +|czar bar +!! result +Foozar +
+!! end + +!! test +Un-closed+!! input + +!! result +!! end + +!! test + +|bon a page +!! input + Foo bar +!! result +Foobar +
+!! end + +!! test +Un-closed+!! input + +!! result +!! end !!test -Templates: Links: 5. Nested templates (only outermost template should be marked) +Self-closed noinclude, includeonly, onlyinclude tags !!input -{{echo|[[{{echo|Foo}}|bar]]}} + + + !!result - bar +
!!end !!test -Templates: HTML Tag: 1. Generation of HTML attr. key +Unbalanced includeonly and noinclude tags !!input -
foo+{| +|afoo++
!!end -!!test -Templates: HTML Tag: 2. Generation of HTML attr. value -!!input -+ a + +b + +c</includeonly> + +d</includeonly></includeonly> + foo-!!result -foo+!! article +Template:Includeonly section +!! text ++==Includeonly section== + +==Section T-1== +!!endarticle + +!! test +Bug 6563: Edit link generation for section shown by+!! input +{{includeonly section}} +!! result + Includeonly section[edit]
+Section T-1[edit]
+ +!! end + +# Uses same input as the contents of [[Template:Includeonly section]] +!! test +Bug 6563: Section extraction for section shown by+!! options +section=T-2 +!! input + +==Includeonly section== + +==Section T-2== +!! result +==Section T-2== +!! end + +!! test +Bug 6563: Edit link generation for section suppressed by+!! input + +==Includeonly section== + +==Section 1== +!! result +Section 1[edit]
+ +!! end + +!! test +Bug 6563: Section extraction for section suppressed by+!! options +section=1 +!! input + +==Includeonly section== + +==Section 1== +!! result +==Section 1== +!! end + +!! test +Un-closed+!! input + +!! result +!! end + +# TODO: test with DOM fragment reuse! +!! test +Parsoid: DOM fragment reuse +!! options +parsoid=wt2wt,wt2html +!! input +a{{echo|b c}}d + +a{{echo|b +
+c}}d + +{{echo|a + +
+ +b}} +!! result +ab +
cd + + +
ab
+ ++ +
cd
-!!end +a
+ + ++ + +
b
+!! end + +!! test +Parsoid: Merge double tds (bug 50603) +!! options +parsoid +!! input +{| +|{{echo|{{!}} foo}} +|} +!! result ++
+!! end + +!! test +Parsoid: Merge double tds in nested transclusion content (bug 50603) +!! options +parsoid +!! input +{{echo|+ foo }} +{| +|{{echo|{{!}} foo}} +|} +{{echo|}} +!! result +++!! end + +### +###+
++ foo and in attributes +### !!test -Templates: HTML Tag: 3. Generation of HTML attr key and value +0. includeonly around the entire attribute !!input - foo+id="v1"id="v2" >bar !!result -foo- +bar +
!!end !!test -Templates: HTML Tag: 4. Generation of starting piece of HTML attr value +1. includeonly in html attr key !!input -foo+idabout ="foo">bar !!result -foo- +bar +
!!end !!test -Templates: HTML Tag: 5. Generation of middle piece of HTML attr value +2. includeonly in html attr value !!input -foo+bar +"v1""v2" >bar !!result -foo- +bar +bar +
!!end !!test -Templates: HTML Tag: 6. Generation of end piece of HTML attr value +3. includeonly in part of an attr value !!input -foo+bar !!result -foo- +bar +
!!end +### +### Testing parsing of templates where a template arg +### has the same name as the template itself. +### + +!! article +Template:quote +!! text +{{{quote|{{{1}}}}}} +!! endarticle + !!test -Templates: HTML Tables: 1. Generating start of a HTML table +Templates: Template Name/Arg clash: 1. Use of positional param !!input -{{echo|+{{quote|foo}} !!result -
foo }}- +
foo foo +
!!end !!test -Templates: HTML Tables: 2a. Generating middle of a HTML table +Templates: Template Name/Arg clash: 2. Use of named param !!input -+{{quote|quote=foo}} !!result -
{{echo| foo }}- +
foo foo +
!!end !!test -Templates: HTML Tables: 2b. Generating middle of a HTML table +Templates: Template Name/Arg clash: 3. Use of named param with empty input !!input -{{echo|
+{{quote|quote}} !!result -}} foo - +
foo quote +
!!end +### +### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged +### + !!test -Templates: HTML Tables: 3. Generating end of a HTML table +Templates: 1. Simple use !!input -}} +{{echo|Foo}} !!result -
{{echo| foo - +
foo Foo +
!!end !!test -Templates: HTML Tables: 4a. Generating a single tag of a HTML table +Templates: 2. Inside a block tag !!input -{{echo|}}
+foo {{echo|Foo}}+{{echo|Foo}}!!result -+
foo Foo+Foo!!end !!test -Templates: HTML Tables: 4b. Generating a single tag of a HTML table +Templates: P-wrapping: 1a. Templates on consecutive lines !!input -{{echo|
+{{echo|Foo}} +{{echo|bar}} !!result -}} foo +
foo Foo +bar +
+!!end + +!!test +Templates: P-wrapping: 1b. Templates on consecutive lines +!!input +Foo +{{echo|bar}} +{{echo|baz}} +!!result +Foo +
bar +baz +
!!end !!test -Templates: HTML Tables: 4c. Generating a single tag of a HTML table +Templates: P-wrapping: 1c. Templates on consecutive lines !!input -+{{echo|Foo}} +{{echo|bar}}
{{echo| }}foo baz!!result -+
foo Foo +
+barbaz!!end !!test -Templates: HTML Tables: 4d. Generating a single tag of a HTML table +Templates: P-wrapping: 1d. Template preceded by comment-only line +!!options +parsoid !!input -+ +{{echo|Bar}} !!result -
foo{{echo| }}+ +
foo Bar
!!end !!test -Templates: HTML Tables: 4e. Generating a single tag of a HTML table +Templates: Inline Text: 1. Multiple tmeplate uses !!input -+{{echo|Foo}}bar{{echo|baz}} !!result -
}} foo {{echo|+
foo Foobarbaz +
+!!end +!!test +Templates: Inline Text: 2. Back-to-back template uses +!!input +{{echo|Foo}}{{echo|bar}} +!!result +Foobar +
!!end !!test -Templates: HTML Tables: 4f. Generating a single tag of a HTML table +Templates: Block Tags: 1. Multiple template uses !!input -}} +{{echo|
{{echo| foo Foo}}bar{{echo|baz}} !!result -+
foo Foobarbaz!!end !!test -Templates: Wiki Tables: 1a. Fostering of entire template content +Templates: Block Tags: 2. Back-to-back template uses !!input -{| -{{echo|a}} -|} +{{echo|Foo}}{{echo|bar}} !!result --a -
+ Foobar!!end !!test -Templates: Wiki Tables: 1b. Fostering of entire template content +Templates: Links: 1. Simple example !!input -{| -{{echo|}} -foo -{{echo|}} -|} +{{echo|[[Foo|bar]]}} !!result --
+!!end +!!test +Templates: Links: 2. Generation of link href +!!input +[[{{echo|Foo}}|bar]] +!!result +--foo +
-bar +
!!end !!test -Templates: Wiki Tables: 2. Fostering of partial template content +Templates: Links: 3. Generation of part of a link href !!input -{| -{{echo|a -b}} -|} +[[Fo{{echo|o}}|bar]] + +[[Foo{{echo|bar}}]] + +[[Foo{{echo|bar}}baz]] + +[[Foo{{echo|bar}}|bar]] + +[[:Foo{{echo|bar}}]] + +[[:Foo{{echo|bar}}|bar]] !!result --a -
+b-bar +
Foobar +
bar +
Foobar +
bar +
+!!end +!!test +Templates: Links: 4. Multiple templates generating link href +!!input +[[{{echo|F}}{{echo|o}}ob{{echo|ar}}]] +!!result +Foobar +
!!end !!test -Templates: Wiki Tables: 3. td-content via multiple templates +Templates: Links: 5. Generation of link text !!input -{| -{{echo|{{pipe}}a}}{{echo|b}} -|} +[[Foo|{{echo|bar}}]] !!result --
+- ab - bar +
+!!end +!!test +Templates: Links: 5. Nested templates (only outermost template should be marked) +!!input +{{echo|[[{{echo|Foo}}|bar]]}} +!!result +bar +
!!end !!test -Templates: Wiki Tables: 4. Templated tags, no content +Templates: HTML Tag: 1. Generation of HTML attr. key !!input -{{tbl-start}} -{{tbl-end}} +foo!!result --
+ foo!!end !!test -Templates: Wiki Tables: 5. Templated tags, regular td-tags +Templates: HTML Tag: 2. Generation of HTML attr. value !!input -{{tbl-start}} -|foo -{{tbl-end}} +foo!!result --
+- foo - foo!!end !!test -Templates: Wiki Tables: 6. Templated tags, templated td-tags +Templates: HTML Tag: 3. Generation of HTML attr key and value !!input -{{tbl-start}} -{{!}}foo -{{tbl-end}} +foo!!result --
+- foo - foo!!end !!test -Templates: Lists: Multi-line list-items via templates +Templates: HTML Tag: 4. Generation of starting piece of HTML attr value !!input -*{{echo|a {{nonexistent| -unused}}}} -*{{echo|b {{nonexistent| -unused}}}} +foo!!result - +foo!!end !!test -Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo) +Templates: HTML Tag: 5. Generation of middle piece of HTML attr value !!input -{{echo|''a}}{{echo|b''c''d}}{{echo|''e}} +foo!!result -abcde -
+foo+ !!end !!test -Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span) -(PHP parser generates misnested html) -!! options -disabled +Templates: HTML Tag: 6. Generation of end piece of HTML attr value !!input -{{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}} +foo!!result -abcde
+foo+ !!end !!test -Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div) -(PHP parser generates misnested html) -!! options -disabled +Templates: HTML Tag: 7. Generation of partial attribute key string !!input -{{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}} +foo!!result -a-bcd-e+foo+ !!end !!test -Templates: Ugly nesting: 4. Divs opened/closed across templates +Templates: HTML Tables: 1. Generating start of a HTML table !!input -ab{{echo|cd}}e +{{echo|!!result -a
foo }}bcde +!!end !!test -Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting -(Parsoid-centric) -!! options -parsoid +Templates: HTML Tables: 2a. Generating middle of a HTML table !!input -{| -|{{echo|foo}} -|bar -|} +
foo !!result -
{{echo| foo }}-
-bar - +foo + !!end !!test -Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting -(Parsoid-centric) -!! options +Templates: HTML Tables: 2b. Generating middle of a HTML table +!!input +
foo {{echo|
+!!result +}} foo + +!!end + +!!test +Templates: HTML Tables: 3. Generating end of a HTML table +!!input +
foo }} +!!result +
{{echo| foo + +!!end + +!!test +Templates: HTML Tables: 4a. Generating a single tag of a HTML table +!!input +{{echo|
foo }}
+!!result +foo + +!!end + +!!test +Templates: HTML Tables: 4b. Generating a single tag of a HTML table +!!input +
foo {{echo|
+!!result +}} foo + +!!end + +!!test +Templates: HTML Tables: 4c. Generating a single tag of a HTML table +!!input +
foo +!!result +
{{echo| }}foo + +!!end + +!!test +Templates: HTML Tables: 4d. Generating a single tag of a HTML table +!!input +
foo +!!result +
foo{{echo| }}+ +!!end + +!!test +Templates: HTML Tables: 4e. Generating a single tag of a HTML table +!!input +
foo +!!result +
}} foo {{echo|+ +!!end + +!!test +Templates: HTML Tables: 4f. Generating a single tag of a HTML table +!!input +
foo }} +!!result +
{{echo| foo + +!!end + +!!test +Templates: HTML Tables: 5. Proper fostering of categories from inside +!!options +parsoid=wt2html,wt2wt +!!input +
foo [[Category:foo1]]
+ +foo [[Category:bar1]][[Category:bar2]]
+!!result +foo + +
foo +!!end + +!!test +Templates: Wiki Tables: 1a. Fostering of entire template content +!!input +{| +{{echo|a}} +|} +!!result +
foo +a +
+ +!!end + +!!test +Templates: Wiki Tables: 1b. Fostering of entire template content +!!input +{| +{{echo| }} +foo +{{echo|}} +|} +!!result ++
+ +!!end + +!!test +Templates: Wiki Tables: 2. Fostering of partial template content +!!input +{| +{{echo|a +++foo +
+ b}} +|} +!!result ++a +
+ +!!end + +!!test +Templates: Wiki Tables: 3. td-content via multiple templates +!!input +{| +{{echo|{{pipe}}a}}{{echo|b}} +|} +!!result +b++
+ +!!end + +!!test +Templates: Wiki Tables: 4. Templated tags, no content +!!input +{{tbl-start}} +{{tbl-end}} +!!result ++ ab + +
+ +!!end + +!!test +Templates: Wiki Tables: 5. Templated tags, regular td-tags +!!input +{{tbl-start}} +|foo +{{tbl-end}} +!!result ++
+ +!!end + +!!test +Templates: Wiki Tables: 6. Templated tags, templated td-tags +!!input +{{tbl-start}} +{{!}}foo +{{tbl-end}} +!!result ++ foo + +
+ +!!end + +!!test +Templates: Lists: Multi-line list-items via templates +!!input +*{{echo|a {{nonexistent| +unused}}}} +*{{echo|b {{nonexistent| +unused}}}} +!!result ++ foo + +
+ +!!end + +!!test +Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo) +!!input +{{echo|''a}}{{echo|b''c''d}}{{echo|''e}} +!!result +- a Template:Nonexistent +
+- b Template:Nonexistent +
+abcde +
+!!end + +!!test +Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span) +(PHP parser generates misnested html) +!! options +parsoid +!!input +{{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}} +!!result +abcde
+!!end + +!!test +Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div) +(PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s) +!! options +parsoid=wt2html,wt2wt +!!input +{{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}} +!!result +a+bcd+e+!!end + +!!test +Templates: Ugly nesting: 4. Divs opened/closed across templates +!!input +ab{{echo|cd}}e +!!result +abcde + +!!end + +!!test +Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting +(Parsoid-centric) +!! options +parsoid +!!input +{| +|{{echo|foo}} +|bar +|} +!!result ++ + +
+bar + +!!end + +!!test +Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting +(Parsoid-centric) +!! options parsoid !!input+ foo @@ -6058,24 +8487,24 @@ parsoid
!!result --
- - - abc - - - - - - xyz - +- - --
- 1. foo bar -2. baz +
+ + + abc + + + + + + xyz + !!end @@ -6237,10 +8666,13 @@ wiki+ + ++
+ 1. foo bar +2. baz nowiki But just in case it doesn't... !! result - [edit] =
+=[edit]
The line above must have a trailing space!
-[edit] =
+=[edit]
But just in case it doesn't...
!! end @@ -7811,7 +10836,7 @@ section 5 !! resultThe tooltips shall not show entities to the user (ie. be double escaped)
--
+Contents
Contents
-
- 1 text > text
- 2 text < text
@@ -7819,20 +10844,21 @@ section 5- 4 text ' text
- 5 text " text
[edit] text > text
+ + +text > text[edit]
section 1
-[edit] text < text
+text < text[edit]
section 2
-[edit] text & text
+text & text[edit]
section 3
-[edit] text ' text
+text ' text[edit]
section 4
-[edit] text " text
+text " text[edit]
section 5
!! end @@ -7846,18 +10872,59 @@ Headers with excess '=' characters =''italic'' heading== ==''italic'' heading= !! result --
+Contents
-Contents
[edit] foo=
-[edit] =foo
-[edit] italic heading=
-[edit] =italic heading
+ + +foo=[edit]
+=foo[edit]
+italic heading=[edit]
+=italic heading[edit]
+ +!! end + +!! test +HTML headers vs TOC (bug 23393) +(__NOEDITSECTION__ for clearer output, doesn't matter here) +!! input +Header 1
+== Header 1.1 == +== Header 1.2 == + +Header 2 +
+== Header 2.1 == +== Header 2.2 == +__NOEDITSECTION__ +!! result ++ ++Contents
+
+- 1 Header 1 + +
+- 2 Header 2 + +
+Header 1
+Header 1.1
+Header 1.2
+Header 2
+Header 2.1
+Header 2.2
!! end @@ -7953,7 +11020,7 @@ div with illegal double attributes !! test div with empty attribute value, space before equals !! options -disabled +parsoid !! inputHTML rocks!! result @@ -7966,7 +11033,7 @@ disabled !! test div with braces in attribute value !! options -disabled +parsoid !! inputFoo!! result @@ -7983,7 +11050,7 @@ disabled !! test div with empty attribute value, no space before equals !! options -disabled +parsoid !! inputHTML rocks!! result @@ -8078,6 +11145,81 @@ I always thought &xacute; was a cute letter. !! end +### +### Nesting tests (see bug 41545, 50604, 51081) +### + +# This test case is fixed in Parsoid by domino 1.0.12. (bug 50604) +# Note that html2wt is considerably more difficult if we use in +# the test case, instead of +!! test +Ensure that HTML adoption agency algorithm is properly implemented. +!! input +XYZ +!! result +XYZ +
+!! end + +# This was bug 41545 in the PHP parser. +!! test +Nesting of +!! input +XYZ +!! result +XYZ +
+!! end + +# The following cases were bug 51081 in the PHP parser. +# Note that there are some other nestable tags (b, i, etc) which are +# not covered; see bug 51081 for discussion. +!! test +Nesting of +!! input +XYZ +!! result +XYZ +
+!! end + +!! test +Nesting of +!! input +XYZ +!! result +XYZ +
+!! end + +!! test +Nesting of+!! input +X+!! result +YZ+!! end + +!! test +Nesting of +!! input +XYZ +!! result +
X+YZXYZ +
+!! end + +!! test +Nesting of +!! input +XYZ +!! result +XYZ +
+!! end + + ### ### Media links ### @@ -8470,70 +11612,6 @@ MSIE CSS safety test: comment in expression !! end -!! test -CSS safety test: vertical tab -!! input -A
-!! result -A
- -!! end - -!! test -MSIE CSS safety test: Fullwidth -!! input -A
-B-!! result -A
-B- -!! end - -!! test -MSIE CSS safety test: IPA extensions -!! input -A-B
-!! result -A-B
- -!! end - -!! test -MSIE CSS safety test: sup/sub script -!! input -A-B-C
-!! result -A-B-C
- -!! end - -!! test -MSIE CSS safety test: Repetition markers -!! input -A
-B
-C
-D
-E
-F
-G
-!! result -A
-B
-C
-D
-E
-F
-G
- -!! end !! test Table attribute legitimate extension @@ -8617,7 +11695,7 @@ Expansion of multi-line templates in attribute values (bug 6255 sanity check 2) !! end ### -### Parser hooks (see maintenance/parserTestsParserHook.php for theextension) +### Parser hooks (see tests/parser/parserTestsParserHook.php for the extension) ### !! test Parser hook: empty input @@ -8782,7 +11860,7 @@ array ( !! end ### -### (see maintenance/parserTestsStaticParserHook.php for the extension) +### (see tests/parser/parserTestsParserHook.php for the extension) ### !! test @@ -9014,11 +12092,13 @@ disabled !! result - -!! end - + +
- One -
- Two -
Two + + + +!! end + !! test HTML ordered list, closed tags (bug 5497) !! input @@ -9046,8 +12126,10 @@ disabled !! result+ +
- One -
- Two -
Two + + !! end @@ -9092,12 +12174,16 @@ disabled !! result+ +
- One -
- Two: +
+- Two:
-
- Sub-one -
- Sub-two -
Sub-two + + + + !! end @@ -9142,21 +12228,27 @@ disabled !! result+ +
- One -
- Two: +
+- Two:
-
- Sub-one -
- Sub-two -
Sub-two + + + + !! end !! test HTML ordered list item with parameters oddity !! input -+
- One
!! result -
- One
++
- One
!! end @@ -9208,12 +12300,13 @@ Fuzz testing: Parser14 == onmouseover= == http://__TOC__ !! result -
- One
+[edit] onmouseover=
-http://+ + !! end @@ -9223,7 +12316,7 @@ Fuzz testing: Parser14-table ==a== {| STYLE=__TOC__ !! result -
+Contents
onmouseover=[edit]
+http://-Contents
[edit] a
+a[edit]
@@ -9369,7 +12462,7 @@ Fuzz testing: image with bogus manual thumbnail !!input [[Image:foobar.jpg|thumbnail= ]] !!result -
+Error creating thumbnail:!!end @@ -10380,17 +13473,33 @@ Handling of in URLs !! input **irc:// a !! result -Error creating thumbnail:+
- -
+
!!end !! test -5 quotes, code coverage +1 line +5 quotes, code coverage +1 line (php) +!! options +php +!! input +''''' +!! result +!! end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +5 quotes, code coverage +1 line (parsoid) +!! options +parsoid !! input ''''' !! result +- +
+
+- irc://%0Aa +
+!! end !! test @@ -10404,43 +13513,78 @@ Special:Search page linking. !! test Say the magic word +!! options +title=[[Parser test]] !! input * {{PAGENAME}} +* {{PAGENAMEE}} +* {{FULLPAGENAME}} +* {{FULLPAGENAMEE}} * {{BASEPAGENAME}} +* {{BASEPAGENAMEE}} * {{SUBPAGENAME}} * {{SUBPAGENAMEE}} -* {{BASEPAGENAME}} -* {{BASEPAGENAMEE}} +* {{ROOTPAGENAME}} +* {{ROOTPAGENAMEE}} * {{TALKPAGENAME}} * {{TALKPAGENAMEE}} * {{SUBJECTPAGENAME}} * {{SUBJECTPAGENAMEE}} * {{NAMESPACEE}} * {{NAMESPACE}} +* {{NAMESPACENUMBER}} * {{TALKSPACE}} * {{TALKSPACEE}} * {{SUBJECTSPACE}} * {{SUBJECTSPACEE}} * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}} !! result -
+
- Parser test -
- Parser test -
- Parser test -
- Parser_test -
- Parser test -
- Parser_test -
- Talk:Parser test -
- Talk:Parser_test -
- Parser test -
- Parser_test -
- -
- -
- Talk -
- Talk -
- -
- -
- Template:Dynamic -
+
!! end ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included. @@ -10459,40 +13603,40 @@ image4 |300px| centre * image6 !! result -- Parser test +
+- Parser_test +
+- Parser test +
+- Parser_test +
+- Parser test +
+- Parser_test +
+- Parser test +
+- Parser_test +
+- Parser test +
+- Parser_test +
+- Talk:Parser test +
+- Talk:Parser_test +
+- Parser test +
+- Parser_test +
+- +
+- +
+- 0 +
+- Talk +
+- Talk +
+- +
+- +
+- Template:Dynamic +
++
-Image1.png+Image1.png -Image2.gif+Image2.gif||||
-Image3+Image3 -Image4+Image4300px| centre
- @@ -10511,17 +13655,17 @@ image:foobar.jpg image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla. !! result -
-* image6+* image6+
-Nonexistant.jpg+Nonexistant.jpgcaption
- @@ -10556,7 +13700,7 @@ File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt !! result -
-Nonexistant.jpg+Nonexistant.jpg+
+ +@@ -10585,9 +13729,9 @@ image:foobar.jpg|some '''caption''' [[Main Page]] File:Foobar.jpg !! result -+ ++
-+ +Nonexistant.jpg+Nonexistant.jpg@@ -10630,14 +13774,14 @@ image:foobar.jpg foobar.jpg !! result -+ ++
-Nonexistant.jpg+Nonexistant.jpg- @@ -10828,13 +13972,25 @@ disabled !! input :;;;:: !! result -
-Nonexistant.jpg+Nonexistant.jpg+
-
-
-
-
-
- -
+
!!end @@ -10861,7 +14017,7 @@ Images with the "|" character in the comment !! test HTML with raw HTML ($wgRawHtml==true) !! options -rawhtml +wgRawHtml=1 !! input !! result @@ -10930,6 +14086,45 @@ subpage title=[[Subpage test/L1/L2/L3]] !! end +!! article +Subpage test/L1/L2/L3Sibling +!! text +Sibling article +!! endarticle + +!! test +Transclusion of a sibling page (one level up) +!! options +subpage title=[[Subpage test/L1/L2/L3]] +!! input +{{../L3Sibling}} +!! result +- +
+
++
+ ++
+ ++
+ +- +
+
+- +
+Sibling article +
+!! end + +!! test +Transclusion of a child page +!! options +subpage title=[[Subpage test/L1/L2]] +!! input +{{/L3Sibling}} +!! result +Sibling article +
+!! end + +!! test +Non-transclusion because of too many up levels +!! options +subpage title=[[Subpage test/L1/L2/L3]] +!! input +{{../../../../More than parent}} +!! result +{{../../../../More than parent}} +
+!! end + !! test Definition list code coverage !! input @@ -10937,10 +14132,17 @@ Definition list code coverage ; title : def ;title: def !! result -+
- title
- def -
- title
- def -
- title
- def -
+
!! end @@ -11004,7 +14206,7 @@ Inclusion of !userCanEdit() content !! input {{MediaWiki:Fake}} !! result -- title
+- def +
+- title
+- def +
+- title
+- def +
+[edit] header
+header[edit]
!! end @@ -11019,7 +14221,7 @@ Out-of-order TOC heading levels =====5===== ==2== !! result --
+Contents
Contents
-
- 1 2
@@ -11034,13 +14236,14 @@ Out-of-order TOC heading levels
[edit] 2
-[edit] 6
-[edit] 3
-[edit] 1
-[edit] 5
-[edit] 2
+2[edit]
+6[edit]
+3[edit]
+1[edit]
+5[edit]
+2[edit]
!! end @@ -11147,14 +14350,11 @@ anchorencode encodes like the TOC generator: (bug 18431) {{anchorencode: _ +:.3A%3A&&]] }} __NOEDITSECTION__ !! result -_ +:.3A%3A&&]]
+_ +:.3A%3A&&]]
.2B:.3A.253A.26.26.5D.5D
!! end -# Expected output in the following test is not necessarily expected (there -# should probably betags inside the
in the output) -- it's -# only testing for well-formedness. !! test Bug 6200: blockquotes and paragraph formatting !! input @@ -11167,7 +14367,8 @@ bar baz !! result-foo +foo +
bar
@@ -11196,6 +14397,27 @@ bar !! end +!!test +Parsing of overlapping (improperly nested) inline html tags (PHP parser) +!!options +php +!!input +x+!!result ++!!end + +!!test +Parsing of overlapping (improperly nested) inline html tags (Parsoid) +!!options +parsoid +!!input +
x</span>+x+!!result ++!!end ### ### Language variants related tests @@ -11228,6 +14450,17 @@ title=[[Duna]] language=sr !! end +!! test +Link to a section of a variant of this title shouldn't be parsed as self-link +!! options +title=[[Duna]] language=sr +!! input +[[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links. +!! result +
x+Dуна is a self-link while Dunа#Foo and Dуна#Foo are not self-links. +
+!! end + !! test Link to pages in language variants !! options @@ -11377,7 +14610,7 @@ language=sr variant=sr-ec !! input == -{Naslov}- == !! result -[уреди] Naslov
+Naslov[уреди]
!! end @@ -11490,6 +14723,30 @@ This won't take interferes with the title rule. !! end +!! test +Partly disable title conversion if variant == main language code +!! options +language=zh variant=zh title=[[ZH]] showtitle +!! input +-{T|zh-cn:CN;zh-tw:TW}- +!! result +ZH ++
+!! end + +!! test +Partly disable title conversion if variant == main language code, more +!! options +language=zh variant=zh title=[[ZH]] showtitle +!! input +-{T|TW}- +!! result +ZH ++
+!! end + !! test Raw output of variant escape tags (R flag) !! options @@ -11568,20 +14825,17 @@ language=sr !!end -!!article -Template:Bullet -!!text -* Bar -!!endarticle - !! test Bug 529: Uncovered bullet !! input * Foo {{bullet}} !! result -+
- Foo -
- Bar -
+
!! end @@ -11596,15 +14850,30 @@ Bug 529: Uncovered bullet leaving empty list, normally removed by tidy !! input ******* Foo {{bullet}} !! result -- Foo +
+- Bar +
++
-
-
-
-
-
-
- Foo -
- Bar -
+
!! end @@ -11636,9 +14905,12 @@ Bug 529: Uncovered bullet in parser function result !! input * Foo {{lc:{{bullet}} }} !! result -- +
+
+- +
+
+- +
+
+- +
+
+- +
+
+- +
+
+- Foo +
+- Bar +
++
- Foo -
- bar -
+
!! end @@ -11694,7 +14966,7 @@ Morwen/13: Unclosed link followed by heading !! result- Foo +
+- bar +
+[[link
-[edit] heading
+heading[edit]
!! end @@ -11706,7 +14978,7 @@ HHP2.1: Heuristics for headings in preprocessor parenthetical structures !! result{{foo|
-heading
+heading
!! end @@ -11718,7 +14990,7 @@ HHP2.2: Heuristics for headings in preprocessor parenthetical structures !! result{{foo|
-[edit] heading
+heading[edit]
!! end @@ -11808,8 +15080,6 @@ B # Bug 6200:should behave likewith respect to line breaks !! test Bug 6200: paragraphs inside blockquotes (no extra line breaks) -!! options -disabled !! input+ +Line one @@ -11822,8 +15092,6 @@ Line two!! test Bug 6200: paragraphs inside blockquotes (extra line break on open) -!! options -disabled !! inputLine one @@ -11839,8 +15107,6 @@ Line two!! test Bug 6200: paragraphs inside blockquotes (extra line break on close) -!! options -disabled !! inputLine one @@ -11856,8 +15122,6 @@ Line two !! test Bug 6200: paragraphs inside blockquotes (extra line break on open and close) -!! options -disabled !! inputLine one @@ -12078,7 +15342,7 @@ comment title=[[Main Page]] !! input pre-comment text /* External links */ removed bogus entries !! result -pre-comment text - →External links: removed bogus entries +pre-comment text →External links: removed bogus entries !!end !! test @@ -12309,6 +15573,40 @@ Screen !! end +!! test +Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value +!! options +showtitle +title=[[Screen]] +!! config +wgAllowDisplayTitle=true +wgRestrictDisplayTitle=true +!! input +this is not the the title +{{DISPLAYTITLE: creen}} +!! result +screen +this is not the the title +
+!! end + +!! test +Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value +!! options +showtitle +title=[[Screen]] +!! config +wgAllowDisplayTitle=true +wgRestrictDisplayTitle=true +!! input +this is not the the title +{{DISPLAYTITLE:screen}} +!! result +screen +this is not the the title +
+!! end + !! test preload: checkand !! options @@ -12533,12 +15831,13 @@ title=[[Main Page]] __TOC__ == ''Lost'' episodes == !! result - -
+Contents
-Contents
[edit] Lost episodes
+Lost episodes[edit]
!! end @@ -12550,12 +15849,13 @@ title=[[Main Page]] __TOC__ == '''should be bold''' then normal text == !! result --
+Contents
-Contents
[edit] should be bold then normal text
+should be bold then normal text[edit]
!! end @@ -12567,12 +15867,13 @@ title=[[Main Page]] __TOC__ == Image [[Image:foobar.jpg]] == !! result --
+Contents
-Contents
[edit] Image
+Image [edit]
!! end @@ -12584,12 +15885,13 @@ title=[[Main Page]] __TOC__ ==Quote== !! result --
+Contents
-Contents
[edit]
+Quote!! end @@ -12603,12 +15905,13 @@ __TOC__ Hanc marginis exiguitas non caperet. QED !! result -
Quote[edit]-
+Contents
-Contents
[edit] Proof: 2 < 3
+ + +Proof: 2 < 3[edit]
Hanc marginis exiguitas non caperet. QED
@@ -12622,14 +15925,15 @@ __TOC__ == FooBar== !! result --
+Contents
[edit] Foo Bar
-[edit] Foo
+ + +BarFoo Bar[edit]
+Foo
!! end @@ -12641,14 +15945,15 @@ __TOC__ == Evilbye == !! result -Bar[edit]-
+Contents
-Contents
[edit] Hello
-[edit] b">Evilbye
+ + +Hello[edit]
+b">Evilbye[edit]
!! end @@ -12666,7 +15971,7 @@ __TOC__ == Attributes after dir on these span tags must be deleted from the TOC == !! result --
+Contents
Contents
-
- 1 C++
- 2 זבנג!
@@ -12674,12 +15979,13 @@ __TOC__- 4 All attributes on these span tags must be deleted from the TOC
- 5 Attributes after dir on these span tags must be deleted from the TOC
[edit] C++
-[edit] זבנג!
-[edit] The attributes on these span tags must be deleted from the TOC
-[edit] All attributes on these span tags must be deleted from the TOC
-[edit] Attributes after dir on these span tags must be deleted from the TOC
+ + +C++[edit]
+זבנג![edit]
+The attributes on these span tags must be deleted from the TOC[edit]
+All attributes on these span tags must be deleted from the TOC[edit]
+Attributes after dir on these span tags must be deleted from the TOC[edit]
!! end @@ -12696,7 +16002,7 @@ title=[[Main Page]] !! input {{int:Bug32057}} !! result -[edit] Headline text
+Headline text[edit]
!! end @@ -12798,7 +16104,7 @@ nowiki inside link inside heading (bug 18295) !! input ==[[foo|xy z]]== !! result -[edit] xyz
+xyz[edit]
!! end @@ -12837,7 +16143,7 @@ Gallery override link with WikiLink (bug 34852) File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink !! result -+
@@ -12856,7 +16162,7 @@ Gallery override link with absolute external link (bug 34852) File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org !! result -+
@@ -12875,7 +16181,7 @@ Gallery override link with malicious javascript (bug 34852) File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!'); !! result -+
@@ -12894,7 +16200,7 @@ Gallery with invalid title as link (bug 43964) File:foobar.jpg|link=< !! result -+
@@ -12924,6 +16230,19 @@ abc !! end +!!test +Special parser function +!! input +{{#special:RandomPage}} +{{#special:BaDtItLe}} +{{#special:Foobar}} +!! result +Special:Random +Special:Badtitle +Special:Foobar +
+!! end + !!test Bug 34939 - Case insensitive link parsing ([HttP://]) !! input @@ -12951,6 +16270,30 @@ HttP://MediaWiki.Org/ !! end +!!test +Disable TOC +!! options +notoc +!! input +Lead +== Section 1 == +== Section 2 == +== Section 3 == +== Section 4 == +== Section 5 == +!! result +Lead +
+ +Section 1[edit]
+Section 2[edit]
+Section 3[edit]
+Section 4[edit]
+Section 5[edit]
+ +!! end + + ### ### Parsoids-specific tests ### Parsoid-PHP parser incompatibilities @@ -12958,963 +16301,2213 @@ HttP://MediaWiki.Org/ !!test 1. SOL-sensitive wikitext tokens as template-args !!options -disabled +parsoid=wt2html,wt2wt !!input {{echo|*a}} {{echo|#a}} {{echo|:a}} !!result -*a -#a -:a -
+ ++ +
- a
++ +
- a
+!!end -#### The following section of tests are primarily to test -#### wikitext escaping capabilities of Parsoid. -#### A lot of the tests are disabled for the PHP parser either -#### because of minor newline diffs or other reasons. -#### As Parsoid serializer can handle newlines and other HTML -#### more robustly, some of these tests might get reenabled -#### for the PHP parser. - -#### --------------- Headings --------------- -#### 0. Unnested -#### 1. Nested inside html
- a
+=foo=
-#### 2. Outside heading nest on a single linefoo
*bar -#### 3. Nested inside html with wikitext split by html tags -#### 4. No escape needed -#### 5. Empty headings -#### 6. Heading chars in SOL context -#### ---------------------------------------- -!! test -Headings: 0. Unnested -!! input -=foo= +#### ---------------------------------------------------------------- +#### Parsoid-only testing of Parsoid's impl of and+#### tags. Parsoid's output for these tags differs from that of the +#### PHP parser. +#### ---------------------------------------------------------------- - =foo ''a''= -!! result -=foo= -
=fooa= -
+!!test +Ref: 1. ref-location should be replaced with an index span +!!options +parsoid +!!input +A foo +B foo +C +!!result + !!end -!! test -Headings: 1. Nested inside html -!! options -disabled -!! input -==foo= = -===foo= == -====foo= === -=====foo= ==== -======foo= ===== -=======foo= ====== -!! result -=foo=
-=foo=
-=foo=
-=foo=
-=foo=
-=foo=
+!!test +Ref: 2. ref-tags with identical names should all get the same index +!!options +parsoid +!!input +A foo +B +!!result + !!end -!! test -Headings: 2. Outside heading nest on a single linefoo
*bar -!! options -disabled -!! input -=foo= -*bar -=foo= -=bar -=foo= -=bar= -!! result -foo
*bar -foo
=bar -foo
=bar= +!!test +Ref: 3. spaces in ref-names should be ignored +!!options +parsoid +!!input +A foo +B +C +!!result + !!end -!! test -Headings: 3. Nested inside html with wikitext split by html tags -!! options -disabled -!! input -== '''bold'''foo== -!! result -=boldfoo=
+!!test +Ref: 4. 'constructor' should be accepted as a valid ref-name +(NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly) +!!options +parsoid +!!input +A foo +!!result +A [1]
!!end -!! test -Headings: 4. No escaping needed (testing just h1 and h2) -!! options -disabled -!! input -==foo= -=foo== -===foo== -==foo=== -=''=''foo== -=== -!! result -=foo
-foo=
-=foo
-foo=
-=foo=
-=
-!!end +!!test +Ref: 5. body should accept generic wikitext +!!options +parsoid +!!input +A + This is a '''[[bolded link]]''' and this is a {{echo|transclusion}} + -!! test -Headings: 5. Empty headings -!! options -disabled -!! input -== -== == -=== === -==== ==== -===== ===== -====== ====== -!! result - - - - - - -!!end + +!!result + A [1]
-!! test -Headings: 6. Heading chars in SOL context -!! options -disabled -!! input -=h1= -!! result -=h1= -
++
!!end -#### --------------- Lists --------------- -#### 0. Outside nests (*foo, etc.) -#### 1. Nested inside html- ↑ This is a bolded link and this is a transclusion +
+-#### 2. Inside definition lists -#### 3. Only bullets at start should be escaped -#### 4. No escapes needed -#### 5. No unnecessary escapes -#### 6. Escape bullets in SOL position -#### 7. Escape bullets in a multi-line context -#### ---------------------------------------- +!!test +Ref: 6. indent-pres should not be output in ref-body +!!options +parsoid +!!input +A + foo + bar + baz + -!! test -Lists: 0. Outside nests -!! input -
- *foo
*foo ++!!result + A [1]
-#foo -!! result -*foo -
#foo -
++
!!end -!! test -Lists: 1. Nested inside html -!! input -*- ↑ foo + bar + baz +
+*foo +!!test +Ref: 7. No p-wrapping in ref-body +!!options +parsoid +!!input +A +foo -*#foo +bar -*:foo -*;foo +baz -#*foo -##foo -#:foo +booz + -#;foo -!! result --
- *foo -
-
- #foo -
-
- :foo -
-
- ;foo -
-
- *foo -
-
- #foo -
-
- :foo -
+
- ;foo -
+!!result + A [1]
-!!end ++
!!end -!! test -Lists: 3. Only bullets at start of text should be escaped -!! input -*- ↑ foo -!! test -Lists: 2. Inside definition lists -!! input -;
+;foo +bar -;:foo -;:foo -:bar +baz + -::foo -!! result --
- ;foo -
-
- :foo -
-
- :foo -
- bar -
+booz +
- :foo -
*foo*bar +!!test +Ref: 8. transclusion wikitext has lower precedence +!!options +parsoid +!!input +A foo {{echo| B C}} -**foo ''it''*bar -!! result --
- *foo*bar -
+
- *fooit*bar -
+!!result + A [1] B C}}
++
!!end -!! test -Lists: 4. No escapes needed -!! options -disabled -!! input -*foo*bar +!!test +Ref: 9. unclosed comments should not leak out of ref-body +!!options +parsoid +!!input +A foo "},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref">[1] B C -*[[Foo]]: bar -!! result -- ↑ foo {{echo|
+-
- foo*bar -
-
- foo*bar -
+
- Foo: bar -
+
!!end -!! test -Lists: 5. No unnecessary escapes -!! input -* bar- ↑ foo
+[[foo]] - -*=bar[[foo]] +!!test +Ref: 10. Unclosed HTML tags should not leak out of ref-body +!!options +parsoid +!!input +A foo B C -*[[bar[[foo]] ++!!result + A [1] B C
-*]]bar [[foo]] ++
+!!end + +!!test +Ref: 11. ref-tags acts like an inline element wrt P-wrapping +!!options +parsoid +!!input +A foo B +C bar D +!!result + +!!end + +!!test +Ref: 12. ref-tags act as trailing newline migration barrier +!!options +parsoid +!!input +a + +b + + +c +!!result +- ↑ foo
+a
+ + + -*=bar foo]]= -!! result --
- bar [[foo]] -
-
- =bar [[foo]] -
-
- [[bar [[foo]] -
-
- ]]bar [[foo]] -
+
- =bar foo]]= -
c
!!end -!! test -Lists: 6. Escape bullets in SOL position -!! options -disabled -!! input -*foo -!! result -*foo -
+!!test +Ref: 13. ref-tags are not SOL-transparent and block indent-pres +!!options +parsoid +!!input +foo A +bar + B +!!result + !!end -!! test -Lists: 7. Escape bullets in a multi-line context -!! input -a -*b -!! result -a -*b -
+!!test +Ref: 14. A nested ref-tag should be emitted as plain text +!!options +parsoid +!!input +foo bar baz + ++!!result + + + +
!!end -#### --------------- HRs --------------- -#### 1. Single line -#### ----------------------------------- +!!test +Ref: 15. ref-tags with identical names should get identical indexes +!!options +parsoid +!!input +A1 foo A2 +B1 B2 bar + +- ↑ foo <ref>bar</ref> baz
++!!result + + + +!!end + +!!test +References: 1. references tag without any refs should be handled properly +!!options +parsoid +!!input + +!!result + +!!end + +!!test +References: 2. references tag with group only outputs references from that group +!!options +parsoid +!!input +A foo +B bar + +
+!!result + + + +!!end + +!!test +References: 3. ref list should be cleared after processing references +!!options +parsoid +!!input +A foo + +
- ↑ foo
++ +B bar + + +!!result + A [1]
+ ++ +
- ↑ foo
+B [1]
+ ++!!end + +!!test +References: 4. only referenced group should be cleared after processing references +!!options +parsoid +!!input +A afoo +B bfoo + +
- ↑ bar
++ +C cfoo + + +!!result + + + + +
- ↑ afoo
+C [2]
+ + +!!end + +!!test +References: 5. ref tags in references should be processed while ignoring all other content +!!options +parsoid +!!input +A +B bar + ++foo +This should just get lost. + +!!result + + + +!!end + +!!test +References: 6.from a transclusion +!!options +parsoid +!!input +{{echo| }} +!!result + +!!end !! test -HRs: 1. Single line +References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled !! options -disabled +parsoid !! input ----- -
---- ----- -=foo= ----- -*foo +A foo bar for a +B + ++ + +foo + !! result -
---- -
=foo= -
*foo + + + + ++
!! end -#### --------------- Tables --------------- -#### 1a. Simple example -#### 1b. No escaping needed (!foo) -#### 1c. No escaping needed (|foo) -#### 1d. No escaping needed (|}foo) -#### -#### 2a. Nested in td (- ↑ foo
+foo|bar ) -#### 2b. Nested in td (foo||bar ) -#### 2c. Nested in td -- no escaping needed(foo!!bar ) -#### -#### 3a. Nested in th (foo!bar ) -#### 3b. Nested in th (foo!!bar ) -#### 3c. Nested in th -- no escaping needed(foo||bar ) +#### ---------------------------------------------------------------- +#### The following section of tests are primarily to test +#### wikitext escaping capabilities of Parsoid. Given that +#### escaping can be done any number of ways, the wikitext (input) +#### is always adjusted to reflect how Parsoid adds nowiki +#### escape tags. #### -#### 4a. Escape - -#### 4b. Escape + -#### 4c. No escaping needed -#### -------------------------------------- +#### We are marking several tests as parsoid-only since the +#### HTML in the result section is different from what the +#### PHP parser generates for it. +#### ---------------------------------------------------------------- -!! test -Tables: 1a. Simple example -!! input -{| -|} -!! result -{| -|} -
-!! end +#### --------------- Headings --------------- +#### 0. Unnested +#### 1. Nested inside html=foo=
+#### 2. Outside heading nest on a single linefoo
*bar +#### 3. Nested inside html with wikitext split by html tags +#### 4. No escape needed +#### 5. Empty headings +#### 6. Heading chars in SOL context +#### ---------------------------------------- !! test -Tables: 1b. No escaping needed +Headings: 0. Unnested +!! options +parsoid !! input -!foo -!! result -!foo -
-!! end +=foo= -!! test -Tables: 1c. No escaping needed -!! input -|foo +=foo= + +=foo= + +=foo''a''= !! result -|foo -
-!! end +=foo=
+ +=foo= + +=foo=
+ +=fooa=
+!!end !! test -Tables: 1d. No escaping needed +Headings: 1. Nested inside html +!! options +parsoid !! input -|}foo +==foo= = + +===foo= == + +====foo= === + +=====foo= ==== + +======foo= ===== + +=======foo= ====== !! result -|}foo -
-!! end +=foo=
+=foo=
+=foo=
+=foo=
+=foo=
+=foo=
+!!end !! test -Tables: 2a. Nested in td +Headings: 2. Outside heading nest on a single linefoo
*bar !! options -disabled +parsoid !! input -{| -|foo|bar -|} -!! result --
+=foo= +foo|bar - * bar -!! end +=foo= +=bar + +=foo= +=bar= +!! result +foo
*bar +foo
=bar +foo
=bar= +!!end !! test -Tables: 2b. Nested in td +Headings: 3. Nested inside html with wikitext split by html tags !! options -disabled +parsoid !! input -{| -|foo||bar -|''it''foo||bar -|} +=='''bold'''foo= = !! result --
- -!! end +foo||bar - itfoo||bar - =boldfoo=
+!!end !! test -Tables: 2c. Nested in td -- no escaping needed +Headings: 4a. No escaping needed (testing just h1 and h2) !! options -disabled +parsoid !! input -{| -|foo!!bar -|} -!! result --
+==foo= -!! end +=foo== -!! test -Tables: 3a. Nested in th -!! options -disabled -!! input -{| -!foo!bar -|} -!! result -foo!!bar - -
+= =foo= = -!! end +==foo= bar= -!! test -Tables: 3b. Nested in th -!! options -disabled -!! input -{| -!foo!bar - foo!!bar -|} -!! result --
+===foo== -!! end +==foo=== -!! test -Tables: 3c. Nested in th -- no escaping needed -!! options -disabled -!! input -{| -!foo||bar -|} -!! result -foo!!bar - -
+=''=''foo== -!! end +=foo||bar - = = +!! result +=foo
+foo=
+=foo=
+=foo= bar
+=foo
+foo=
+=foo=
+=
+!!end !! test -Tables: 4a. Escape - +Headings: 4b. No escaping needed (inside p-tags) !! options -disabled +parsoid !! input -{| -|- -!-bar -|- -|-bar -|} +=== +=foo= x +=foo=!! result --
-!! end +- -bar - -bar === +=foo= x +=foo=
+!!end !! test -Tables: 4b. Escape + +Headings: 5. Empty headings !! options -disabled +parsoid !! input -{| -|- -!+bar -|- -|++bar -|} +== + +== == + +=== === + +==== ==== + +===== ===== + +====== ====== !! result - -
-!! end + + + + + + +!!end !! test -Tables: 4c. No escaping needed +Headings: 6a. Heading chars in SOL context (with trailing spaces) !! options -disabled +parsoid !! input -{| -|- -|foo-bar -|foo+bar -|- -|''foo''-bar -|''foo''+bar -|} -!! result -- +bar - +bar -
-!! end +- foo-bar foo+bar - foo-bar foo+bar =a= -!! test -Tables: 4d. No escaping needed -!! input -{| -||+1 -||-2 -|} -!! result --
+- +1 - --2 - =a= -!! end +=a= -#### --------------- Links --------------- -#### 1. Quote marks in link text -#### 2. Wikilinks: Escapes needed -#### 3. Wikilinks: No escapes needed -#### 4. Extlinks: Escapes needed -#### 5. Extlinks: No escapes needed -#### -------------------------------------- -!! test -Links 1. Quote marks in link text -!! options -disabled -!! input -[[Foo|Foo''boo'' ]] +=a= !! result -Foo''boo'' -!! end +=a=
+=a=
+=a=
+=a=
+!!end !! test -Links 2. WikiLinks: Escapes needed +Headings: 6b. Heading chars in SOL context (with trailing newlines) !! options -disabled +parsoid !! input -[[Foo|[Foobar] ]] -[[Foo|Foobar] ]] -[[Foo|x [Foobar] x ]] -[[Foo|x [http://google.com g] x ]] -[[Foo|[[Bar]] ]] -[[Foo|x [[Bar]] x ]] -[[Foo||Bar ]] +=a= +b + +=a= +b + +=a= +b + +=a= +b !! result -[Foobar] -Foobar] -x [Foobar] x -x [http://google.com g] x -[[Bar]] -x [[Bar]] x -|Bar -!! end +=a= +b
+=a= +b
+=a= +b
+=a= +b
+ +!!end !! test -Links 3. WikiLinks: No escapes needed +Headings: 6c. Heading chars in SOL context (leading newline break) !! options -disabled +parsoid !! input -[[Foo|[Foobar]] -[[Foo|foo|bar]] +a +=b= !! result -[Foobar -foo|bar -!! end +a +=b=
+!!end !! test -Links 4. ExtLinks: Escapes needed +Headings: 6d. Heading chars in SOL context (with interspersed comments) !! options -disabled +parsoid !! input -[http://google.com[google] ] -[http://google.comgoogle] ] +=a= + +=a= !! result -[google] -google] -!! end +=a=
+=a=
+!!end !! test -Links 5. ExtLinks: No escapes needed +Headings: 6d. Heading chars in SOL context (No escaping needed) !! options -disabled +parsoid=html2wt !! input -[http://google.com [google] +=a=b!! result -[google -!! end +=a=b+!!end -#### --------------- Quotes --------------- -#### 1. Quotes inside and -#### 2. Link fragments separated by and tags -#### 3. Link fragments inside and -#### -------------------------------------- -!! test -1. Quotes inside and -!! input -'''foo' '' -''''foo'' '' -'''''foo''' '' -''''foo' ''' -'''''foo'' ''' -''''''foo''' ''' -'''foo' ''bar' ''baz''' -!! result -'foo' -''foo'' -'''foo''' -'foo' -''foo'' -'''foo''' -foo'bar'baz -
-!! end +#### --------------- Lists --------------- +#### 0. Outside nests (*foo, etc.) +#### 1. Nested inside html+#### 2. Inside definition lists +#### 3. Only bullets at start should be escaped +#### 4. No escapes needed +#### 5. No unnecessary escapes +#### 6. Escape bullets in SOL position +#### 7. Escape bullets in a multi-line context +#### ---------------------------------------- !! test -2. Link fragments separated by and tags +Lists: 0. Outside nests !! input -[[''foo''
- *foo
hello]] +* foo -[['''foo'''hello]] +# foo !! result -[[foohello]] -
[[foohello]] +
*foo +
#foo
-!! end +!!end !! test -2. Link fragments inside and -(FIXME: Escaping one or both of [[ and ]] is also acceptable -- - this is one of the shortcomings of this format) +Lists: 1. Nested inside html !! input -''[[foo'']] +**foo + +*#foo + +*:foo + +*;foo + +#*foo + +##foo + +#:foo + +#;foo +!! result ++
+- *foo +
++
+- #foo +
++
+- :foo +
++
+- ;foo +
++
+- *foo +
++
+- #foo +
++
+- :foo +
++
+ +!!end + +!! test +Lists: 2. Inside definition lists +!! input +;- ;foo +
+;foo + +;:foo + +;:foo +:bar + +::foo +!! result ++
+- ;foo +
++
+- :foo +
++
+- :foo +
+- bar +
++
+ +!!end + +!! test +Lists: 3. Only bullets at start of text should be escaped +!! input +*- :foo +
+*foo*bar + +**foo ''it''*bar +!! result ++
+- *foo*bar +
++
+ +!!end + +!! test +Lists: 4. No escapes needed +!! options +parsoid +!! input +*foo*bar + +*''foo''*bar + +*[[Foo]]: bar +!! result +- *fooit*bar +
++
+- foo*bar +
++
+- foo*bar +
++
+!!end + +!! test +Lists: 5. No unnecessary escapes +!! input +* bar- Foo: bar +
+[[foo]] + +*=bar[[foo]] + +*[[bar[[foo]] + +*]]bar[[foo]] + +*=bar foo]]= + +*: a +!! result ++
+- bar [[foo]] +
++
+- =bar [[foo]] +
++
+- [[bar [[foo]] +
++
+- ]]bar [[foo]] +
++
+- =bar foo]]= +
++
+ +!!end + +!! test +Lists: 6. Escape bullets in SOL position +!! options +parsoid +!! input +- +
: a +*foo +!! result +*foo
+!!end + +!! test +Lists: 7. Escape bullets in a multi-line context +!! input +a +* b +!! result +a +*b +
+!!end + +#### --------------- HRs --------------- +#### 1. Single line +#### ----------------------------------- + +!! test +HRs: 1. Single line +!! options +parsoid +!! input +-------- +----=foo= +----*foo +!! result +
---- +
=foo= +
*foo +!! end + +#### --------------- Tables --------------- +#### 1a. Simple example +#### 1b. No escaping needed (!foo) +#### 1c. No escaping needed (|foo) +#### 1d. No escaping needed (|}foo) +#### +#### 2a. Nested in td (foo|bar ) +#### 2b. Nested in td (foo||bar ) +#### 2c. Nested in td -- no escaping needed(foo!!bar ) +#### +#### 3a. Nested in th (foo!bar ) +#### 3b. Nested in th (foo!!bar ) +#### 3c. Nested in th -- no escaping needed(foo||bar ) +#### +#### 4a. Escape - +#### 4b. Escape + +#### 4c. No escaping needed +#### -------------------------------------- + +!! test +Tables: 1a. Simple example +!! input +{| +|} +!! result +{| +|} +
+!! end + +!! test +Tables: 1b. No escaping needed +!! input +!foo +!! result +!foo +
+!! end + +!! test +Tables: 1c. No escaping needed +!! input +|foo +!! result +|foo +
+!! end + +!! test +Tables: 1d. No escaping needed +!! input +|}foo +!! result +|}foo +
+!! end + +!! test +Tables: 2a. Nested in td +!! options +parsoid +!! input +{| +|foo|bar +|} +!! result ++!! end + +!! test +Tables: 2b. Nested in td +!! options +parsoid +!! input +{| +|
+ foo|bar foo||bar +|''it''foo||bar +|} +!! result ++!! end + +!! test +Tables: 2c. Nested in td -- no escaping needed +!! options +parsoid +!! input +{| +|foo!!bar +|} +!! result +
+ foo||bar +itfoo||bar + +!! end + +!! test +Tables: 3a. Nested in th +!! options +parsoid +!! input +{| +!foo!bar +|} +!! result +
foo!!bar + + +!! end + +!! test +Tables: 3b. Nested in th +!! options +parsoid +!! input +{| +!
foo!bar + foo!!bar +|} +!! result ++
+!! end + +!! test +Tables: 3c. Nested in th -- no escaping needed +!! options +parsoid +!! input +{| +!+ foo!!bar foo||bar +|} +!! result ++!! end + +!! test +Tables: 4a. Escape - +!! options +parsoid +!! input +{| +!-bar +|- +|
+ foo||bar -bar +|} +!! result ++
+!! end + +!! test +Tables: 4b. Escape + +!! options +parsoid +!! input +{| +!+bar +|- +|+ -bar + -bar +bar +|} +!! result ++
+!! end + +!! test +Tables: 4c. No escaping needed +!! options +parsoid +!! input +{| +|foo-bar +|foo+bar +|- +|''foo''-bar +|''foo''+bar +|- +|foo +bar|baz ++bar +-bar +|} +!! result ++ +bar + +bar +
+!! end + +### SSS FIXME: Disabled right now because accurate html2wt +### on this snippet requires data-parsoid flags that we've +### stripped out of these tests. We should scheme how we +### we want to handle these kind of tests that require +### data-parsoid flags for accurate html2wt serialization + +!! test +Tables: 4d. No escaping needed +!! options +disabled +!! input +{| +||+1 +||-2 +|} +!! result ++ foo-bar foo+bar + foo-bar foo+bar + foo + bar|baz ++bar +-bar
+
+ +!! end + +#### --------------- Links ---------------- +#### 1. Quote marks in link text +#### 2. Wikilinks: Escapes needed +#### 3. Wikilinks: No escapes needed +#### 4. Extlinks: Escapes needed +#### 5. Extlinks: No escapes needed +#### -------------------------------------- +!! test +Links 1. Quote marks in link text +!! options +parsoid +!! input +[[Foo|Foo+ +1 + +-2 + ''boo'' ]] +!! result +Foo''boo'' +!! end + +!! test +Links 2. WikiLinks: Escapes needed +!! options +parsoid +!! input +[[Foo|[Foobar] ]] +[[Foo|Foobar] ]] +[[Foo|x [Foobar] x]] +[[Foo|x [http://google.com g] x ]] +[[Foo|[[Bar]] ]] +[[Foo|x [[Bar]] x ]] +[[Foo||Bar ]] +[[Foo|]]bar ]] +[[Foo|[[bar ]] +[[Foo|x ]] y [[ z ]] +!! result +[Foobar] +Foobar] +x [Foobar] x +x [http://google.com g] x +[[Bar]] +x [[Bar]] x +|Bar +]]bar +[[bar +x ]] y [[ z +!! end + +!! test +Links 3. WikiLinks: No escapes needed +!! options +parsoid +!! input +[[Foo|[Foobar]] +[[Foo|foo|bar]] +!! result +[Foobar +foo|bar +!! end + +!! test +Links 4. ExtLinks: Escapes needed +!! options +parsoid +!! input +[http://google.com[google] ] +[http://google.comgoogle] ] +!! result +[google] +google] +!! end + +!! test +Links 5. ExtLinks: No escapes needed +!! options +parsoid +!! input +[http://google.com [google] +!! result +[google +!! end + +#### --------------- Quotes --------------- +#### 1. Quotes inside and +#### 2. Link fragments separated by and tags +#### 3. Link fragments inside and +#### 4. No escaping needed +#### -------------------------------------- +!! test +1. Quotes inside and +!! options +parsoid=html2wt,wt2wt +!! input +'''foo' '' +''''foo'' '' +'''''foo''' '' +''foo'''s +''' 'foo' ''' +'''''foo'' ''' +''''''foo''' ''' +'''foo' ''bar' ''baz''' +'''foo''''s +'''foo'' +''foo'' ' +' ''foo'' ' +''''foo''' +'''foo''' ' +' '''foo''' ' +!! result + 'foo' +''foo'' +'''foo''' +foo's +'foo' +''foo'' +'''foo''' +foo'bar'baz +foo's +'foo +foo' +'foo' +'foo +foo' +'foo'
+!! end + +!! test +2. Link fragments separated by and tags +!! input +[[''foo''hello]] + +[['''foo'''hello]] +!! result +[[foohello]] +
[[foohello]] +
+!! end + +!! test +3. Link fragments inside and +(FIXME: Escaping one or both of [[ and ]] is also acceptable -- + this is one of the shortcomings of this format) +!! input +''[[foo'']] + +'''[[foo''']] +!! result +[[foo]] +
[[foo]] +
+!! end + +!! test +4. No escaping needed +!! input +'''bar''' +''''bar'''' +!! result +'bar' +'bar' +
+!! end + +#### ----------- Paragraphs --------------- +#### 1. No unnecessary escapes +#### -------------------------------------- + +!! test +1. No unnecessary escapes +!! input +bar[[foo]] + +=bar[[foo]] + +[[bar[[foo]] + +]]bar[[foo]] + +=bar foo]]= +!! result +bar [[foo]] +
=bar [[foo]] +
[[bar [[foo]] +
]]bar [[foo]] +
=bar foo]]= +
+!!end + +#### ----------------------- PRE -------------------------- +#### 1. Leading whitespace in SOL context should be escaped +#### ------------------------------------------------------ +!! test +1. Leading whitespace in SOL context should be escaped +!! options +parsoid +!! input +a + + a + + a(tab) + + a + + a + +a + b + +a + b + +a + b +!! result + a
+a
+a(tab)
+a
+a
+a + b
+a + b
+a + b
+!! end + +#### --------------- Behavior Switches -------------------- +!! test +1. Valid behavior switches should be escaped +!! options +parsoid=html2wt +!! input +__TOC__ +!! result +__TOC__ +!! end + +!! test +2. Invalid behavior switches should not be escaped +!! options +parsoid=html2wt +!! input +__TOO__ +__|__ +!! result +__TOO__ +__|__ +!! end + +#### --------------- HTML tags --------------- +#### 1. a tags +#### 2. other tags +#### 3. multi-line html tag +#### ----------------------------------------- +!! test +1. a tags +!! options +parsoid +!! input +google +!! result +<a href="http://google.com">google</a> +!! end + +!! test +2. other tags +!! input ++!! result + foo+foo<div>foo</div> +<div style="color:red">foo</div> +
+!! end + +!! test +3. multi-line html tag +!! input ++!! result + foo<div +>foo</div +> +
+!! end + +!! test +4. extension tags +!! input +foo +!! result +<ref>foo</ref> +
+!! end + +#### --------------- Others --------------- +!! test +Escaping nowikis +!! input +<nowiki>foo</nowiki> +!! result +<nowiki>foo</nowiki> +
+!! end + +## The quote-char in the input is necessary for triggering the bug +!! test +(Bug 52035) Nowiki-escaping should not get tripped by " :" in text +!! options +parsoid=wt2wt,html2wt +!! input +foo's bar : +!! result +foo's bar :
+!! end + +!! test + +Tag-like HTML structures are passed through as text +!! input ++ + + + + +1>2 + +x b + +1 f +!! result + <x y> +
<x.y> +
<x-y> +
1>2 +
x<y +
a>b +
1<d e>f +
+!! end + + +# This was a bug in the PHP parser (see bug 17663 and its dups, +# https://bugzilla.wikimedia.org/show_bug.cgi?id=17663) +!! test +Tag names followed by punctuation should not be recognized as tags +!! input +text +!! result + <s.ome> text +
+!! end + +!! test +HTML tag with necessary entities in attributes +!! input +foo +!! result +foo +
+!! end + +!! test +HTML tag with 'unnecessary' entity encoding in attributes +!! input +foo +!! result +foo +
+!! end + +!! test +HTML tag with broken attribute value quoting +!! input +Foo +!! result +Foo +
+!! end + +!! test +Table with broken attribute value quoting +!! input +{| +| title="Hello world|Foo +|} +!! result ++
+ +!! end + +!! test +Table with broken attribute value quoting on consecutive lines +!! input +{| +| title="Hello world|Foo +| style="color:red|Bar +|} +!! result ++ Foo + +
+ +!! end + +!! test +Parsoid-only: Table with broken attribute value quoting on consecutive lines +!! options +parsoid +!! input +{| +| title="Hello world|Foo +| style="color:red|Bar +|} +!! result ++ Foo + +Bar + +
+ +!! end + +!! test +Parsoid-only: Don't wrap broken template tags in+ Foo + Bar + on wt2wt (Bug 42353) +!! options +parsoid +!! input +{{}} +!! result +{{}} +!! end + +!! test +Parsoid-only: Don't wrap broken template tags in on wt2wt (Bug 42353) +!! options +parsoid +!! input +}}{{ +!! result +}}{{ +!! end + +!!test +Accept empty td cell attribute +!!input +{| +| align="center" | foo || | +|} +!!result + +
+ +!!end + +!!test +Non-empty attributes in th-cells +!!input +{| +! Foo !! style="color: red" | Bar +|} +!!result ++ foo ++ +
+ +!!end + +!!test +Accept empty attributes in th-cells +!!input +{| +!| foo !!| bar +|} +!!result ++ Foo +Bar + +
+ +!!end + +!!test +Empty table rows go away +!!input +{| +| Hello +| there +|- class="foo" +|- +|} +!! result ++ foo +bar + +
+ +!! end + +### +### Parsoid-centric tests for testing RTing of inter-element separators +### Edge cases not tested by existing parser tests and specific to +### Parsoid-specific serialization strategies. +### + +!!test +RT-ed inter-element separators should be valid separators +!!input +{| +|- [[foo]] +|} +!!result ++ + +Hello + +there + + +
+ +!!end + +!!test +Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out +(Parsoid-only since PHP parser relies on Tidy for correct output) +!!options +parsoid +!!input +{| +|foo +bar +|} + +{| +|foo +|} +!!result +!!end + +!!test +Empty TD followed by TD with tpl-generated attribute +!!input +{| +|- +| +|{{echo|style='color:red'}}|foo +|} +!!result ++ +
+ +!!end + +!!test +Indented table with an empty td +!!input + {| + |- + | + |foo + |} +!!result ++ + +foo + + +
+ +!!end + +!!test +Empty TR followed by a template-generated TR +(Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext) +!!options +parsoid +!!input +{| +|- +{{echo|+ + +foo + }} +|} +!!result + foo + +
+!!end + +## PHP and parsoid output differ for this, and since this is primarily +## for testing Parsoid's serializer, marking this Parsoid only +!!test +Empty TR followed by mixed-ws-comment line should RT correctly +!!options +parsoid +!!input +{| +|- + +|- + +|} +!!result ++ + +foo + +
+ +!!end + +!!test +Multi-line image caption generated by templates with/without trailing newlines +!!options +parsoid +!!input +[[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]] +[[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]] +!!result + + + +!!end + +## PHP emits broken html for this, and since this is primarily +## a Parsoid serializer test, marking this Parsoid only +!!test +Improperly nested inline or quotes tags with whitespace in between +!!options +parsoid +!!input ++ + + +x+''' ''x''' '' +!!result ++!!end + +!!test +Encapsulate protected attributes from wt +!!options +parsoid +!!input +
x+ x +foo+!!result +foo+ +!!end + +## Currently the p-wrapper is fragile in how adds / removes transformations. +## Having nested or stray pre tags results in the attempt to add duplicates, +## causing an assertion fail. This test tries to prevent that situation. +!!test +Ensure ParagraphWrapper can deal with stray closing pre tags +!!options +parsoid=wt2html +!!input +plain text +!!result +plain text +!!end + +!!test +Ensure fostered text content is wrapped in spans +!!options +parsoid=wt2html +!!input +hi
ho
+!!result +hi ++ho +
+!!end + +!!test +Encapsulation properly handles null DSR information from foster box +!!options +parsoid=wt2html,wt2wt +!!input +{{echo|
foo
}} +!!result +foo +bar + +
+!!end + +!!test +1. Encapsulate foster-parented transclusion content +!!options +parsoid=wt2wt,wt2html +!!input ++ bar {{echo|foo
+!!result +foo +}} bar + +
+!!end + +!!test +2. Encapsulate foster-parented transclusion content +!!options +parsoid=wt2wt,wt2html +!!input ++ bar +!!result +
{{echo|foo}}bar foo++ +
+!!end + +!!test +3. Encapsulate foster-parented transclusion content +!!options +parsoid=wt2wt,wt2html +!!input ++ bar +!!result +
{{echo|foo
}}bar ++foo
+ +
+!!end + +!!test +4. Encapsulate foster-parented transclusion content +!!options +parsoid=wt2wt,wt2html +!!input ++ bar +!!result +
{{echo|foo
}}bar ++foo
+ +
+!!end + +!!test +5. Encapsulate foster-parented transclusion content +!!options +parsoid=wt2wt,wt2html +!!input ++ bar +!!result +foo +
foo}} {{echo|foo
+ +
+!!end + +!!test +6. Encapsulate foster-parented transclusion content +!!options +parsoid=wt2wt,wt2html +!!input ++ + +foo
}}
foo {{echo|foo
ok
+!!result +foo ++ +
++ + +foo
ok
+!!end + +!!test +7. Encapsulate foster-parented transclusion content +!!options +parsoid=wt2wt,wt2html +!!input +{{echo|
+!!result +foo
}}bar foo
++ +
+!!end -'''[[foo'''+ bar ]] -!! result -[[foo]] -
[[foo]] -
-!! end +!!test +8. Encapsulate foster-parented transclusion content +!!options +parsoid=wt2wt,wt2html +!!input +{{echo|a +}}{|{{echo|style='color:red'}} +|- +|b +|} +!!result +a
{{{1}}} ++ +
+!!end -#### --------------- Paragraphs --------------- -#### 1. No unnecessary escapes -#### -------------------------------------- +# ----------------------------------------------------------------- +# The following section of tests are primarily to spec requirements +# around serialization of new/edited content. +# +# All these tests are marked Parsoid html2wt and html2html only +# ---------------------------------------------------------------- !! test -1. No unnecessary escapes +Image: Modifying size of an image +!! options +parsoid=html2wt !! input -bar+ b [[foo]] - -=bar[[foo]] - -[[bar[[foo]] - -]]bar [[foo]] - -=bar foo]]= +[[Image:Wiki.png|230x230px]] !! result -bar [[foo]] -
=bar [[foo]] -
[[bar [[foo]] -
]]bar [[foo]] -
=bar foo]]= -
+ !!end -#### --------------- PRE ------------------ -#### 1. Leading space in SOL context should be escaped -#### -------------------------------------- !! test -1. Leading space in SOL context should be escaped +Image: New block level image should have \n before and after !! options -disabled +parsoid=html2wt !! input -foo -foo +123 +[[File:Wiki.png|right|thumb|150x150px]] +456 !! result -foo - foo -
-!! end +123
456
+!!end -#### --------------- HTML tags --------------- -#### 1. a tags -#### 2. other tags -#### 3. multi-line html tag -#### -------------------------------------- +# Wacky -- the leading newline in input is required because +# that is what the serializer emits. To be fixed. Not fixing +# the test because this test is required to test serialization of +# new content and preferred whitespace style. !! test -1. a tags +Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does) !! options -disabled +parsoid=html2wt !! input -google -!! result -<a href="http://google.com">google</a> -!! end -!! test -2. other tags -!! input -+* foo !! result - foo-foo<div>foo</div> -<div style="color:red">foo</div> -
++
!! end +# Wacky -- the leading newline in input is required because +# that is what the serializer emits. To be fixed. Not fixing +# the test because this test is required to test serialization of +# new content and preferred whitespace style. !! test -3. multi-line html tag +Lists: Add space after bullets +!! options +parsoid=html2wt !! input -- +
foo
-!! result - foo<div ->foo</div -> -
-!! end -#### --------------- Others --------------- -!! test -Escaping nowikis -!! input -<nowiki>foo</nowiki> +* foo +* bar +* baz !! result -<nowiki>foo</nowiki> -
++
!! end !! test -Tag-like HTML structures are passed through as text +Parsoid: Serialize positional parameters with = in them as named parameter +!! options +parsoid=html2wt !! input -- foo
+- bar
+- baz
+- - +{{echo|1 = f=oo}} - - -1>2 +{{echo|1 = f=oo|2 = bar}} -x + +{{echo| f=oo |bar}} +!! result +foo
-a>b +foo
-1f -!! result - <x y> -
<x.y> -
<x-y> -
1>2 -
x<y -
a>b -
1<d e>f -
+ + +foo
!! 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 +Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes !! options -disabled +parsoid=html2wt !! input -text -!! result - <s.ome> text -
-!! end +a +b ++a +b +++a -!! test -HTML tag with necessary entities in attributes -!! input -foo +b +!! result -foo -
+a+b
a ++b
+a +!! end -!! test -HTML tag with 'unnecessary' entity encoding in attributes -!! input -foo -!! result -b
foo -
-!! end +#----------------------------- +# I/B quote minimization tests +#----------------------------- !! test -HTML tag with broken attribute value quoting +1. I/B quote minimization: wikitext-only tags should be combined +!! options +parsoid=html2wt !! input -Foo -!! result -Foo -
-!! end +''A''B -!! test -Table with broken attribute value quoting -!! input -{| -| title="Hello world|Foo -|} +''A'''''B''' !! result --
- +- Foo - AB
+AB
!! end !! test -Table with broken attribute value quoting on consecutive lines +3. I/B quote minimization: templated content stops minimization +!! options +parsoid=html2wt !! input -{| -| title="Hello world|Foo -| style="color:red|Bar -|} -!! result --
+''A''{{echo|''B''}} +''A''{{echo|'''''B'''''}} +!! result +- Foo - -Bar - AB +
AB !! end !! test -Parsoid-only: Table with broken attribute value quoting on consecutive lines +4. I/B quote minimization: new content should be mimimized with adjacent old content !! options -parsoid +parsoid=html2wt !! input -{| -| title="Hello world|Foo -| style="color:red|Bar -|} -!! result -
-
- -!! end - -!!test -Accept empty td cell attribute -!!input -{| -| align="center" | foo || | -|} -!!result -- Foo - Bar - -
- -!!end - -!!test -Non-empty attributes in th-cells -!!input -{| -! Foo !! style="color: red" | Bar -|} -!!result -- foo -- -
- -!!end - -!!test -Accept empty attributes in th-cells -!!input -{| -!| foo !!| bar -|} -!!result -- Foo -Bar - -
+''AB'' -!!end +'''AB''' -!!test -Empty table rows go away -!!input -{| -| Hello -| there -|- class="foo" -|- -|} +''A'''B''''' !! result -- foo -bar - -
- +- - -Hello - -there - AB
+AB
+AB
!! end +# ----------------------------------------------------------------- +# End of section for Parsoid-only html2wt tests for serialization +# of new content +# ----------------------------------------------------------------- + TODO: more images more tables -- cgit v1.2.2