# 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-formedness
# 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
# showindicators make the first lines the page status indicators
# 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
Template:=
!! text
<nowiki>=</nowiki>
!! 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:blank_param
!! text
{{{1}}}
{{{}}}
!! endarticle
!! article
Template:table_attribs
!! text
<noinclude>
|</noinclude>style="color:red;"|Foo
!! endarticle
!! article
Template:table_attribs_2
!! text
<noinclude>
|</noinclude>style="color:red;"|Foo
|Bar||Baz
!! endarticle
!! article
Template:table_attribs_3
!! text
<noinclude>
|</noinclude>style{{=}}"background:#f9f9f9;"|Foo
!! endarticle
!! article
Template:table_attribs_4
!! text
| style="background-color:#DC241f;" width="10px" |
!! endarticle
!! article
Template:table_attribs_5
!! text
<noinclude>
|</noinclude>style="color:red;"||Bar
!! endarticle
!! article
Template:table_attribs_6
!! text
style="background: <nowiki>
red;</nowiki>" |
!! endarticle
!! article
Template:table_attribs_7
!! text
<noinclude>
|</noinclude>style{{=}}"background:#f9f9f9;"|Foo<ref>foo</ref>
!! endarticle
!! article
Template:table_header_cells
!! text
{{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
!! endarticle
!! article
Template:table_cells
!! text
{{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
!! endarticle
!! article
Template:PartialTable
!! text
{|
|-
!! endarticle
!! article
Template:image_attribs
!! text
<noinclude>
[[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
!! endarticle
## See T48811 for details
!! article
Template:mixed_attr_content_template
!! text
style="color:red;" title="T48811"
|-
|foo
!! endarticle
!! article
Template:definition_list
!! text
one
::two
!! endarticle
!! article
A?b
!! text
Weirdo titles!
!! endarticle
!!article
Template:Bullet
!!text
* Bar
!!endarticle
!!article
Template:OpenTable
!!text
{|
!!endarticle
!!article
Template:EmptyLITest
!!text
*a
*
*
*b
!!endarticle
!!article
Template:EmptyTRTest
!!text
{|
|-
|-
|foo
|-
|-
|bar
|}
!!endarticle
!!article
Template:EmptyTRWithHTMLAttrTest
!!text
<table>
<tr align="center"></tr>
<tr><td>foo</td></tr>
<tr align="center"></tr>
<tr><td>bar</td></tr>
</table>
!!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
|