# MediaWiki Parser test cases
# Some taken from https://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
# (ignored by Parsoid, since it emits <link>s)
# ill add inter-language links
# (ignored by Parsoid, since it emits <link>s)
# subpage enable subpages (disabled by default)
# 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
# wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
#
# You can also set the following parser properties via test options:
# wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
# wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
# wgEnableMagicLinks
#
# 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
// For Serbian; localize Template namespace
!! article
Шаблон: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
!! article
Template:CircularRef
!! text
<ref>{{CircularRef}}</ref>
!! endarticle
!! article
Template:With: Colon
!! text
Template with colon
!! endarticle
###
### Basic tests
###
!! test
Blank input
!! wikitext
!! html
!! end
!! test
CircularRef
!! wikitext
{{CircularRef}}
<references />
!! html/parsoid
<p><span about="#mwt1" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">Error: Expansion loop detected at <a data-parsoid='{"a":{"href":null},"sa":{"href":"Template:CircularRef"}}'>Template:CircularRef</a></span></li></ol>
!! 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" titl