# MediaWiki Parser test cases
# Some taken from http://meta.wikimedia.org/wiki/Parser_testing
# All (C) their respective authors and released under the GPL
#
# The syntax should be fairly self-explanatory.
#
# Currently supported test options:
# One of the following three:
#
# (default) generate HTML output
# pst apply pre-save transform
# msg apply message transform
#
# Plus any combination of these:
#
# cat add category links
# ill add inter-language links
# subpage enable subpages (disabled by default)
# noxml don't check for XML well formdness
# title=[[XXX]] run test using article title XXX
# language=XXX set content language to XXX for this test
# variant=XXX set the variant of language for this test (eg zh-tw)
# disabled do not run test
# parsoid parsoid-specific options (not run by PHP parser unless
# the test includes an html/php section)
# php php-only test (not run by the parsoid parser unless
# the test includes an html/parsoid section)
# showtitle make the first line the title
# comment run through Linker::formatComment() instead of main parser
# local format section links in edit comment text as local links
# notoc disable table of contents
# thumbsize=NNN set the default thumb size to NNNpx for this test
#
# You can also set the following parser properties via test options:
# wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
# wgLinkHolderBatchSize, wgRawHtml
#
# For testing purposes, temporary articles can created:
# !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
# where '/' denotes a newline.
# This is the standard article assumed to exist.
!! article
Main Page
!! text
blah blah
!! endarticle
!!article
Foo
!!text
FOO
!!endarticle
!!article
Template:Foo
!!text
FOO
!!endarticle
!! article
Template:Blank
!! text
!! endarticle
!! article
Template:pipe
!! text
|
!! endarticle
!!article
MediaWiki:bad image list
!!text
* [[File:Bad.jpg]] except [[Nasty page]]
!!endarticle
!! article
Template:inner list
!! text
* item 1
!! endarticle
!! article
Template:tbl-start
!! text
{|
!! endarticle
!! article
Template:tbl-end
!! text
|}
!! endarticle
!! article
Template:echo
!! text
{{{1}}}
!! endarticle
!! article
Template:echo_with_span
!! text
<span>{{{1}}}</span>
!! endarticle
!! article
Template:echo_with_div
!! text
<div>{{{1}}}</div>
!! endarticle
!! article
Template:attr_str
!! text
{{{1}}}="{{{2}}}"
!! endarticle
!! article
Template:table_attribs
!! text
<noinclude>
|</noinclude>style="color: red"| Foo
!! endarticle
!! article
Template:table_cells
!! text
{{table_attribs}} || Bar || Baz
!! endarticle
!! article
Template:image_attribs
!! text
<noinclude>
[[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
!! endarticle
!! article
A?b
!! text
Weirdo titles!
!! endarticle
!!article
Template:Bullet
!!text
* Bar
!!endarticle
!!article
Template:OpenTable
!!text
{|
!!endarticle
###
### Basic tests
###
!! test
Blank input
!! wikitext
!! html
!! end
!! test
Simple paragraph
!! wikitext
This is a simple paragraph.
!! html
<p>This is a simple paragraph.
</p>
!! end
!! test
Paragraphs with extra newline spacing
!! wikitext
foo
bar
baz
booz
!! html
<p>foo
</p><p>bar
</p><p><br />
baz
</p><p><br />
</p><p>booz
</p>
!! end
!! test
Paragraphs with newline spacing with comment lines in between
!! wikitext
----
a
<!--foo-->
b
----
a
<!--foo--><!--More than 1 comment, still stripped-->
b
----
a
<!--foo--> <!----> <!-- bar -->
b
----
a
<!--foo-->
b
----
a
<!--foo-->
b
----
a
<!--foo-->
b
----
a
<!--foo-->
b
----
!! html
<hr />
<p>a
b
</p>
<hr />
<p>a
b
</p>
<hr />
<p>a
b
</p>
<hr />
<p>a
</p><p>b
</p>
<hr />
<p>a
</p><p>b
</p>
<hr />
<p>a
</p><p><br />
b
</p>
<hr />
<p>a
</p><p><br />
b
</p>
<hr />
!! end
!! test
Paragraphs with newline spacing with non-empty white-space lines in between
!! wikitext
----
a
b
----
a
b
----
!! html
<hr />
<p>a
</p><p>b
</p>
<hr />
<p>a
</p><p><br />
b
</p>
<hr />
!! end
!! test
Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
!! wikitext
----
a
<!--foo-->
b
----
a
<!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
b
----
a
<!--foo-->
<!--bar-->
b
----
a
<!--foo-->
<!--bar-->
b
----
!! html
<hr />
<p>a
b
</p>
<hr />
<p>a
b
</p>
<hr />
<p>a
</p><p>b
</p>
<hr />
<p>a
</p><p><br />
b
</p>
<hr />
!! end
!! test
Extra newlines: More paragraphs with indented comment
!! wikitext
a
<!--boo-->
b
!! html
<p>a
</p><p><br />
b
</p>
!!end
!! test
Extra newlines followed by heading
!! wikitext
a
=b=
[[a]]
=b=
!! html
<p>a
</p><p><br />
</p>
<h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
<p><a href="/index.php?title=A&action=edit&redlink=1" class="new" title="A (page does not exist)">a</a>
</p><p><br />
</p>
<h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
!! end
!! test
Extra newlines between heading and content are swallowed
!! wikitext
=b=
[[a]]
!! html
<h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
<p><a href="/index.php?title=A&action=edit&redlink=1" class="new" title="A (page does not exist)">a</a>
</p>
!! end
!! test
Parsing an URL
!! wikitext
http://fr.wikipedia.org/wiki/🍺
<!-- EasterEgg we love beer, better be able be able to link to it -->
!! html
<p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
</p>
!! end
# Note that the html+tidy output removes the spaces after the <li>,
# which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
# This is an issue for all tests with lists. We intentionally do
# *not* add html+tidy clauses for these, as we don't want to
# document/test the broken behavior. (Parsoid matches the non-tidy
# output in these cases.)
!! test
Simple list
!! wikitext
* Item 1
* Item 2
!! html
<ul><li> Item 1</li>
<li> Item 2</li></ul>
!! end
!! test
Italics and bold
!! wikitext
* plain
* plain''italic''plain
* plain''italic''plain''italic''plain
* plain'''bold'''plain
* plain'''bold'''plain'''bold'''plain
* plain''italic''plain'''bold'''plain
* plain'''bold'''plain''italic''plain
* plain''italic'''bold-italic'''italic''plain
* plain'''bold''bold-italic''bold'''plain
* plain'''''bold-italic'''italic''plain
* plain'''''bold-italic''bold'''plain
* plain''italic'''bold-italic'''''plain
* plain'''bold''bold-italic'''''plain
* plain l'''italic''plain
* plain l''''bold''' plain
!! html
<ul><li> plain</li>
<li> plain<i>italic</i>plain</li>
<li> plain<i>italic</i>plain<i>italic</i>plain</li>
<li> plain<b>bold</b>plain</li>
<li> plain<b>bold</b>plain<b>bold</b>plain</li>
<li> plain<i>italic</i>plain<b>bold</b>plain</li>
<li> plain<b>bold</b>plain<i>italic</i>plain</li>
<li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
<li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
<li> plain<i><b>bold-italic</b>italic</i>plain</li>
<li> plain<b><i>bold-italic</i>bold</b>plain</li>
<li> plain<i>italic<b>bold-italic</b></i>plain</li>
<li> plain<b>bold<i>bold-italic</i></b>plain</li>
<li> plain l'<i>italic</i>plain</li>
<li> plain l'<b>bold</b> plain</li></ul>
!! end
# this example taken from the [[simple:Moon]] article (bug 47326)
!! test
Italics and possessives (1)
!! wikitext
obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
!! html
<p>obtained by <i><a href="/index.php?title=Lunar_Prospector&action=edit&redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
</p>
!! end
# this example taken from [[en:Flaming Pie]] (bug 49926)
!! test
Italics and possessives (2)
!! wikitext
'''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
!! html
<p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
</p>
!! end
# this example taken from [[en:Dictionary]] (bug 49926)
!! test
Italics and possessives (3)
!! wikitext
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''.
!! html
<p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&action=edit&redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
</p>
!! end
###
### 2-quote opening sequence tests
###
!! test
Italics and bold: 2-quote opening sequence: (2,2)
!! wikitext
''foo''
!! html
<p><i>foo</i>
</p>
!!end
!! test
Italics and bold: 2-quote opening sequence: (2,3)
!! options
parsoid=wt2html
!! wikitext
''foo'''
!! html/*
<p><i>foo'</i>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
!! wikitext
''<nowiki>foo'</nowiki>''
!! html
<p><i>foo'</i>
</p>
!! end
!! test
Italics and bold: 2-quote opening sequence: (2,4)
!! options
parsoid=wt2html
!! wikitext
''foo''''
!! html/*
<p><i>foo''</i>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
!! wikitext
''<nowiki>foo''</nowiki>''
!! html
<p><i>foo''</i>
</p>
!! end
# The PHP parser strips the empty tags out for giggles; parsoid doesn't.
!! test
Italics and bold: 2-quote opening sequence: (2,5)
!! options
parsoid=wt2html
!! wikitext
''foo'''''
!! html/php
<p><i>foo</i>
</p>
!! html/parsoid
<p><i>foo</i><b></b>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
!! wikitext
''foo'''''<nowiki/>'''
!! html/php
<p><i>foo</i>
</p>
!! html/parsoid
<p><i>foo</i><b></b>
</p>
!! end
###
### 3-quote opening sequence tests
###
!! test
Italics and bold: 3-quote opening sequence: (3,2)
!! wikitext
'''foo''
!! html
<p>'<i>foo</i>
</p>
!!end
!! test
Italics and bold: 3-quote opening sequence: (3,3)
!! wikitext
'''foo'''
!! html
<p><b>foo</b>
</p>
!!end
!! test
Italics and bold: 3-quote opening sequence: (3,4)
!! options
parsoid=wt2html
!! wikitext
'''foo''''
!! html/*
<p><b>foo'</b>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
!! wikitext
'''<nowiki>foo'</nowiki>'''
!! html
<p><b>foo'</b>
</p>
!! end
# The PHP parser strips the empty tags out for giggles; parsoid doesn't.
!! test
Italics and bold: 3-quote opening sequence: (3,5)
!! options
parsoid=wt2html
!! wikitext
'''foo'''''
!! html/php
<p><b>foo</b>
</p>
!! html/parsoid
<p><b>foo</b><i></i>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
!! wikitext
'''foo'''''<nowiki/>''
!! html/php
<p><b>foo</b>
</p>
!! html/parsoid
<p><b>foo</b><i></i>
</p>
!! end
###
### 4-quote opening sequence tests
###
!! test
Italics and bold: 4-quote opening sequence: (4,2)
!! options
parsoid=wt2html
!! wikitext
''''foo''
!! html/*
<p>''<i>foo</i>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
!! wikitext
<nowiki>''</nowiki>''foo''
!! html
<p>''<i>foo</i>
</p>
!! end
!! test
Italics and bold: 4-quote opening sequence: (4,3)
!! wikitext
''''foo'''
!! html
<p>'<b>foo</b>
</p>
!!end
!! test
Italics and bold: 4-quote opening sequence: (4,4)
!! options
parsoid=wt2html
!! wikitext
''''foo''''
!! html/*
<p>'<b>foo'</b>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
!! wikitext
''''<nowiki>foo'</nowiki>'''
!! html
<p>'<b>foo'</b>
</p>
!! end
# The PHP parser strips the empty tags out for giggles; parsoid doesn't.
!! test
Italics and bold: 4-quote opening sequence: (4,5)
!! options
parsoid=wt2html
!! wikitext
''''foo'''''
!! html/php
<p>'<b>foo</b>
</p>
!! html/parsoid
<p>'<b>foo</b><i></i>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
!! wikitext
''''foo'''''<nowiki/>''
!! html/php
<p>'<b>foo</b>
</p>
!! html/parsoid
<p>'<b>foo</b><i></i>
</p>
!! end
###
### 5-quote opening sequence tests
###
!! test
Italics and bold: 5-quote opening sequence: (5,2)
!! options
parsoid=wt2html
!! wikitext
'''''foo''
!! html/*
<p><b><i>foo</i></b>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
# skipping wt2html and html2html because it wants to put <i> before <b>
!! test
Italics and bold: 5-quote opening sequence: (5,2+3)
!! options
parsoid=wt2wt,html2wt
!! wikitext
'''''foo'''''
!! html
<p><b><i>foo</i></b>
</p>
!! end
!! test
Italics and bold: 5-quote opening sequence: (5,3)
!! options
parsoid=wt2html
!! wikitext
'''''foo'''
!! html/*
<p><i><b>foo</b></i>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: 5-quote opening sequence: (5,3+2)
!! wikitext
'''''foo'''''
!! html
<p><i><b>foo</b></i>
</p>
!! end
!! test
Italics and bold: 5-quote opening sequence: (5,4)
!! options
parsoid=wt2html
!! wikitext
'''''foo''''
!! html/*
<p><i><b>foo'</b></i>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
!! wikitext
'''''<nowiki>foo'</nowiki>'''''
!! html
<p><i><b>foo'</b></i>
</p>
!! end
!! test
Italics and bold: 5-quote opening sequence: (5,5)
!! wikitext
'''''foo'''''
!! html
<p><i><b>foo</b></i>
</p>
!!end
###
### multiple quote sequences in a line
###
!! test
Italics and bold: multiple quote sequences: (2,4,2)
!! options
parsoid=wt2html
!! wikitext
''foo''''bar''
!! html/*
<p><i>foo'<b>bar</b></i>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
!! wikitext
''<nowiki>foo'</nowiki>'''bar'''''
!! html
<p><i>foo'<b>bar</b></i>
</p>
!! end
!! test
Italics and bold: multiple quote sequences: (2,4,3)
!! options
parsoid=wt2html
!! wikitext
''foo''''bar'''
!! html/*
<p><i>foo'<b>bar</b></i>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
!! wikitext
''<nowiki>foo'</nowiki>'''bar'''''
!! html
<p><i>foo'<b>bar</b></i>
</p>
!! end
!! test
Italics and bold: multiple quote sequences: (2,4,4)
!! options
parsoid=wt2html
!! wikitext
''foo''''bar''''
!! html/*
<p><i>foo'<b>bar'</b></i>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
!! wikitext
''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>'''''
!! html
<p><i>foo'<b>bar'</b></i>
</p>
!! end
# The PHP parser strips the empty tags out for giggles; parsoid doesn't.
!! test
Italics and bold: multiple quote sequences: (3,4,2)
!! options
parsoid=wt2html
!! wikitext
'''foo''''bar''
!! html/php
<p><b>foo'</b>bar
</p>
!! html/parsoid
<p><b>foo'</b>bar<i></i>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
!! options
parsoid
!! wikitext
'''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
!! html/php
<p><b>foo'</b>bar
</p>
!! html/parsoid
<p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
</p>
!! end
# The PHP parser strips the empty tags out for giggles; parsoid doesn't.
!! test
Italics and bold: multiple quote sequences: (3,4,3)
!! options
parsoid=wt2html
!! wikitext
'''foo''''bar'''
!! html/php
<p><b>foo'</b>bar
</p>
!! html/parsoid
<p><b>foo'</b>bar<b></b>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
!! wikitext
'''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
!! html/php
<p><b>foo'</b>bar
</p>
!! html/parsoid
<p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
</p>
!! end
###
### other quote tests
###
!! test
Italics and bold: other quote tests: (2,3,5)
!! wikitext
''this is about '''foo's family'''''
!! html
<p><i>this is about <b>foo's family</b></i>
</p>
!!end
!! test
Italics and bold: other quote tests: (2,(3,3),2)
!! wikitext
''this is about '''foo's''' family''
!! html
<p><i>this is about <b>foo's</b> family</i>
</p>
!!end
!! test
Italics and bold: other quote tests: (3,2,3,2)
!! options
parsoid=wt2html
!! wikitext
'''this is about ''foo'''s family''
!! html/*
<p><b>this is about <i>foo</i></b><i>s family</i>
</p>
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
# add 'parsoid' option to use 'parsoid' normalization of the placeholder
!! test
Italics and bold: other quote tests: (3,2,3+2+2,2)
!! options
parsoid
!! wikitext
'''this is about ''foo'''''<nowiki/>''s family''
!! html/*
<p><b>this is about <i>foo</i></b><i>s family</i>
</p>
!! end
!! test
Italics and bold: other quote tests: (3,2,3,3)
!! options
!! wikitext
'''this is about ''foo'''s family'''
!! html
<p>'<i>this is about </i>foo<b>s family</b>
</p>
!!end
!! test
Italics and bold: other quote tests: (3,(2,2),3)
!! wikitext
'''this is about ''foo's'' family'''
!! html
<p><b>this is about <i>foo's</i> family</b>
</p>
!!end
!! test
Italicized possessive
!! wikitext
The ''[[Main Page]]'''s talk page.
!! html
<p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
</p>
!! 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
!! wikitext
{|
!''a!!''b
|''a||''b
|}
!! html/php+tidy
<table>
<tr>
<th><i>a</i></th>
<th><i>b</i></th>
<td><i>a</i></td>
<td><i>b</i></td>
</tr>
</table>
!! html/parsoid
<table>
<tbody><tr><th><i>a</i></th><th><i>b</i></th>
<td><i>a</i></td><td><i>b</i></td></tr>
</tbody></table>
!! end
###
### Non-html5 tags
###
!! test
Non-html5 tags should be accepted
!! wikitext
<center>''foo''</center>
<big>''foo''</big>
<font>''foo''</font>
<strike>''foo''</strike>
<tt>''foo''</tt>
!! html
<center><i>foo</i></center>
<p><big><i>foo</i></big>
<font><i>foo</i></font>
<strike><i>foo</i></strike>
<tt><i>foo</i></tt>
</p>
!! end
!! test
<wbr> is valid wikitext (bug 52468)
!! wikitext
<wbr>
!! html
<p><wbr />
</p>
!! end
# <strike> is HTML4, <s> is HTML4/5.
!! test
<s> or <strike> for strikethrough
!! wikitext
<strike>strike</strike>
<s>s</s>
!! html
<p><strike>strike</strike>
</p><p><s>s</s>
</p>
!! end
## a not permitted
## i,b,br omitted
!! test
Text-level semantic html elements in wikitext
!! wikitext
<em>text</em>
<strong>text</strong>
<small>text</small>
<s>text</s>
<cite>text</cite>
<q>text</q>
<dfn>text</dfn>
<abbr>text</abbr>
<data>text</data>
<time>text</time>
<code>text</code>
<var>text</var>
<samp>text</samp>
<kbd>text</kbd>
<sub>text</sub>
<u>text</u>
<mark>text</mark>
<ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
<bdi>text</bdi>
<bdo>text</bdo>
<span>text</span>
<wbr />
!! html
<p><em>text</em>
<strong>text</strong>
<small>text</small>
<s>text</s>
<cite>text</cite>
<q>text</q>
<dfn>text</dfn>
<abbr>text</abbr>
<data>text</data>
<time>text</time>
<code>text</code>
<var>text</var>
<samp>text</samp>
<kbd>text</kbd>
<sub>text</sub>
<u>text</u>
<mark>text</mark>
<ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
<bdi>text</bdi>
<bdo>text</bdo>
<span>text</span>
<wbr />
</p>
!! end
# test cases taken from
# http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
!! test
Ruby markup (W3C-style)
!! wikitext
; Mono-ruby for individual base characters
: <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
; Group ruby
: <ruby>今日<rt>きょう</rt></ruby>
; Jukugo ruby
: <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
; Inline ruby
: <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
; Double-sided ruby
: <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
<ruby>
<rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
<rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
<rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
</ruby>
!! html
<dl><dt> Mono-ruby for individual base characters</dt>
<dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
<dt> Group ruby</dt>
<dd> <ruby>今日<rt>きょう</rt></ruby></dd>
<dt> Jukugo ruby</dt>
<dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
<dt> Inline ruby</dt>
<dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
<dt> Double-sided ruby</dt>
<dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
<p><ruby>
<rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
<rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
<rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
</ruby>
</p>
!! end
# There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
!! test
Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
!! wikitext
<b→> doesn't work! </b→>
<bä> doesn't work! </bä>
<boo> works fine </boo>
<s.foo>s.foo</s.foo>
<sub-ID#1>
!! html
<p><b→> doesn't work! </b→>
</p><p><bä> doesn't work! </bä>
</p><p><boo> works fine </boo>
</p><p><s.foo>s.foo</s.foo>
</p><p><sub-ID#1>
</p>
!! end
!! test
Isolated close tags should be treated as literal text (bug 52760)
!! wikitext
</b>
<s.foo>s</s>
!! html
<p></b>
</p><p><s.foo>s</s>
</p>
!! end
###
### Special characters
###
!! test
Bare pipe character (bug 52363)
!! wikitext
|
!! html
<p>|
</p>
!! end
!! test
Bare pipe character from a template (bug 52363)
!! wikitext
{{pipe}}
!! html
<p>|
</p>
!! end
###
### <nowiki> test cases
###
!! test
<nowiki> unordered list
!! wikitext
<nowiki>* This is not an unordered list item.</nowiki>
!! html
<p>* This is not an unordered list item.
</p>
!! end
!! test
<nowiki> spacing
!! wikitext
<nowiki>Lorem ipsum dolor
sed abit.
sed nullum.
:and a colon
</nowiki>
!! html
<p>Lorem ipsum dolor
sed abit.
sed nullum.
:and a colon
</p>
!! end
!! test
nowiki 3
!! wikitext
:There is not nowiki.
:There is <nowiki>nowiki</nowiki>.
#There is not nowiki.
#There is <nowiki>nowiki</nowiki>.
*There is not nowiki.
*There is <nowiki>nowiki</nowiki>.
!! html
<dl><dd>There is not nowiki.</dd>
<dd>There is nowiki.</dd></dl>
<ol><li>There is not nowiki.</li>
<li>There is nowiki.</li></ol>
<ul><li>There is not nowiki.</li>
<li>There is nowiki.</li></ul>
!! end
!! test
Entities inside <nowiki>
!! wikitext
<nowiki><</nowiki>
!! html
<p><
</p>
!! end
!! test
Entities inside template parameters
!! options
parsoid
!! wikitext
{{echo|–}}
!! html
<p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&ndash;"}},"i":0}}]}'>–</span>
</p>
!! end
!! test
Properly escape nowiki when combined with other wiki markup
!! options
parsoid=html2wt
!! wikitext
<nowiki>* </nowiki></nowiki> tag
!! html
<p>* </nowiki> tag</p>
!! end
###
### Comments
###
!! test
Comments and Indent-Pre
!! wikitext
<!-- comment 1 --> asdf
<!-- comment 1 --> asdf
<!-- comment 2 -->
<!-- comment 1 --> asdf
<!-- comment 2 -->xyz
<!-- comment 1 --> asdf
<!-- comment 2 --> xyz
!! html
<pre>asdf
</pre>
<pre>asdf
</pre>
<pre>asdf
</pre>
<p>xyz
</p>
<pre>asdf
xyz
</pre>
!! end
!! test
Comment test 2a
!! wikitext
asdf
<!-- comment 1 -->
jkl
!! html
<p>asdf
jkl
</p>
!! end
!! test
Comment test 2b
!! wikitext
asdf
<!-- comment 1 -->
jkl
!! html
<p>asdf
</p><p>jkl
</p>
!! end
!! test
Comment test 3
!! wikitext
asdf
<!-- comment 1 -->
<!-- comment 2 -->
jkl
!! html
<p>asdf
jkl
</p>
!! end
!! test
Comment test 4
!! wikitext
asdf<!-- comment 1 -->jkl
!! html
<p>asdfjkl
</p>
!! end
!! test
Comment spacing
!! wikitext
a
<!-- foo --> b <!-- bar -->
c
!! html
<p>a
</p>
<pre> b
</pre>
<p>c
</p>
!! end
!! test
Comment whitespace
!! wikitext
<!-- returns a single newline, not nothing, since the newline after > is not stripped -->
!! html
!! end
!! test
Comment semantics and delimiters
!! wikitext
<!-- --><!----><!-----><!------>
!! html
!! end
!! test
Comment semantics and delimiters, redux
!! wikitext
<!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
-- foo -- funky huh? ... -->
!! html
!! end
!! test
Comment semantics and delimiters: directors cut
!! wikitext
<!-- ... However we like to keep things simple and somewhat XML-ish so we eat
everything starting with < followed by !-- until the first -- and > we see,
that wouldn't be valid XML however, since in XML -- has to terminate a comment
-->-->
!! html
<p>-->
</p>
!! end
!! test
Comment semantics: nesting
!! wikitext
<!--<!-- no, we're not going to do anything fancy here -->-->
!! html
<p>-->
</p>
!! end
!! test
Comment semantics: unclosed comment at end
!! wikitext
<!--This comment will run out to the end of the document
!! html
!! end
!! test
Comment in template title
!! wikitext
{{f<!---->oo}}
!! html
<p>FOO
</p>
!! end
!! test
Comment on its own line post-expand
!! wikitext
a
{{blank}}<!---->
b
!! html
<p>a
</p><p>b
</p>
!! end
!! test
Comment on its own line post-expand with non-significant whitespace
!! wikitext
a
{{blank}} <!---->
b
!! html
<p>a
</p><p>b
</p>
!! end
!! test
Multiple comments should still parse as SOL-transparent
!! options
parsoid=wt2html,wt2wt
!! wikitext
<!--c1-->*a
<!--c2--><!--c3--><!--c4-->*b
!! html
<ul>
<li>a
</li>
<li>b
</li>
</ul>
!! end
###
### paragraph wrapping tests
###
!! test
No block tags
!! wikitext
a
b
!! html
<p>a
</p><p>b
</p>
!! end
!! test
Block tag on one line (<div>)
!! wikitext
a <div>foo</div>
b
!! html
a <div>foo</div>
<p>b
</p>
!! html+tidy
<p>a</p>
<div>foo</div>
<p>b</p>
!! end
!! test
Block tag on one line (<blockquote>)
!! wikitext
a <blockquote>foo</blockquote>
b
!! html
a <blockquote>foo</blockquote>
<p>b
</p>
!! html+tidy
<p>a</p>
<blockquote>
<p>foo</p>
</blockquote>
<p>b</p>
!! end
!! test
Block tag on both lines (<div>)
!! wikitext
a <div>foo</div>
b <div>foo</div>
!! html
a <div>foo</div>
b <div>foo</div>
!! html+tidy
<p>a</p>
<div>foo</div>
<p>b</p>
<div>foo</div>
!! end
!! test
Block tag on both lines (<blockquote>)
!! wikitext
a <blockquote>foo</blockquote>
b <blockquote>foo</blockquote>
!! html
a <blockquote>foo</blockquote>
b <blockquote>foo</blockquote>
!! html+tidy
<p>a</p>
<blockquote>
<p>foo</p>
</blockquote>
<p>b</p>
<blockquote>
<p>foo</p>
</blockquote>
!! end
!! test
Multiple lines without block tags
!! wikitext
<div>foo</div> a
b
c
d<!--foo--> e
x <div>foo</div> z
!! html
<div>foo</div> a
<p>b
c
d e
</p>
x <div>foo</div> z
!! html+tidy
<div>foo</div>
<p>a</p>
<p>b c d e</p>
<p>x</p>
<div>foo</div>
<p>z</p>
!! end
!! test
Empty lines between lines with block tags
!! wikitext
<div></div>
<div></div>a
b
<div>a</div>b
<div>b</div>d
<div>e</div>
!! html
<div></div>
<p><br />
</p>
<div></div>a
<p>b
</p>
<div>a</div>b
<div>b</div>d
<p><br />
</p>
<div>e</div>
!! html+tidy
<p><br /></p>
<p>a</p>
<p>b</p>
<div>a</div>
<p>b</p>
<div>b</div>
<p>d</p>
<p><br /></p>
<div>e</div>
!! end
## PHP parser emits output which is broken
## XXX The parsoid output doesn't match the tidy output.
!! test
Unclosed HTML p-tags should be handled properly
!! wikitext
<div><p>foo</div>
a
b
!! html/php+tidy
<div>
<p>foo</div></p>
<p>a</p>
b</div>
!! html/parsoid
<div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
<p>a</p>
<p>b</p>
!! end
###
### Preformatted text
###
!! test
Preformatted text
!! wikitext
This is some
Preformatted text
With ''italic''
And '''bold'''
And a [[Main Page|link]]
!! html
<pre>This is some
Preformatted text
With <i>italic</i>
And <b>bold</b>
And a <a href="/wiki/Main_Page" title="Main Page">link</a>
</pre>
!! end
!! test
Tabs don't trigger preformatted text
!! wikitext
This is not
preformatted text.
This is preformatted text.
So is this.
!! html
<p> This is not
preformatted text.
</p>
<pre>This is preformatted text.
So is this.
</pre>
!! end
!! test
Ident preformatting with inline content
!! wikitext
a
''b''
!! html
<pre>a
<i>b</i>
</pre>
!! end
!! test
<pre> with <nowiki> inside (compatibility with 1.6 and earlier)
!! wikitext
<pre><nowiki>
<b>
<cite>
<em>
</nowiki></pre>
!! html
<pre>
<b>
<cite>
<em>
</pre>
!! end
!! test
Regression with preformatted in <center>
!! wikitext
<center>
Blah
</center>
!! html
<center>
<pre>Blah
</pre>
</center>
!! end
!! test
Bug 52763: Preformatted in <blockquote>
!! wikitext
<blockquote>
Blah
{|
|
indented cell (no pre-wrapping!)
|}
</blockquote>
!! html
<blockquote>
<p> Blah
</p>
<table>
<tr>
<td>
<p> indented cell (no pre-wrapping!)
</p>
</td></tr></table>
</blockquote>
!! end
!! test
Bug 51086: Double newlines in blockquotes should be turned into paragraphs
!! wikitext
<blockquote>
Foo
Bar
</blockquote>
!! html
<blockquote>
<p>Foo
</p><p>Bar
</p>
</blockquote>
!! end
!! test
Bug 15491: <ins>/<del> in blockquote
!! wikitext
<blockquote>
Foo <del>bar</del> <ins>baz</ins> quux
</blockquote>
!! html
<blockquote>
<p>Foo <del>bar</del> <ins>baz</ins> quux
</p>
</blockquote>
!! 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 a <p> tag. (see comment 23-25 of bug #6200)
!! test
Bug 15491: <ins>/<del> in blockquote (2)
!! wikitext
<blockquote>Foo <del>bar</del> <ins>baz</ins> quux
</blockquote>
!! html
<blockquote>Foo <del>bar</del> <ins>baz</ins> quux
</blockquote>
!! html+tidy
<blockquote>
<p>Foo</p>
<del>bar</del> <ins>baz</ins> quux</blockquote>
!! end
!! test
<pre> with attributes (bug 3202)
!! wikitext
<pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
!! html
<pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
!! end
!! test
<pre> with width attribute (bug 3202)
!! wikitext
<pre width="8">Narrow screen goodies</pre>
!! html
<pre width="8">Narrow screen goodies</pre>
!! end
!! test
<pre> with forbidden attribute (bug 3202)
!! wikitext
<pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
!! html
<pre width="8">Narrow screen goodies</pre>
!! end
!! test
Entities inside <pre>
!! wikitext
<pre><</pre>
!! html
<pre><</pre>
!! end
!! test
<pre> with forbidden attribute values (bug 3202)
!! wikitext
<pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
!! html
<pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
!! end
!! test
<nowiki> inside <pre> (bug 13238)
!! wikitext
<pre>
<nowiki>
</pre>
<pre>
<nowiki></nowiki>
</pre>
<pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
!! html
<pre>
<nowiki>
</pre>
<pre>
</pre>
<pre><nowiki>Foo</nowiki></pre>
!! end
!! test
<nowiki> and <pre> preference (first one wins)
!! wikitext
<pre>
<nowiki>
</pre>
</nowiki>
</pre>
<nowiki>
<pre>
<nowiki>
</pre>
</nowiki>
</pre>
!! html
<pre>
<nowiki>
</pre>
<p></nowiki>
</pre>
</p><p>
<pre>
<nowiki>
</pre>
</pre>
</p>
!! end
!! test
</pre> inside nowiki
!! wikitext
<nowiki></pre></nowiki>
!! html
<p></pre>
</p>
!! end
!! test
Empty pre; pre inside other HTML tags (bug 54946)
!! wikitext
a
<div><pre>
foo
</pre></div>
<pre></pre>
!! html
<p>a
</p>
<div><pre>
foo
</pre></div>
<pre></pre>
!! html+tidy
<p>a</p>
<div>
<pre>
foo
</pre></div>
!! end
!! test
HTML pre followed by indent-pre
!! wikitext
<pre>foo</pre>
bar
!! html
<pre>foo</pre>
<pre>bar
</pre>
!! end
!!test
Block tag pre
!!options
parsoid
!! wikitext
<p><pre>foo</pre></p>
!! html
<p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
!!end
!!test
Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
!! wikitext
{{echo|}}
!! html
!!end
!!test
Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
!! wikitext
{{echo|
foo}}
!! html
<p>foo
</p>
!!end
!! test
Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
!! wikitext
{{echo|a
b}}
!! html
<pre>a
</pre>
<p>b
</p>
!!end
!! test
Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
!! wikitext
{{echo|a
b
c
d
e
}}
!! html
<pre>a
</pre>
<p>b
c
</p>
<pre>d
</pre>
<p>e
</p>
!!end
!!test
Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
!! wikitext
{{echo| foo}}
{{echo| foo}}{{echo| bar}}
{{echo| foo}}
{{echo| bar}}
{{echo|<!--cmt--> foo}}
<!--cmt-->{{echo| foo}}
{{echo|{{echo| }}bar}}
!! html
<pre>foo
</pre>
<pre>foo bar
</pre>
<pre>foo
bar
</pre>
<pre>foo
</pre>
<pre>foo
</pre>
<pre>bar
</pre>
!!end
!! test
Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
!! wikitext
{{echo| }}a
{{echo|
}}a
{{echo|
b}}
{{echo|a
}}b
{{echo|a
}} b
!! html
<pre>a
</pre>
<p><br />
</p>
<pre>a
</pre>
<p><br />
</p>
<pre>b
</pre>
<p>a
</p>
<pre>b
</pre>
<p>a
</p>
<pre>b
</pre>
!!end
!! test
Things that look like <pre> tags aren't treated as such
!! wikitext
Barack Obama <President> of the United States
<President></President>
!! html
<p>Barack Obama <President> of the United States
<President></President>
</p>
!! end
## PHP parser discards the "<pre " string
!! test
Handle broken pre-like tags (bug 64025)
!! options
parsoid=wt2html
!! wikitext
{{echo|<pre <pre>x</pre>}}
<table><pre </table>
!! html/php
<pre>x</pre>
<table><pre></pre></table>
!! html/parsoid
<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<pre <pre>x</pre>"}},"i":0}}]}'><pre </span>
<pre>x</pre>
<span><pre </span>
<table></table>
!! end
!! test
Parsoid: handle pre with space after attribute
!! options
parsoid=wt2html
!! wikitext
<pre style="width:50%;" >{{echo|foo}}</pre>
!! html
<pre style="width:50%;">{{echo|foo}}</pre>
!! end
# TODO / maybe: fix wt2wt for this
!! test
Parsoid: Don't paragraph-wrap fosterable content
!! options
parsoid=wt2html
!! wikitext
{|
<td></td>
<td></td>
|}
!! html
<table>
<tbody>
<tr>
<td></td>
<td></td></tr>
</tbody></table>
!! end
!! test
Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
!! options
parsoid=wt2html
!! wikitext
{|
<td>
<td>
</td>
|}
!! html
<table>
<tbody>
<tr>
<td></td>
<td>
</td></tr>
</tbody></table>
!! 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
!! wikitext
{{echo|1= a }}
{{echo|1= {{echo|b}} }}
{{echo| 1 =
c }}
{{echo| 1 =
* d
}}
!! html
<p>a
</p><p>b
</p><p>c
</p>
<ul><li> d</li></ul>
!! end
!! test
Templates: Don't strip whitespace from positional-param values
!! wikitext
{{echo|a }}
{{echo|{{echo|b}} }}
{{echo| c
}}
{{echo| {{echo|d}}
}}
{{echo|
e}}
{{echo|
* f}}
{{echo|
}}g
!! html
<p>a
</p><p>b
</p>
<pre>c
</pre>
<p><br />
</p>
<pre>d
</pre>
<p><br />
</p>
<pre>e
</pre>
<p><br />
</p>
<ul><li> f</li></ul>
<p><br />
</p>
<pre>g
</pre>
!! end
!! test
Templates: Handle empty comment-and-ws-only lines correctly
!! wikitext
{{echo|foo
<!--should be ignored-->
<!--should be ignored as well-->
bar}}
!! html
<p>foo
bar
</p>
!! end
!! test
Templates: Handle comments in the target
!! wikitext
{{echo
<!-- should be ignored -->
|foo}}
{{echo<!-- should be ignored -->
|foo}}
{{echo<!-- should be ignored -->|foo}}
{{<!-- should be ignored -->echo|foo}}
!!html/parsoid
<p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n<!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
<p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo<!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
<p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo<!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
<p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
!!end
#--------------------------------------------------------------------
# Transclusion parameter escaping tests
#--------------------------------------------------------------------
!! test
Templates: Parsoid parameter escaping test 1
!! options
parsoid
!! wikitext
{{echo|[foo]|{{echo|[bar]}}}}
!! html
<p about="#mwt1" typeof="mw:Transclusion"
data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
!! end
!! test
Parsoid: Pipes in external links in template parameter
!! options
parsoid
!! wikitext
{{echo|[{{echo|http://example.com}} link]}}
!! html
<p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
!! end
!! test
Parsoid: pipe in transclusion parameter
!! options
parsoid
!! wikitext
{{echo|http://foo.com/a|b}}
!! html
<p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
typeof="mw:Transclusion"
data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
!! end
!! test
Parsoid: Pipe in external link target and content in template parameter
!! options
parsoid=html2wt,wt2wt
!! wikitext
{{echo|[http://foo.com/a|b a|b]}}
!! html
<p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
typeof="mw:Transclusion"
data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
"params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
!! end
!! test
Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
!! options
parsoid
!! wikitext
{{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
!! html
<p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
!! end
!! test
Templates: Don't escape already nowiki-escaped text in template parameters
!! options
parsoid=html2wt,wt2wt
!! wikitext
{{echo|foo<nowiki>|</nowiki>bar}}
{{echo|<nowiki><div></nowiki>}}
{{echo|<nowiki></nowiki>}}
!! html
<p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
<span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&lt;div&gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity"><</span>div<span typeof="mw:Entity">></span></span>
<span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
</p>
!! end
## Bug 52824
!! test
Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
!! options
parsoid=html2wt,wt2wt
!! wikitext
{{echo|{{echo|1=bar}}}}
!! html
<p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
!! end
## Bug 56733
!! test
Templates parameters with special tokenizing behavior dont get modified because of arg escaping
!! options
parsoid
!! wikitext
{{echo|a : b}}
!! html
<p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
!! end
###
### Parsoid-centric tests for testing RT edge cases for pre
###
!!test
1a. Indent-Pre and Comments
!! wikitext
a
<!--a-->
c
!! html
<pre>a
</pre>
<p>c
</p>
!!end
!!test
1b. Indent-Pre and Comments
!! wikitext
a
<!--a-->
c
!! html
<pre>a
</pre>
<p>c
</p>
!!end
!!test
1c. Indent-Pre and Comments
!! wikitext
<!--a--> a
<!--a--> a
!! html
<pre> a
</pre>
<pre> a
</pre>
!!end
!!test
1d. Indent-Pre and Comments
(Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
!! wikitext
<!--a--> a
<!--b-->b
!! html
<pre>a
</pre>
<pre>b
</pre>
!!end
!!test
2a. Indent-Pre and tables
!! wikitext
{|
|-
!h1!!h2
|foo||bar
|}
!! html
<table>
<tr>
<th>h1</th>
<th>h2
</th>
<td>foo</td>
<td>bar
</td></tr></table>
!!end
!!test
2b. Indent-Pre and tables
!! wikitext
{|
|-
|foo
|}
!! html
<table>
<tr>
<td>foo
</td></tr></table>
!!end
!!test
2c. Indent-Pre and tables (bug 42252)
!! wikitext
{|
|+ foo
! | bar
|}
!! html
<table>
<caption> foo
</caption>
<tr>
<th> bar
</th></tr></table>
!!end
!!test
2d. Indent-Pre and tables
!! wikitext
a
{|
| b
|}
!! html/php
<pre>a
</pre>
<table>
<tr>
<td> b
</td></tr></table>
!! html/parsoid
<pre>a</pre>
<table>
<tbody>
<tr>
<td> b</td></tr>
</tbody></table>
!!end
!!test
2e. Indent-Pre and table-line syntax
!! wikitext
a
| b
| c
!! html/php
<pre>a
| b
| c
</pre>
!!end
!!test
2f. Indent-pre started by table-line syntax
!! wikitext
a
| b
| c
!! html/php
<p>a
</p>
<pre>| b
| c
</pre>
!! html/parsoid
<p>a</p>
<pre>
| b
| c</pre>
!!end
!!test
3a. Indent-Pre and block tags (single-line html)
!! wikitext
a <p> foo </p>
b <div> foo </div>
c <blockquote> foo </blockquote>
<span> foo </span>
!! html
a <p> foo </p>
b <div> foo </div>
c <blockquote> foo </blockquote>
<pre><span> foo </span>
</pre>
!! html+tidy
<p>a</p>
<p>foo</p>
<p>b</p>
<div>foo</div>
<p>c</p>
<blockquote>
<p>foo</p>
</blockquote>
<pre>
<span> foo </span>
</pre>
!! end
!!test
3b. Indent-Pre and block tags (multi-line html)
!! wikitext
a <span>foo</span>
b <div> foo </div>
!! html
<pre>a <span>foo</span>
</pre>
b <div> foo </div>
!! html+tidy
<pre>
a <span>foo</span>
</pre>
<p>b</p>
<div>foo</div>
!!end
!!test
3c. Indent-Pre and block tags (pre-content on separate line)
!! wikitext
<p>
foo
</p>
<div>
foo
</div>
<center>
foo
</center>
<blockquote>
foo
</blockquote>
<blockquote>
<pre>
foo
</pre>
</blockquote>
<table><tr><td>
foo
</td></tr></table>
<ul><li>
foo
</li></ul>
!! html
<p>
foo
</p>
<div>
<pre>foo
</pre>
</div>
<center>
<pre>foo
</pre>
</center>
<blockquote>
<p> foo
</p>
</blockquote>
<blockquote>
<pre>
foo
</pre>
</blockquote>
<table><tr><td>
<pre>foo
</pre>
</td></tr></table>
<ul><li>
foo
</li></ul>
!!end
!!test
4. Indent-Pre and extension tags
!! wikitext
a <gallery>
File:foobar.jpg
</gallery>
!! html
a <ul class="gallery mw-gallery-traditional">
<li class="gallerybox" style="width: 155px"><div style="width: 155px">
<div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
<div class="gallerytext">
</div>
</div></li>
</ul>
!! html+tidy
<p>a</p>
<ul class="gallery mw-gallery-traditional">
<li class="gallerybox" style="width: 155px">
<div style="width: 155px">
<div class="thumb" style="width: 150px;">
<div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div>
</div>
<div class="gallerytext"></div>
</div>
</li>
</ul>
!!end
!! test
Table wikitext syntax outside wiki-tables
!! wikitext
a
! not a table heading
|- not a table row
| not a table cell
| class="foo bar" | baz
b
|}
|-
c
!! html
<p>a
! not a table heading
|- not a table row
| not a table cell
| class="foo bar" | baz
b
|}
|-
c
</p>
!! end
!!test
Render paragraphs when indent-pre is suppressed in blocklevels
!! wikitext
<blockquote>
foo
bar
</blockquote>
!! html
<blockquote>
<p> foo
</p><p> bar
</p>
</blockquote>
!!end
!!test
4. Multiple spaces at start-of-line
!! wikitext
<p> foo </p>
foo
{|
|foo
|}
!! html
<p> foo </p>
<pre> foo
</pre>
<table>
<tr>
<td>foo
</td></tr></table>
!!end
## NOTE: the leading white-space chars on empty line are significant
!! test
5a. White-space in indent-pre
!! wikitext
a<br />
b
!! html
<pre>a<br />
b
</pre>
!! end
## NOTE: the leading white-space chars on empty line are significant
!! test
5b. White-space in indent-pre
!! wikitext
a
b
c
!! html
<pre>a
b
c
</pre>
!! end
!! test
5c. White-space in indent-pre
!! wikitext
''a''
''b''
''c''
!! html
<pre><i>a</i>
<i>b</i>
<i>c</i>
</pre>
!! end
!! test
6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
!! wikitext
a
<!-- continue -->
b
c
d
!! html
<pre>a
b
|