!! Version 2
# 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 s)
# ill add inter-language links
# (ignored by Parsoid, since it emits 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
(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
Foo''s bar''s
!!text
Article titles can contain single quotes!
!!endarticle
!!article
Template:Foo
!!text
FOO
!!endarticle
!! article
Template:redirect to foo
!! text
#REDIRECT [[Template:Foo]]
!! endarticle
!! article
Template:Blank
!! text
!! endarticle
!! article
Template:pipe
!! text
|
!! endarticle
!! article
Template:=
!! 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:1x
!! text
{{{1}}}
!! endarticle
!! article
Template:3x_on_newline
!! text
{{{1}}}
{{{1}}}
{{{1}}}
!! endarticle
// For Serbian; localize Template namespace
!! article
Шаблон:1x
!! text
{{{1}}}
!! endarticle
!! article
Template:1x_with_span
!! text
{{{1}}}
!! endarticle
!! article
Template:1x_with_div
!! text
{{{1}}}
!! endarticle
!! article
Template:1x with depth
!! text
{{1x|{{{1}}}}}
!! endarticle
!! article
Template:blank_param
!! text
{{{1}}}
{{{}}}
!! endarticle
!! article
Template:table_attribs
!! text
|style="color:red;"|Foo
!! endarticle
!! article
Template:table_attribs_2
!! text
|data-sort-value="" style="color:red;"|Foo
|Bar||Baz
!! endarticle
!! article
Template:table_attribs_3
!! text
|style{{=}}"background:#f9f9f9;"|Foo
!! endarticle
!! article
Template:table_attribs_4
!! text
| style="background-color:#DC241f;" width="10px" |
!! endarticle
!! article
Template:table_attribs_5
!! text
|style="color:red;"||Bar
!! endarticle
!! article
Template:table_attribs_6
!! text
style="background:
red;" |
!! endarticle
!! article
Template:table_attribs_7
!! text
|style{{=}}"background:#f9f9f9;"|Foofoo
!! 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
[[File:foobar.jpg|right|Caption text]]
!! endarticle
## See T48811 for details
!! article
Template:mixed_attr_content_template
!! text
style="color:red;" title="T48811"
|-
|foo
!! endarticle
## This template has a category in fosterable position. See T249740 for details
!! article
Template:mixed_attr_content_template_2
!! text
style="color:red;" title="T249740"
|-
[[Category:Fostered Content]]
|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
foo
bar
!!endarticle
!! article
Template:With: Colon
!! text
Template with colon
!! endarticle
!! article
Template:Template with pagename
!! text
This is {{PAGENAME}}.
!! endarticle
###
### Basic tests
###
!! test
Blank input
!! wikitext
!! html
!! end
!! test
Simple paragraph
!! wikitext
This is a simple paragraph.
!! html
This is a simple paragraph.
!! end
!! test
Paragraphs with extra newline spacing
!! wikitext
a
b (+2 nls)
c (+3 nls)
d (+4 nls)
e (+5 nls)
!! html
a
b (+2 nls)
c (+3 nls)
d (+4 nls)
e (+5 nls)
!! end
!! test
Paragraphs with newline spacing with comment lines in between
!! wikitext
----
a
b
----
a
b
----
a
b
----
a
b
----
a
b
----
a
b
----
a
b
----
!! html
a
b
a
b
a
b
a
b
a
b
a
b
a
b
!! end
!! test
Paragraphs with newline spacing with non-empty white-space lines in between
!! wikitext
----
a
b
----
a
b
----
!! html
a
b
a
b
!! end
!! test
Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
!! wikitext
----
a
b
----
a
b
----
a
b
----
a
b
----
!! html
a
b
a
b
a
b
a
b
!! end
!! test
Extra newlines: More paragraphs with indented comment
!! wikitext
a
b
!! html
a
b
!!end
!! test
Extra newlines followed by heading
!! wikitext
a
=b=
[[a]]
=b=
!! html
!! end
!! test
Extra new lines before and after lists are preserved
!! wikitext
a
*b
c
!! html/php+tidy
a
b
c
!! html/parsoid
a
b
c
!! end
# Parsoid regression test
!!test
Multiple newlines after tables are converted to p-br-p tags
!!options
parsoid=wt2html,wt2wt
!!wikitext
{|
|x
|}
=b=
!!html/php+tidy
!!end
!! test
Heading with line break in nowiki
!! options
parsoid=wt2html
!! config
wgFragmentMode=[ 'html5', 'legacy' ]
!! wikitext
==A B
C==
!! html/php
!! end
!! test
Heading with nonbreaking space in prefix/suffix (T235684)
!! options
parsoid=wt2html,html2html
!! config
wgFragmentMode=[ 'html5', 'legacy' ]
!! wikitext
== A B ==
!! html/php
!! end
!! test
Simple list
!! wikitext
*Item 1
*Item 2
!! html
Item 1
Item 2
!! 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
plain
plainitalicplain
plainitalicplainitalicplain
plainboldplain
plainboldplainboldplain
plainitalicplainboldplain
plainboldplainitalicplain
plainitalicbold-italicitalicplain
plainboldbold-italicboldplain
plainbold-italicitalicplain
plainbold-italicboldplain
plainitalicbold-italicplain
plainboldbold-italicplain
plain l'italicplain
plain l'bold plain
!! end
# this example taken from the [[simple:Moon]] article (T49326)
!! test
Italics and possessives (1)
!! wikitext
obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
!! html
!! end
# this example taken from [[en:Flaming Pie]] (T51926)
!! test
Italics and possessives (2)
!! wikitext
'''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
!! html
Flaming Pie is ... released in 1997. In Flaming Pie's liner notes
!! end
# this example taken from [[en:Dictionary]] (T51926)
!! 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
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
###
!! test
Italics and bold: 2-quote opening sequence: (2,2)
!! wikitext
''foo''
!! html
foo
!!end
!! test
Italics and bold: 2-quote opening sequence: (2,3)
!! wikitext
''foo'''
!! html/*
foo'
!!end
!! test
Italics and bold: 2-quote opening sequence: (2,4)
!! options
parsoid=wt2html
!! wikitext
''foo''''
!! html/*
foo''
!!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
''foo''''
!! html
foo''
!! end
!! test
Italics and bold: 2-quote opening sequence: (2,5)
!! options
parsoid=wt2html
!! wikitext
''foo'''''
!! html
foo
!!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''''''''
!! html
foo
!! end
###
### 3-quote opening sequence tests
###
!! test
Italics and bold: 3-quote opening sequence: (3,2)
!! wikitext
'''foo''
!! html
'foo
!!end
!! test
Italics and bold: 3-quote opening sequence: (3,3)
!! wikitext
'''foo'''
!! html
foo
!!end
!! test
Italics and bold: 3-quote opening sequence: (3,4)
!! wikitext
'''foo''''
!! html
foo'
!!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+untidy
foo
!! html+tidy
foo
!!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'''''''
!! html/php+untidy
foo
!! html+tidy
foo
!! end
###
### 4-quote opening sequence tests
###
!! test
Italics and bold: 4-quote opening sequence: (4,2)
!! options
parsoid=wt2html
!! wikitext
''''foo''
!! html/*
''foo
!!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
''''foo''
!! html
''foo
!! end
!! test
Italics and bold: 4-quote opening sequence: (4,3)
!! wikitext
''''foo'''
!! html/*
'foo
!!end
!! test
Italics and bold: 4-quote opening sequence: (4,4)
!! options
parsoid=wt2html
!! wikitext
''''foo''''
!! html/*
'foo'
!!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
''''foo''''
!! html
'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)
!! options
parsoid=wt2html
!! wikitext
''''foo'''''
!! html/php+untidy
'foo
!! html+tidy
'foo
!!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'''''''
!! html/php+untidy
'foo
!! html+tidy
'foo
!! end
###
### 5-quote opening sequence tests
###
!! test
Italics and bold: 5-quote opening sequence: (5,2)
!! options
parsoid=wt2html
!! wikitext
'''''foo''
!! html/*
foo
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: 5-quote opening sequence: (5,2+3)
!! wikitext
'''''foo'''''
!! html/*
foo
!! end
!! test
Italics and bold: 5-quote opening sequence: (5,3)
!! options
parsoid=wt2html
!! wikitext
'''''foo'''
!! html/*
foo
!!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
foo
!! end
!! test
Italics and bold: 5-quote opening sequence: (5,4)
!! options
parsoid=wt2html
!! wikitext
'''''foo''''
!! html/*
foo'
!!end
!! test
Italics and bold: 5-quote opening sequence: (5,5)
!! wikitext
'''''foo'''''
!! html
foo
!!end
!! test
Italics and bold: 5-quote opening sequence: (5,6)
!! wikitext
'''''foo''''''
!! html/*
foo'
!! end
###
### multiple quote sequences in a line
###
!! test
Italics and bold: multiple quote sequences: (2,4,2)
!! options
parsoid=wt2html
!! wikitext
''foo''''bar''
!! html+untidy
foo'bar
!! html+tidy
foo'bar
!! html/parsoid
foo'bar
!! 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
''foo''''bar'''''
!! html
foo'bar
!! end
!! test
Italics and bold: multiple quote sequences: (2,4,3)
!! options
parsoid=wt2html
!! wikitext
''foo''''bar'''
!! html/*
foo'bar
!! 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
''foo''''bar'''''
!! html
foo'bar
!! end
!! test
Italics and bold: multiple quote sequences: (2,4,4)
!! options
parsoid=wt2html
!! wikitext
''foo''''bar''''
!! html/*
foo'bar'
!! 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
''foo''''bar''''''
!! html
foo'bar'
!! end
!! test
Italics and bold: multiple quote sequences: (3,4,2)
!! options
parsoid=wt2html
!! wikitext
'''foo''''bar''
!! html
foo'bar
!! 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
!! wikitext
'''foo''''bar''''
!! html
foo'bar
!! end
!! test
Italics and bold: multiple quote sequences: (3,4,3)
!! options
parsoid=wt2html
!! wikitext
'''foo''''bar'''
!! html
foo'bar
!! 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
'''foo''''bar''''''
!! html
foo'bar
!! end
###
### other quote tests
###
!! test
Italics and bold: other quote tests: (2,3,5)
!! wikitext
''this is about '''foo's family'''''
!! html
this is about foo's family
!!end
!! test
Italics and bold: other quote tests: (2,(3,3),2)
!! wikitext
''this is about '''foo's''' family''
!! html
this is about foo's family
!!end
!! test
Italics and bold: other quote tests: (3,2,3,2)
!! options
parsoid=wt2html
!! wikitext
'''this is about ''foo'''s family''
!! html/*
this is about foos family
!!end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: other quote tests: (3,2,3+2+2,2)
!! wikitext
'''this is about ''foo'''''''s family''
!! html
this is about foos family
!! end
!! test
Italics and bold: other quote tests: (3,2,3,3)
!! wikitext
'''this is about ''foo'''s family'''
!! html/*
'this is about foos family
!!end
!! test
Italics and bold: other quote tests: (3,(2,2),3)
!! wikitext
'''this is about ''foo's'' family'''
!! html
this is about foo's family
!!end
!! test
Italicized possessive
!! wikitext
The ''[[Main Page]]'''s talk page.
!! html/php
!! end
!! test
Quote balancing context should be restricted to td/th cells on the same wikitext line
!! options
parsoid=wt2html,wt2wt
!! wikitext
{|
!''a!!''b
|''a||''b
|}
!! html+tidy
a
b
a
b
!! end
!! test
Bold conversion test
!! wikitext
a b'''c ''d e'''f'' g h'''i ''j
!! options
parsoid=wt2html
!! html+tidy
a b'c d ef g hi j
!! end
###
### Non-html5 tags
###
!! test
Non-html5 tags should be accepted
!! wikitext
''foo''
''foo''
''foo''
''foo''''foo''
!! html
foo
foofoofoofoo
!! end
!! test
is valid wikitext (T54468)
!! wikitext
!! html
!! end
# is HTML4, is HTML4/5.
!! test
or for strikethrough
!! wikitext
strikes
!! html
strike
s
!! end
## a not permitted
## i,b,br omitted
!! test
Text-level semantic html elements in wikitext
!! wikitext
texttext
text
text
text
text
text
text
text
texttexttexttexttexttext
text
明日
text
text
text
!! html
texttext
text
text
text
text
text
text
text
texttexttexttexttexttext
text
明日
text
text
text
!! end
# test cases taken from
# https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
!! test
Ruby markup (W3C-style)
!! wikitext
;Mono-ruby for individual base characters
:日本語
;Group ruby
:今日
;Jukugo ruby
:法華経
;Inline ruby
:東京
;Double-sided ruby
:旧金山♥☘✶
!! html
Mono-ruby for individual base characters
日本語
Group ruby
今日
Jukugo ruby
法華経
Inline ruby
東京
Double-sided ruby
旧金山
♥☘✶
!! end
# The next two test different paths in the sanitizer.
!! test
Non-word characters don't terminate tag names (T19663, T42670, T54022)
!! wikitext
!! end
###
### See tests/parser/ParserTestParserHook.php for the extension)
### This checks that HTML5 tags (with non-word characters in the tag
### name) make it safely through the parser -- the Sanitizer will
### munge them later, as it should.
###
!! test
Non-word characters are valid in extension tags (T19663)
!! wikitext
tåg
!! html/php
'tåg'
array (
)
!! html/parsoid
!! end
!! test
Isolated close tags should be treated as literal text (T54760)
!! options
parsoid=wt2html
!! wikitext
s
!! html+tidy
<s.foo>s
!! end
###
### Special characters
###
!! test
Bare pipe character (T54363)
!! wikitext
|
!! html
|
!! end
!! test
Bare pipe character from a template (T54363)
!! wikitext
{{pipe}}
!! html
|
!! end
!! test
Implicit newline insertion/sol when expanding templates (T241150/T14974/T2529)
!! wikitext
{{1x|#foo}}{{1x|#foo}}
!! html/php+tidy
foo
foo
!! html/parsoid
foo
foo
!! end
###
### test cases
###
!! test
unordered list
!! wikitext
* This is not an unordered list item.
!! html/php
* This is not an unordered list item.
!! html/parsoid
* This is not an unordered list item.
!! end
!! test
spacing
!! wikitext
Lorem ipsum dolor
sed abit.
sed nullum.
:and a colon
!! html/php
Lorem ipsum dolor
sed abit.
sed nullum.
:and a colon
!! html/parsoid
Lorem ipsum dolor
sed abit.
sed nullum.
:and a colon
!! end
!! test
Don't parse (T149622)
!! wikitext
!! html/php
<span class="error">
!! html/parsoid
<span class="error">
!! end
!! test
nowiki 3
!! wikitext
:There is not nowiki.
:There is nowiki.
#There is not nowiki.
#There is nowiki.
*There is not nowiki.
*There is nowiki.
!! html/php
There is not nowiki.
There is nowiki.
There is not nowiki.
There is nowiki.
There is not nowiki.
There is nowiki.
!! html/parsoid
There is not nowiki.
There is nowiki.
There is not nowiki.
There is nowiki.
There is not nowiki.
There is nowiki.
!! end
!! test
Entities inside
!! wikitext
<
!! html/php
<
!! html/parsoid
<
!! end
!! test
Entities inside template parameters
!! wikitext
{{1x|–}}
!! html/php+tidy
–
!! html/parsoid
–
!! end
!! test
Properly escape nowiki when combined with other wiki markup
!! options
parsoid=html2wt
!! html/parsoid
* </nowiki> tag
!! wikitext
*</nowiki> tag
!! end
!! test
T93824: Put escaped HTML tags inside nowiki
!! options
parsoid=html2wt
!! html/parsoid
<h2>foo</h2>
!! wikitext
foo
!! end
!! test
T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
!! options
parsoid=html2wt
!! html/parsoid
This text: L'Foo
This text: L''Foo
This text: L'''Foo''
!! wikitext
This text: L'[[Foo]]
This text: L''[[Foo]]
This text: L'''[[Foo]]''
!! end
# This test fails because wikitext whitespace is not normalized before comparing.
!! test
T71950: 2. Put nowiki as close to cause as possible, after ' :'
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
This text : L''[[Foo]]
!! end
# This test and the next one are html2wt only as they test that incorrect wikitext
# passed in template arguments gets escaped or wrapped in nowikis where required.
!! test
T71482: Use {{!}} instead of nowiki for single pipe in template argument
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
{{1x|foo{{!}}bar}}
{{1x|foo|bar |[[}}
!! end
!! test
T53961: Output correct nowikis in template arguments
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
{|
!this needs protection !! here
|}
{|
!this does not need
protection !! here
|}
!! end
###
### Comments
###
!! test
Comments and Indent-Pre
!! wikitext
asdf
asdf
asdf
xyz
asdf
xyz
!! html
asdf
asdf
asdf
xyz
asdf
xyz
!! end
!! test
Comment test 2a
!! wikitext
asdf
jkl
!! html
asdf
jkl
!! end
!! test
Comment test 2b
!! wikitext
asdf
jkl
!! html
asdf
jkl
!! end
!! test
Comment test 3
!! wikitext
asdf
jkl
!! html
asdf
jkl
!! end
!! test
Comment test 4
!! wikitext
asdfjkl
!! html
asdfjkl
!! end
!! test
Comment spacing
!! wikitext
a
b
c
!! html
a
b
c
!! end
!! test
Comment whitespace
!! wikitext
!! html
!! end
!! test
Comment semantics and delimiters
!! wikitext
!! html/php
!! html/parsoid
!! end
!! test
Comment semantics and delimiters, redux
!! wikitext
!! html/php
!! html/parsoid
!! end
!! test
Comment semantics and delimiters: directors cut
!! wikitext
-->
!! html/php
-->
!! html/parsoid
-->
!! end
!! test
Comment semantics: nesting
!! wikitext
-->
!! html/php
-->
!! html/parsoid
-->
!! end
# Parsoid closes the unclosed comment, even if it means a slight
# round-trip diff.
!! test
Comment semantics: unclosed comment at end
!! options
parsoid=wt2html,html2html
!! wikitext
!! end
!! test
Comment semantics: normalize comments to play nice with XML and browsers
!! wikitext
think this is closed -->
This would normally be text -->
As would this -->
But this is not a comment.
!! html/php
But this is not a comment.
!! html/parsoid
But this is not a comment.
!! end
!! test
Comment semantics: round-trip even text which contains encoded -->
!! wikitext
!! html/parsoid
!! end
!! test
Comment in template title
!! wikitext
{{foo}}
!! html
FOO
!! end
!! test
Comment on its own line post-expand
!! wikitext
a
{{blank}}
b
!! html
a
b
!! end
!! test
Comment on its own line post-expand with non-significant whitespace
!! wikitext
a
{{blank}}
b
!! html
a
b
!! end
!! test
post-expand include size being exceeded
!! options
maxincludesize=30
!! wikitext
{{3x_on_newline|1234567890}}
!! html
!! end
!! test
max template depth being reached
!! options
maxtemplatedepth=1
!! wikitext
{{1x with depth|too deep!}}
!! html
Template recursion depth limit exceeded (1)
!! end
!! test
multiple templates that are redirects
!! wikitext
{{redirect to foo}}
{{redirect to foo}}
!! html
FOO
FOO
!! end
!! test
Multiple comments should still parse as SOL-transparent
!! options
parsoid=wt2html,wt2wt
!! wikitext
*a
*b
!! html/php
a
b
!! html/parsoid
a
b
!! end
## Make sure ">" gets escaped in comments to avoid XSS
!! test
IE conditional comments
!! wikitext
!! html/parsoid
!! end
###
### paragraph wrapping tests
###
!! test
No block tags
!! wikitext
a
b
!! html
a
b
!! end
!! test
Block tag on one line (
)
!! wikitext
a
foo
b
!! html+untidy
a
foo
b
!! html+tidy
a
foo
b
!! end
!! test
No p-wrappable content
!! options
parsoid=wt2html,html2html
!! wikitext
x
x
x
!! html+tidy
x
x
x
!! end
# T177612: Parsoid-only test
!! test
Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
!! wikitext
{{1x|
x
}}
x
!! html/parsoid
x
x
!! end
!! test
Block tag on one line (
)
!! wikitext
a
foo
b
!! html+untidy
a
foo
b
!! html+tidy
a
foo
b
!! end
!! test
Block tag on both lines (
)
!! wikitext
a
foo
b
foo
!! html+untidy
a
foo
b
foo
!! html+tidy
a
foo
b
foo
!! end
!! test
Block tag on both lines (
)
!! wikitext
a
foo
b
foo
!! html+untidy
a
foo
b
foo
!! html+tidy
a
foo
b
foo
!! end
!! test
Multiple lines without block tags
!! wikitext
foo
a
b
c
d e
x
foo
z
!! html+untidy
foo
a
b
c
d e
x
foo
z
!! html+tidy
foo
a
b
c
d e
x
foo
z
!! html/parsoid
foo
a
b
c
d e
x
foo
z
!! end
!! test
Empty lines between lines with block tags
!! wikitext
a
b
a
b
b
d
e
!! html+untidy
a
b
a
b
b
d
e
!! html+tidy
a
b
a
b
b
d
e
!! html/parsoid
a
b
a
b
b
d
e
!! end
!! test
Unclosed HTML p-tags should be handled properly
!! wikitext
foo
a
b
!! html/php+tidy
foo
a
b
!! html/parsoid
foo
a
b
!! end
## SSS FIXME: I can come up with other scenarios where this doesn't work because
## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
## them for now.
!! test
1. P-wrapping should leave sol-transparent tags outside p-tags where possible
!! options
parsoid=wt2html
!! wikitext
a [[Category:A1]] [[Category:A2]]
[[Category:A3]]
[[Category:A4]]
!! html/parsoid
a
!! end
!! test
2. P-wrapping should leave sol-transparent tags outside p-tags where possible
!! options
parsoid=wt2html
!! wikitext
[[Category:A1]]a
!! html/parsoid
a
!! end
!! test
No paragraph necessary for SOL transparent template
!! wikitext
foo
[[Category:Foo]]
foo
{{1x|[[Category:Foo]]}}
!! html/php
foo
foo
!! html/parsoid
foo
foo
!! end
!! test
Avoid expanding multiline sol transparent template ranges unnecessarily
!! wikitext
hi
{{1x|
}}
[[Category:Ho]]
!! html/php
hi
!! html/parsoid
hi
!! end
!! test
Paragraph wrapping following unclosed table
!! options
parsoid=wt2html,html2html
!! wikitext
{|
|-
{|
| x
|}
a
b
c
!! html/php+tidy
x
a
b
c
!! html/parsoid
x
a
b
c
!! end
!! test
Paragraph wrapping suppressed in html p
!! options
parsoid=wt2html,html2html
!! wikitext
hi
!! html/php+tidy
hi
!! html/parsoid
hi
!! end
!! test
Dangling table row doesn't prevent p-wrapping
!! options
parsoid=wt2html,html2html
!! wikitext
{|
| hi
|-
|} ho
!! html/parsoid
hi
ho
!! end
!! test
P-wrapping non-breaking spaces
!! wikitext
!! html/php+tidy
!! html/parsoid
!! end
!! test
Paragraph wrapping suppressed in table captions
!! wikitext
{|
|+hi
|ho
|}
{|
|hi
|+ho
|}
it's off to work we go
!! html/php
hi
ho
hi
ho
it's off to work we go
!! html/parsoid
hi
ho
hi
ho
it's off to work we go
!! end
###
### Preformatted text
###
!! test
Preformatted text
!! wikitext
This is some
Preformatted text
With ''italic''
And '''bold'''
And a [[Main Page|link]]
!! html
This is some
Preformatted text
With italic
And bold
And a link
!! end
!! test
Tabs don't trigger preformatted text
!! wikitext
This is not
preformatted text.
This is preformatted text.
So is this.
!! html/php
This is not
preformatted text.
This is preformatted text.
So is this.
!! html/parsoid
This is not
preformatted text.
This is preformatted text.
So is this.
!! end
!! test
Space before tab needs nowiki pre protection
!! options
parsoid=html2wt
!! html/parsoid
a
!! wikitext
a
!! end
!! test
Ident preformatting with inline content
!! wikitext
a
''b''
!! html
a
b
!! end
!! test
with inside (compatibility with 1.6 and earlier)
!! wikitext
!! html
<b>
<cite>
<em>
!! end
!! test
Regression with preformatted in
!! wikitext
Blah
!! html
Blah
!! end
!! test
T54763: Preformatted in
!! wikitext
Blah
{|
|
indented cell (no pre-wrapping!)
|}
!! html
Blah
indented cell (no pre-wrapping!)
!! end
!! test
T53086: Double newlines in blockquotes should be turned into paragraphs
!! wikitext
Foo
Bar
!! html
Foo
Bar
!! end
!! test
T17491: / in blockquote
!! wikitext
Foo bar baz quux
!! html+untidy
Foo bar baz quux
!! html+tidy
Foo bar baz quux
!! end
!! test
T17491: / in blockquote (2)
!! wikitext
Foo bar baz quux
!! html+untidy
Foo bar baz quux
!! html+tidy
Foo bar baz quux
!! end
!! test
with attributes (T5202)
!! wikitext
Bluescreen of WikiDeath
!! html
Bluescreen of WikiDeath
!! end
!! test
with width attribute (T5202)
!! wikitext
Narrow screen goodies
!! html
Narrow screen goodies
!! end
!! test
with forbidden attribute (T5202)
!! wikitext
Narrow screen goodies
!! html
Narrow screen goodies
!! end
!! test
Entities inside
!! wikitext
<
!! html
<
!! end
!! test
with forbidden attribute values (T5202)
!! wikitext
Narrow screen goodies
!! html
Narrow screen goodies
!! end
!! test
inside
(T15238)
!! wikitext
Foo
!! html
<nowiki>
<nowiki>Foo</nowiki>
!! end
!! test
inside of #tag:pre
!! wikitext
{{#tag:pre|Foo →bar}}
!! html/php
Foo →bar
!! html/parsoid
Foo →bar
!! end
## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
## aren't enclosed in nowikis.
!! test
and
preference (first one wins)
!! options
parsoid=wt2html
!! wikitext
!! html/php
<nowiki>
</nowiki>
<pre>
<nowiki>
</pre>
!! html/parsoid
<nowiki>
</nowiki>
<pre>
<nowiki>
</pre>
!! end
!! test
inside nowiki
!! wikitext
!! html
</pre>
!! end
!! test
Empty pre; pre inside other HTML tags (T56946)
!! wikitext
a
foo
!! html/php+tidy
a
foo
!! html/parsoid
a
foo
!! end
!! test
HTML pre followed by indent-pre
!! wikitext
foo
bar
!! html
foo
bar
!! end
!! test
Block tag pre
!! wikitext
foo
!! html/php+tidy
foo
!! html/parsoid
foo
!! end
!!test
Templates: Indent-Pre: 1a. Templates that break a line should suppress
!! wikitext
{{1x|}}
!! html
!! end
!!test
Templates: Indent-Pre: 1b. Templates that break a line should suppress
!! wikitext
{{1x|
foo}}
!! html
foo
!!end
!! test
Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
!! wikitext
{{1x|a
b}}
!! html
a
b
!!end
!! test
Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
!! wikitext
{{1x|a
b
c
d
e
}}
!! html
a
b
c
d
e
!!end
!!test
Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
!! wikitext
{{1x| foo}}
{{1x| foo}}{{1x| bar}}
{{1x| foo}}
{{1x| bar}}
{{1x| foo}}
{{1x| foo}}
{{1x|{{1x| }}bar}}
!! html
foo
foo bar
foo
bar
foo
foo
bar
!!end
!! test
Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
!! wikitext
{{1x| }}a
{{1x|
}}a
{{1x|
b}}
{{1x|a
}}b
{{1x|a
}} b
!! html
a
a
b
a
b
a
b
!!end
## Hmm, should Parsoid rt this?
!! test
Pres with newline attributes
!! options
parsoid=wt2html,html2html
!! wikitext
hi
!! html/php
hi
!! html/parsoid
hi
!! end
!! test
Things that look like
tags aren't treated as such
!! wikitext
Barack Obama of the United States
!! html
Barack Obama <President> of the United States
<President></President>
!! end
## Remex doesn't account for fostered content.
## The difference between Parsoid and the PHP parser can be attributed to core
## commit 674e8388cba and 710618f89af in Parsoid's repo. Parsoid doesn't
## tokenize unmatched extension tags that shadow html tags as strings to ease
## an escaping mechanism. See the comment in `maybeExtensionTag`.
!! test
Handle broken pre-like tags (T66025)
!! options
parsoid=wt2html
!! wikitext
{{1x|
x
}}
!! html/php+untidy
x
<pre
!! html/php+tidy
x
<pre
!! html/parsoid
x
!! end
## Similar to the above, but shows the difference between extension and html tags
!! test
Less than in attribute position
!! wikitext
123
123
!! html/php+tidy
123
<div
123
!! html/parsoid
123
<div
123
!! end
!! test
Parsoid: handle pre with space after attribute
!! options
parsoid=wt2html
!! wikitext
{{1x|foo}}
!! html/php
{{1x|foo}}
!! html/parsoid
{{1x|foo}}
!! end
!! test
Self-closed pre
!! wikitext
!! html/php
!! html/parsoid
!! end
!! test
Newline before table-close generates empty table row: T208619
!! wikitext
{|
|}
!! html/php+tidy
!! html/parsoid
!! end
# PHP has one more row in the output than Parsoid does: T208619
!! test
Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
!! options
parsoid=wt2html
!! wikitext
{|
|}
!! html/php+tidy
!! html/parsoid
!! 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
{{1x|1= a }}
{{1x|1= {{1x|b}} }}
{{1x| 1 =
c }}
{{1x| 1 =
* d
}}
!! html
a
b
c
d
!! end
!! test
Templates: Don't strip whitespace from positional-param values
!! wikitext
{{1x|a }}
{{1x|{{1x|b}} }}
{{1x| c
}}
{{1x| {{1x|d}}
}}
{{1x|
e}}
{{1x|
*f}}
{{1x|
}}g
!! html
a
b
c
d
e
f
g
!! end
!! test
Templates: Don't recognize targets split by newlines
!! options
parsoid=wt2html
!! wikitext
{{ech
o|foo}}
!! html/php
{{ech
o|foo}}
!! html/parsoid
{{ech
o|foo}}
!! end
!! test
Templates: Recognize targets when newlines and comments don't split the target
!! options
parsoid=wt2html
!! wikitext
{{
1x
|foo}}
!! html/php
foo
!! html/parsoid
foo
!! end
!! test
Templates: Handle empty comment-and-ws-only lines correctly
!! wikitext
{{1x|foo
bar}}
!! html/php
foo
bar
!! html/parsoid
foo bar
!! end
!! test
Templates: Handle comments in the target
!! wikitext
{{1x
|foo}}
{{1x
|foo}}
{{1x
|foo}}
{{1x|foo}}
{{1x|foo}}
!! html/php
foo
foo
foo
foo
foo
!! html/parsoid
foo
foo
foo
foo
foo
!! end
!! test
Templates: Handle comments in parameter names (T69657)
!! wikitext
{{1x|1
=foo}}
{{1x|
1 = foo}}
{{1x|1=foo}}
{{1x|1=foo}}
!! html/php
foo
foo
foo
foo
!! html/parsoid
foo
foo
foo
foo
!! end
!! test
Templates: Other wikitext in parameter names (T69657)
!! wikitext
{{1x|''1''=foo}}
!! html/php
{{{1}}}
!! html/parsoid
{{{1}}}
!! end
!! test
Templates: With colons
!! wikitext
{{With: Colon}}
!! html/php
Template with colon
!! html/parsoid
Template with colon
!! end
#--------------------------------------------------------------------
# Transclusion parameter escaping tests
#--------------------------------------------------------------------
!! test
Templates: Parsoid parameter escaping test 1
!! wikitext
{{1x|[foo]|{{1x|[bar]}}}}
!! html/php+tidy
[foo]
!! html/parsoid
[foo]
!! end
!! test
Parsoid: Pipes in external links in template parameter
!! wikitext
{{1x|[{{1x|http://example.com}} link]}}
!! html/php+tidy
!! end
!! test
Parsoid: Pipe in external link target and content in template parameter
!! options
parsoid=html2wt,wt2wt
!! wikitext
{{1x|[http://foo.com/a|b a|b]}}
!! html/php+tidy
!! end
!! test
Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
!! wikitext
{{1x|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
!! html/php+tidy
!! end
!! test
Templates: Don't escape already nowiki-escaped text in template parameters
!! options
parsoid=html2wt,wt2wt
!! wikitext
{{1x|foo|bar}}
{{1x|<div>}}
{{1x|}}
!! html/php+tidy
foo|bar
<div>
!! html/parsoid
foo|bar<div>
!! end
## T54824
!! test
Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
!! options
parsoid=html2wt,wt2wt
!! wikitext
{{1x|{{1x|1=bar}}}}
!! html/php+tidy
bar
!! html/parsoid
bar
!! end
## T58733
!! test
Templates parameters with special tokenizing behavior dont get modified because of arg escaping
!! wikitext
{{1x|a : b}}
!! html/php+tidy
a : b
!! html/parsoid
a: b
!! end
## T73412
!! test
Templates: Preserve blank parameter names
!! wikitext
{{1x|=foo}}
!! html/php+tidy
{{{1}}}
!! html/parsoid
{{{1}}}
!! end
!! test
Templates: Preserve blank parameter names in other positions
!! wikitext
{{blank_param|bar|=foo}}
!! html/php+tidy
bar
foo
!! html/parsoid
bar
foo
!! end
###
### Parsoid-centric tests for testing RT edge cases for pre
###
!!test
1a. Indent-Pre and Comments
!! wikitext
a
c
!! html
a
c
!!end
!!test
1b. Indent-Pre and Comments
!! wikitext
a
c
!! html
a
c
!!end
!!test
1c. Indent-Pre and Comments
!! wikitext
a
a
!! html
a
a
!!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
b
!! html
a
b
!!end
!!test
2a. Indent-Pre and tables
!! wikitext
{|
|-
!h1!!h2
|foo||bar
|}
!! html
h1
h2
foo
bar
!!end
!!test
2b. Indent-Pre and tables
!! wikitext
{|
|-
|foo
|}
!! html
foo
!!end
!!test
2c. Indent-Pre and tables (T44252)
!! wikitext
{|
|+foo
! |bar
|}
!! html
foo
bar
!!end
!!test
2d. Indent-Pre and tables
!! wikitext
a
{|
|b
|}
!! html/php
a
b
!! html/parsoid
a
b
!!end
!!test
2e. Indent-Pre and table-line syntax
!! wikitext
a
| b
| c
!! html/php
a
| b
| c
!!end
!!test
2f. Indent-pre started by table-line syntax
!! wikitext
a
| b
| c
!! html/php
a
| b
| c
!! html/parsoid
a
| b
| c
!!end
!! test
2g. Indented table markup mixed with indented pre content (proposed in T8200)
!! wikitext
Text that should be rendered preformatted
!! html
Text that should be rendered preformatted
!! end
!! test
2h. Indent pre in tables
!! options
parsoid=wt2html,html2html
!! wikitext
{|
!
foo
!
bar
|-
|
baz
{{!}}
bam
|}
!! html/php
foo
bar
baz
bam
!! html/parsoid
foo
bar
baz
bam
!! end
!! test
3a. Indent-Pre and block tags (single-line html)
!! wikitext
a
foo
b
foo
c
foo
foo
!! html+untidy
a
foo
b
foo
c
foo
foo
!! html/php+tidy
a
foo
b
foo
c
foo
foo
!! html/parsoid
a
foo
b
foo
c
foo
foo
!! end
!! test
3b. Indent-Pre and block tags (multi-line html)
!! wikitext
a foo
b
foo
!! html/php+untidy
a foo
b
foo
!! html/parsoid
a foo
b
foo
!! html/php+tidy
a foo
b
foo
!! end
!! test
3c. Indent-Pre and block tags (pre-content on separate line)
!! wikitext
foo
foo
foo
foo
foo
foo
foo
!! html/php
foo
foo
foo
foo
foo
foo
foo
!! html/parsoid
foo
foo
foo
foo
foo
foo
foo
!! end
!! test
4. Indent-Pre and extension tags
!! options
parsoid=wt2html,html2html
!! wikitext
a
!! html/php+tidy
a
NULL
array (
)
!! html/parsoid
a
!! end
!! test
5. Indent-Pre and html pre
!! wikitext
hi
!! html/php
hi
!! html/parsoid
hi
!! end
!!test
Render paragraphs when indent-pre is suppressed in blocklevels
!! wikitext
foo
bar
!! html
foo
bar
!!end
!!test
4. Multiple spaces at start-of-line
!! wikitext
foo
foo
{|
|foo
|}
!! html
foo
foo
foo
!!end
## NOTE: the leading white-space chars on empty line are significant
!! test
5a. White-space in indent-pre
!! wikitext
a
b
!! html
a
b
!! end
## NOTE: the leading white-space chars on empty line are significant
!! test
5b. White-space in indent-pre
!! wikitext
a
b
c
!! html
a
b
c
!! end
!! test
5c. White-space in indent-pre
!! wikitext
''a''
''b''
''c''
!! html
abc
!! end
!! test
6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
!! wikitext
a
b
c
d
!! html
a
b
c
d
!! end
!! test
7a. Indent-pre and category links
!! options
parsoid=wt2html,wt2wt
!! wikitext
[[Category:foo]]
{{1x| [[Category:foo]]}}
!! html/php+tidy
!! html/parsoid
!! end
## We used to, but no longer wt2wt this test since the default serializer
## will normalize all categories to serialize on their own line.
## This wikitext usage is going to be fairly uncommon in production and
## selser will take care of preserving formatting in those scenarios.
!! test
7b. Indent-pre and category links
!! options
parsoid=wt2html
!! wikitext
[[Category:foo]] a
[[Category:foo]] {{1x|b}}
!! html/parsoid
a
b
!! end
!! test
Indent-Pre: Newlines in comments shouldn't affect sol state
!! wikitext
a b
!! html/php+tidy
a b
!! html/parsoid
a b
!! end
!! test
Indent pre with leading colon
!! wikitext
:foo
!! html/php
:foo
!! html/parsoid
:foo
!! end
###
### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
###
!!test
HTML-pre: 1. embedded newlines
!! wikitext
foo
foo
foo
foo
!! html/php+tidy
foo
foo
foo
foo
!! html/parsoid
foo
foo
foo
foo
!!end
!! test
HTML-pre: big spaces
!! wikitext
haha
haha
!! html/php+tidy
haha
haha
!! html/parsoid
haha
haha
!! end
!!test
HTML-pre: 2: indented text
!! wikitext
foo
!! html
foo
!!end
!!test
HTML-pre: 3: other wikitext
!! wikitext
* foo
# bar
= no-h =
'' no-italic ''
[[ NoLink ]]
!! html/php
* foo
# bar
= no-h =
'' no-italic ''
[[ NoLink ]]
!! html/parsoid
* foo
# bar
= no-h =
'' no-italic ''
[[ NoLink ]]
!!end
###
### Definition lists
###
!! test
Simple definition
!! wikitext
;name :Definition
!! html
name
Definition
!! end
!! test
Definition list for indentation only
!! wikitext
:Indented text
!! html
Indented text
!! end
!! test
Definition list with no space
!! wikitext
;name:Definition
!! html
name
Definition
!!end
!! test
Definition list with URL link
!! wikitext
;http://example.com/ :definition
!! html
!! end
# At Brion's and JeLuF's insistence... :)
!! test
Definition list with news link containing colon
!! wikitext
;news:alt.wikipedia.rox :This isn't even a real newsgroup!
!! html/php
!! end
!! test
Definition lists: colon in external link text
!! wikitext
;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
!! html
!! end
!! test
Definition lists: colon in HTML attribute
!! wikitext
;bold
!! html
bold
!! end
!! test
Definition lists: self-closed tag
!! wikitext
;one two :two-line fun
!! html
one two
two-line fun
!! end
!! test
Definition lists: ignore colons inside tags
!! wikitext
;one two : tag fun:::def
!! html
one two : tag fun::
def
!! end
!! test
Definition lists: excess closed tags
!! wikitext
;onetwo :bad tag fun
!! html/php+tidy
onetwo
bad tag fun
!! html/parsoid
onetwo
bad tag fun
!! end
!! test
T13748: Literal closing tags
!! wikitext
test 1
test test test test test
test 2
test test test test test
!! html
test 1
test test test test test
test 2
test test test test test
!! end
!! test
Definition and unordered list using wiki syntax nested in unordered list using html tags.
!! wikitext
;term :description
*unordered
!! html
term
description
unordered
!! end
!! test
Definition list with empty definition and following paragraph
!! wikitext
;term:
Paragraph text
!! html
term
Paragraph text
!! end
!! test
Nested definition lists using html syntax
!! wikitext
x
a
b
!! html
x
a
b
!! end
!! test
Definition Lists: No nesting: Multiple dd's
!! wikitext
;x
:a
:b
!! html
x
a
b
!! end
!! test
Definition Lists: Indentation: Regular
!! wikitext
:i1
::i2
:::i3
!! html
i1
i2
i3
!! end
!! test
Definition Lists: Indentation: Missing 1st level
!! wikitext
::i2
:::i3
!! html
i2
i3
!! end
!! test
Definition Lists: Indentation: Multi-level indent
!! wikitext
:::i3
!! html
i3
!! end
!! test
Definition Lists: Hacky use to indent tables
!! wikitext
::{|
|foo
|bar
|}
this text
should be left alone
!! html
foo
bar
this text
should be left alone
!! end
!! test
Definition Lists: Hacky use to indent tables (with content following table)
!! wikitext
:{|
|foo
|bar
|} this text should be part of the dl
!! html/php+tidy
foo
bar
this text should be part of the dl
!! html/parsoid
foo
bar
this text should be part of the dl
!! end
!! test
Definition Lists: Hacky use to indent tables, with comments (T65979)
!! wikitext
::{|
|foo
|bar
|}
this text
should be left alone
!! html/parsoid
foo
bar
this text
should be left alone
!! end
!! test
Definition Lists: Hacky use to indent tables, with comment before table
!!options
parsoid=wt2html
!! wikitext
::{|
|foo
|}
!! html/parsoid
foo
!! end
# The trailing whitespace in this test is to catch a regression in
# Parsoid after T54473.
!! test
Definition Lists: Hacky use to indent tables (WS-insensitive)
!! wikitext
:{|
|a
|}
!! html/php
a
!! html/parsoid
a
!! 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
## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
## ";"s.
##
## Ex: ";;t2 ::d2" is transformed into:
##
##
##
t2
##
##
##
##
d2
##
##
##
##
## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
## So, the same wikitext above (;;t2 ::d2) is transformed into:
##
##
##
##
##
t2
##
:d2
##
##
##
##
## All Parsoid only definition list tests have this difference.
##
## See also: https://phabricator.wikimedia.org/T8569
## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
!! test
Table / list interaction: indented table with lists in table contents
!! wikitext
:{|
|-
|a
*b
|-
|c
*d
|}
!! html
a
b
c
d
!! end
!!test
Table / list interaction: lists nested in tables nested in indented lists
!! wikitext
:{|
|
:a
:b
|
*c
*d
|}
*e
*f
!! html
!! end
!! test
Definition Lists: Nesting: Test 2
!! wikitext
;t1
::d2
!! html+tidy
t1
d2
!! end
!! test
Definition Lists: Nesting: Test 3
!! wikitext
:;t1
::::d2
!! html+tidy
t1
d2
!! end
!! test
Definition Lists: Nesting: Test 4
!! wikitext
::;t3
:::d3
!! html
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
after the
containing the
.)
## It also exposes a "misfeature" in tidy, which doesn't like
##
tags with a single
child; it converts the
into
## a
in that case. (Parsoid leaves the
alone!)
!! test
Definition Lists: Mixed Lists: Test 1
!! wikitext
:;*foo
::*bar
:;baz
!! html/php+untidy
foo
bar
baz
!! html/php+tidy
foo
bar
baz
!! html/parsoid
foo
bar
baz
!! end
!! test
Definition Lists: Mixed Lists: Test 2
!! wikitext
*:d1
*:d2
!! html
d1
d2
!! end
!! test
Definition Lists: Mixed Lists: Test 3
!! wikitext
*:::d1
*:::d2
!! html
d1
d2
!! end
!! test
Definition Lists: Mixed Lists: Test 4
!! wikitext
*;d1 :d2
*;d3 :d4
!! html
d1
d2
d3
d4
!! end
!! test
Definition Lists: Mixed Lists: Test 5
!! wikitext
*:d1
*::d2
!! html
d1
d2
!! end
!! test
Definition Lists: Mixed Lists: Test 6
!! wikitext
#*:d1
#*:::d3
!! html
d1
d3
!! end
!! test
Definition Lists: Mixed Lists: Test 7
!! wikitext
:*d1
:*d2
!! html
d1
d2
!! end
!! test
Definition Lists: Mixed Lists: Test 8
!! wikitext
:*d1
::*d2
!! html
d1
d2
!! end
!! test
Definition Lists: Mixed Lists: Test 9
!! wikitext
*;foo :bar
!! html
foo
bar
!! end
!! test
Definition Lists: Mixed Lists: Test 10
!! wikitext
*#;foo :bar
!! html
foo
bar
!! end
# The Parsoid team disagrees with the PHP parser's seemingly-random
# rules regarding dd/dt on the next few tests. Parsoid is more
# consistent, and recognizes the shared nesting and keeps the
# still-open tags around until the nesting is complete.
# This is a regression test for T175099
!! test
Definition Lists: Mixed Lists: Test 11
!! wikitext
;a
:*b
!! html/php
a
b
!! html/parsoid
a
b
!! end
# FIXME: Maybe get rid of this test?
!! test
Definition Lists: Mixed Lists: Test 12
!! wikitext
*#*#;*;;foo :bar
*#*#;boo :baz
!! html/php+untidy
foo
bar
boo
baz
!! html/php+tidy
foo
bar
boo
baz
!! html/parsoid
foo
bar
boo
baz
!! end
!! test
Definition Lists: Mixed Lists: Test 13
!! wikitext
*#*#;*;;foo : bar
*#*#;boo : baz
!! html+tidy
foo
bar
boo
baz
!! end
# FIXME: Maybe get rid of this test?
# From old whitelist description:
# * The test is wrong, there are two colons where there should be :;
# * The PHP parser is wrong to close the
after the
containing the
.
!! test
Definition Lists: Weird Ones: Test 1
!! wikitext
*#;*::;;foo :bar (who uses this?)
!! html/php+tidy
foo
bar (who uses this?)
!! html/parsoid
foo
bar (who uses this?)
!! end
!! test
Definition Lists: colons occurring in tags
!! wikitext
;a:b
;'''a:b'''
;a:b
;a:b
;
!! end
# Parsoid's output differs here again because it shares
# nesting between the two lists unlike the PHP parser.
# Unsure which is more desirable.
!! test
Definition Lists: colons and tables 1
!! wikitext
:{|
|x
|}
:{|
|y
|}
!! html/php
x
y
!! html/parsoid
x
y
!! end
# FIXME: Does this need a html/php section?
!! test
Definition Lists: template interaction
!! wikitext
::{{definition_list}}
:one
::{{definition_list}}
:::two
:::three
::four
!! html/parsoid
one
two
one
one
two
two
three
four
!! end
###
### External links
###
!! test
External links: non-bracketed
!! wikitext
Non-bracketed: http://example.com
!! html
!! end
# parsoid doesn't explicitly mark autonumbered links, see T55505
!! test
External links: dollar sign in URL (autonumber)
!! wikitext
[http://example.com/1$2345]
!! html/php
!!end
# parsoid adds a space before the link name
!! test
External links: open square bracket forbidden in URL (named) (T6377)
Parsoid variant.
!! wikitext
[http://example.com/1 [2345]
!! html
!! end
# parsoid doesn't explicitly mark autonumbered links, see T55505
!! test
External links: protocol-relative URL in brackets without text
!! wikitext
[//example.com]
!! html/php
!! end
!! test
External links: protocol-relative URL in free text is left alone
!! wikitext
//example.com/Foo
!! html
//example.com/Foo
!!end
!! test
External links: protocol-relative URL in the middle of a word is left alone (T32269)
!! wikitext
foo//example.com/Foo
!! html
foo//example.com/Foo
!! end
## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
!! test
External links: with no contents
!! options
parsoid=wt2html,wt2wt
!! wikitext
[http://en.wikipedia.org/wiki/Foo]
[[wikipedia:Foo|Bar]]
[[wikipedia:Foo|Bar]]
!! html/php
!! end
!! test
External links: No preceding word characters allowed (T67278)
!! wikitext
NOPEhttp://example.com
N0http://example.com
ok:http://example.com
ok-http://example.com
!! html
!! end
!! test
External links: nofollow domain exception
!! wikitext
A [https://no-nofollow.org/foobar link], and another [https://example.org link].
!! html
!!end
!! test
External image
!! wikitext
External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
!! html
External image:
!! end
!! test
External image from https
!! wikitext
External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
!! html
External image from https:
!! end
!! test
External image (when not allowed)
!! options
wgAllowExternalImages=0
!! wikitext
External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
!! html
!! end
!! test
External links: old bug with URL in query
!! wikitext
Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
!! html
!! end
!! test
External links: old URL-in-URL bug, mixed protocols
!! wikitext
And again with mixed protocols: [ftp://example.com?url=http://example.com link]
!! html
!!end
# Since Parsoid is starting to emit canonical wikitext for links,
# [http://example.com http://example.com] will not RT back to that
# form anymore.
!! test
External links: URL in text
!! options
parsoid=wt2html
!! wikitext
URL in text: [http://example.com http://example.com]
!! html/php
!! end
##
## Note that parsoid doesn't explicit mark autonumbered links, nor
## does it number them. As discussed in T55505, we can identify
## autonumbered links via CSS.
##
!! test
External links: [raw ampersand]
!! wikitext
Old & use: [http://x&y]
!! html/php
!! end
# note that parsoid html is identical to [raw ampersand] case; so html2wt
# mode will return the [raw ampersand] wikitext
!! test
External links: [encoded ampersand]
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
Old & use: [http://x&y]
!! html/php
!! end
# note that parsoid html is identical to [raw equals] case; so html2wt
# mode will return the [raw equals] wikitext
!! test
External links: [encoded equals] (T8102)
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[http://example.com/?foo=bar]
!! html/php
!! end
# xxx parsoid strips the IDN character, so the round-trip tests will
# obviously fail and are disabled. --cscott
!! test
External links: [IDN ignored character reference in hostname; strip it right off]
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[http://example.com/]
!! html/php
!! end
# FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
# Where an external link could easily circumvent the sanitization of the text of
# a link like this (where an IDN-ignore character is in the URL somewhere), this
# test demands a higher standard. That's a bit strange.
#
# Example:
#
# http://example.com -> [http://example.com|http://example.com]
# [http://example.com|http://example.com] -> [http://example.com|http://example.com]
#
# The first example is sanitized, but the second is not. Any security benefits
# from this production are trivial to circumvent. Either remove this test and
# let the parser(s) do their thing unaccosted, or fix the inconsistency and change
# the test accordingly.
#
# All our love,
# The Parsoid team.
# xxx parsoid strips the IDN character, so the round-trip tests will
# obviously fail and are disabled. --cscott
!! test
External links: IDN ignored character reference in hostname; strip it right off
!! options
parsoid=wt2html,html2html
!! wikitext
http://example.com/
!! html/php
!! end
# parsoid doesn't explicitly mark autonumbered links, see T55505
!! test
External links: URL within URL (T2002)
!! wikitext
[http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
!! html/php
!! end
# Note edge case difference between PHP and Parsoid here.
!! test
External links: wiki links within external link (T5695)
!! options
parsoid=wt2html,html2html
!! wikitext
[http://example.com [[wikilink]] embedded in ext link]
[http://example.com test [[wikilink]] embedded in ext link]
!! html/php
!! end
!! test
T2787: Links with one slash after the url protocol are invalid
!! wikitext
http:/example.com
[http:/example.com title]
!! html
http:/example.com
[http:/example.com title]
!! end
!! test
Bracketed external links with template-generated invalid target
!! wikitext
[{{1x|http:/example.com}} title]
!! html
[http:/example.com title]
!! end
# wt2html only because Parsoid would want to add s coming from html
!! test
Broken wikilinks (but not external links) prevent templates from closing
!! options
parsoid=wt2html
!! wikitext
[http://example.com x
{{1x|[http://example.com x}}
[[Foo
{{1x|[[Foo}}
!! html/php
!! end
!! article
Template:pipe page
!! text
Main|Page
!! endarticle
## FIXME: Parsoid doesn't support this and may never. See T226523
!! test
Template returning pipe used in wikilink target
!! wikitext
[[{{pipe page}}]]
!! html/php+tidy
!! end
# According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
# % is actually legal in HTML5. Any change in output would need testing though.
!! test
T6781, T7267: %25 in URL
!! wikitext
http://www.example.com/?title=100%25_Bran
!! html/php
!! end
!! test
External link containing double-single-quotes in text '' (T6598 sanity check)
!! wikitext
Some [http://example.com/ pretty ''italics'' and stuff]!
!! html
!! end
# Note different rendering by Parsoid here compared to the legacy parser.
!! test
External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
!! wikitext
''Some [http://example.com/ pretty ''italics'' and stuff]!''
!! html+untidy
!! end
# Don't add the html/php section since the output is broken and there isn't any reason to spec it
!! test
External link containing double-single-quotes with no space separating the url from text in italics
!! wikitext
[http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
!! html/php+tidy
!! end
# It might make sense to change this behavior; see
# See https://phabricator.wikimedia.org/T238022#5665580
!! test
Unicode text around autolinks
!! wikitext
größhttps://foo.org
größ https://foo.org
아들 고건 사진https://foo.org
💩https://foo.org
!! html/php+tidy
!! wikitext
[[Foo|Bar]]
[[Foo|Bar]]
[[:en:Foo|Bar]]
[[:en:Foo|Bar]]
[[:en:European_Robin|European Robin]]
[[:en:European_Robin|European Robin]]
!! end
!! test
mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
!! options
parsoid=wt2wt
!! wikitext
[http://en.wikipedia.org/wiki/European_Robin European Robin]
!! html/parsoid
THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
!! end
###
### Quotes
###
!! test
Quotes
!! wikitext
Normal text. '''Bold text.''' Normal text. ''Italic text.''
Normal text. '''''Bold italic text.''''' Normal text.
!! html
Normal text. Bold text. Normal text. Italic text.
Normal text. Bold italic text. Normal text.
!! end
!! test
Quotes wrapping HTML table
!! wikitext
'''
hi
'''
!! html/php+tidy
hi
!! html/parsoid
hi
!! end
# Parsoid inserts an empty bold tag pair at the end of the line.
# The wikitext contains just the first half of the bold
# quote pair.
!! test
Unclosed and unmatched quotes
!! wikitext
'''''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
!! html/php
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
!! html/parsoid
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
###
### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
###
# This should not produce
as
# is the bare minimum required by the spec, see:
# https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
# Parsoid team replies: empty table tags are legal in HTML5
!! test
A table with no data.
!! options
parsoid=wt2html
!! wikitext
{||}
!! html/php
!! html/parsoid
!! end
!! test
A table with stray table end tags on start tag line (wt2html)
!! options
parsoid=wt2html
!! wikitext
{|style="color: red;"|}
{|style="color: red;" |}
|foo
|}
{|style="color: red;"|} id="foo"
|foo
|}
{|style="color: red;" |} id="foo"
|foo
|}
!! html/php+tidy
foo
foo
foo
!! html/parsoid
foo
foo
foo
!! end
!! test
A table with no data (take 2)
!! wikitext
{|
|}
!! html/parsoid
!! end
# A table with nothing but a caption is invalid XHTML, we might want to render
# this as
caption
# Parsoid team replies: table with only a caption is legal in HTML5
!! test
A table with nothing but a caption
!! wikitext
{|
|+caption
|}
!! html/php
caption
!! html/parsoid
caption
!! end
!! test
A table with caption with default-spaced attributes and a table row
!! wikitext
{|
|+ style="color: red;" |caption1
|-
|foo
|}
!! html
caption1
foo
!! end
!! test
A table with captions with non-default spaced attributes and a table row
!! wikitext
{|
|+style="color: red;"|caption2
|+ style="color: red;"|caption3
|-
|foo
|}
!! html
caption2
caption3
foo
!! end
!! test
Table td-cell syntax variations
!! wikitext
{|
|foo bar foo|baz
|foo bar foo||baz
|style='color:red;'|baz
|style='color:red;'||baz
|}
!! html
baz
foo bar foo
baz
baz
style='color:red;'
baz
!! end
!! test
Simple table
!! wikitext
{|
|1||2
|-
|3||4
|}
!! html
1
2
3
4
!! end
!! test
Simple table but with multiple dashes for row wikitext
!! wikitext
{|
|foo
|-----
|bar
|}
!! html
!! end
!! test
Accept "||" in table headings
!! wikitext
{|
!h1||h2
|}
!! html
h1
h2
!! end
!! test
Accept "!!" in table data
!! wikitext
{|
|Foo!!||
|}
!! html
Foo!!
!! html/parsoid
Foo!!
!! end
!! test
Accept "||" in indented table headings
!! wikitext
:{|
!h1||h2
|}
!! html
h1
h2
!! end
!! test
Accept "!!" in templates
!! wikitext
{|
!a {{1x|b!!c}}
|}
!! html/php
a b
c
!! html/parsoid
a b
c
!! end
!! test
Accept "!!" in table headings after newline
!! wikitext
{|
!a
b!!c
|}
!! html/php
a
b!!c
!! html/parsoid
a
b!!c
!! end
!! test
Accept "!!" in table data of mixed wikitext / html syntax
!! wikitext
{|
!a
b!!c
|}
!! html/php+tidy
a
b!!c
!! html/parsoid
a
b!!c
!! end
!! test
Accept empty attributes in td/th cells (td/th cells starting with leading ||)
!! wikitext
{|
!|h1
||a
|}
!! html
h1
a
!! end
!!test
Accept "| !" at start of line in tables (ignore !-attribute)
!! wikitext
{|
|-
|!style="color:red"|bar
|}
!! html
bar
!!end
!!test
Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
!! wikitext
{|
|-
|style='color:red;'|+1
|style='color:blue;'|-1
|-
|1||2||3
|1||+2||-3
|-
| +1
| -1
|}
!! html
+1
-1
1
2
3
1
+2
-3
+1
-1
!!end
# Differences between Parsoid and PHP re: trailing whitespace in a
# table cell.
!! test
Table rowspan
!! wikitext
{| border=1
|Cell 1, row 1
|rowspan=2|Cell 2, row 1 (and 2)
|Cell 3, row 1
|-
|Cell 1, row 2
|Cell 3, row 2
|}
!! html/php
Cell 1, row 1
Cell 2, row 1 (and 2)
Cell 3, row 1
Cell 1, row 2
Cell 3, row 2
!! html/parsoid
Cell 1, row 1
Cell 2, row 1 (and 2)
Cell 3, row 1
Cell 1, row 2
Cell 3, row 2
!! end
!! test
Nested table
!! wikitext
{| border=1
| α
|
{| bgcolor=#ABCDEF border=2
|nested
|-
|table
|}
|the original table again
|}
!! html
α
nested
table
the original table again
!! end
!! test
Invalid attributes in table cell (T3830)
!! wikitext
{|
|Cell:|broken
|}
!! html
broken
!! end
!! test
Table cell attributes: Pipes protected by nowikis should be treated as a plain character
!! wikitext
{|
|title="foo" |bar
|title="foo|" |bar
|title="foo|" bar
|}
!! html/php
bar
bar
title="foo|" bar
!! html/parsoid
bar
bar
title="foo|" bar
!! end
# See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
# N.B. The "|}" to close the table is missing from the input, so parsoid's
# *2wt modes will fail.
!! test
Table security: embedded pipes
!! options
parsoid=wt2html,html2html
!! wikitext
{|
| |[ftp://|x||]" onmouseover="alert(document.cookie)">test
!! html/php
!! end
## We don't support roundtripping of these attributes in Parsoid.
## Selective serialization takes care of preventing dirty diffs.
## But, on edits, we dirty-diff the invalid attribute text.
!! test
Invalid text in table attributes should be discarded
!! options
parsoid=wt2html
!! wikitext
{| boo style='border:1px solid black'
| boo style='color:blue' |1
|boo style='color:blue'|2
|}
!! html/php
1
2
!! html/parsoid
1
2
!! end
!! test
Invalid text in table attributes should be preserved by selective serializer
!! options
parsoid={
"modes": ["selser"],
"changes": [
["td:first-child", "text", "abc"],
["td + td", "text", "xyz"]
]
}
!! wikitext
{| boo style='border:1px solid black'
| boo style='color:blue' | 1
|boo style='color:blue'| 2
|}
!! wikitext/edited
{| boo style='border:1px solid black'
| boo style='color:blue' | abc
|boo style='color:blue'| xyz
|}
!! end
!! test
1. Template-generated table cell attributes and cell content
!! wikitext
{|
|{{table_attribs}}
| {{table_attribs}}
|| {{table_attribs_5}}
| {{table_attribs}}
|align=center {{table_attribs}}
| align=center {{table_attribs}}
|}
!! html
Foo
Foo
style="color:red;"
Bar
Foo
Foo
Foo
!! end
!! test
2. Template-generated table cell attributes and cell content
!! wikitext
{|
|{{table_attribs_2}}
|}
!! html/php
Foo
Bar
Baz
!! html/parsoid
Foo
Bar
Baz
!! end
!! test
3. Template-generated table cell attributes and cell content
!! wikitext
{|
!align=center {{table_header_cells}}
|-
|align=center {{table_cells}}
|}
!! html/php
Foo
Bar
Foo and Baz
Foo
Bar
Foo and Baz
!! html/parsoid
Foo
Bar
Foo and Baz
Foo
Bar
Foo and Baz
!! end
!! test
4. Template-generated table cell attributes and cell content inside a templated table
!! wikitext
{{tbl-start}}
!align=center {{table_header_cells}}
|-
|align=center {{table_cells}}
{{tbl-end}}
!! html/php
Foo
Bar
Foo and Baz
Foo
Bar
Foo and Baz
!! html/parsoid
Foo
Bar
Foo and Baz
Foo
Bar
Foo and Baz
!! end
## Edge case fix to prevent future regressions
!! test
T107652: s in templates that also generate table cell attributes should be rendered properly
!! wikitext
{|
|{{table_attribs_7}}
|}
!! html/parsoid
!! end
!! test
Table with row followed by newlines and table heading
!! options
parsoid=wt2html,html2html
!! wikitext
{|
|-
!foo
|}
!! html/*
foo
!! end
!! test
Table with empty line following the start tag
!! options
parsoid=wt2html,html2html
!! wikitext
{|
|-
|foo
|}
!! html/*
foo
!! end
!! test
Table attributes with empty value
!! options
parsoid=wt2html,html2html
!! wikitext
{|
| style=|hello
|}
!! html/php
hello
!! html/parsoid
hello
!! end
!! test
Wikitext table with a lot of comments
!! wikitext
{|
|foo
|-
|
|}
!! html
foo
!! end
!! test
Wikitext table comments represented in parsoid dom
!! wikitext
{|
|-
|x
|}
!! html/php+tidy
x
!! html/parsoid
x
!! end
!! test
Wikitext table with double-line table cell
!! wikitext
{|
|a
b
|}
!! html
a
b
!! end
!! test
Table cell with a single comment
!! wikitext
{|
|
|a
|}
!! html
a
!! end
!! test
Table-cell after a comment-only-empty-line
!! wikitext
{|
|a
|b
|}
!! html
a
b
!! html/parsoid
a
b
!! end
!! test
Build table with {{!}}
!! wikitext
{{{!}} class="wikitable"
!header
!second header
{{!}}- style="color:red;"
{{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
{{!}}}
!! html
header
second header
data
second data
!! end
!! test
Build table with pipe as data
!! wikitext
{| class="wikitable"
!header
!second header
|- style="color:red;"
|data|| style="color:red;" |second data
|-
| style="color:red;" |data with | || style="color:red;" | second data with |
|-
||data with | |||second data with |
|}
!! html
header
second header
data
second data
data with |
second data with |
data with |
second data with |
!! end
!! test
Build table with wikilink
!! wikitext
{| class="wikitable"
!header||second header
|- style="color:red;"
|data [[Main Page|linktext]]||second data [[Main Page|linktext]]
|-
|data||second data [[Main Page|link|text with pipe]]
|}
!! html
!! 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
!! wikitext
{|
|-
foo
|}
!! html/parsoid
foo
!! end
## Remex doesn't account for fostered content.
!! test
Fostered content in tables: Plain text
!! options
parsoid=wt2html
!! wikitext
{|
|-
a
|}
!! html/php+untidy
a
!! html/php+tidy
a
!! html/parsoid
a
!! end
!! test
Fostered content in tables: Lists
!! options
parsoid=wt2html,html2html
!! wikitext
{|
|-
*a
|}
!! html/php+untidy
a
!! html/php+tidy
a
!! html/parsoid
a
!! end
!! test
Template generated table cell with attributes
!! wikitext
{|
|-
{{table_attribs_4}} ||a||b
|}
!! html/php+tidy
a
b
!! html/parsoid
a
b
!! end
!! test
Parsoid: Round-trip tables directly followed by content (T53219)
!! options
parsoid=wt2html,wt2wt
!! wikitext
{|
|foo
|} bar
{|
|baz
|}quux
!! html+tidy
foo
bar
baz
quux
!! html/parsoid
foo
bar
baz
quux
!! end
!! test
Parsoid: Default to a newline after tables in new content (T53219)
!! options
parsoid=html2wt
!! html/parsoid
foo
bar
baz
quux
!! wikitext
{|
|foo
|}
bar
{|
|baz
|}
'''quux'''
!! end
!! test
Parsoid: Row-syntax table headings followed by comment & table cells
!! options
parsoid=wt2html,wt2wt
!! wikitext
{|
!foo||bar
||baz||quux
|}
!! html/php
!!end
# Note: PHP parser omits empty rows
!! test
Tables: Digest broken attributes on table and tr tag
!! options
parsoid=wt2html
!! wikitext
{| || |} ++
|- || || ++ --
|- > [
|}
!! html/php+tidy
!! html/parsoid
!! end
!! test
Table with missing opening
tag
!! options
parsoid=wt2html,wt2wt
!! wikitext
foo
!! html+tidy
foo
!! end
# T137406: Whitespace in the HTML
!! test
1. Generate correct wikitext for tables with thead/tbody/tfoot
!! options
parsoid=html2wt
!! html/parsoid
!! end
# T137406: No whitespace in the HTML
!! test
2. Generate correct wikitext for tables with thead/tbody/tfoot
!! options
parsoid=html2wt
!! html/parsoid
heading
foo
!! wikitext
{|
!heading
|-
|foo
|}
!! end
!! test
Wikitext tables can be nested inside HTML tables
!! options
parsoid=html2wt
!! html/parsoid
foo
!! wikitext
{|
|foo
|}
!! html/php+tidy
foo
!! end
###
### Internal links
###
!! test
Plain link, capitalized
!! wikitext
[[Main Page]]
!! html
!! end
!! test
Piped link with no link text
!! wikitext
[[Thomas Bek (bishop of St David's)|]]
!! html/php
[[Thomas Bek (bishop of St David's)|]]
!! html/parsoid
[[Thomas Bek (bishop of St David's)|]]
!! end
!! test
Piped link with empty link text
!! wikitext
[[Main Page|]] - empty nowiki
[[Main Page| ]] - empty space
[[Main Page| ]] - empty non breaking space
!! html/php
- empty nowiki
- empty space
- empty non breaking space
!! html/parsoid
- empty nowiki
- empty space
- empty non breaking space
!! end
!! test
Broken link
!! wikitext
[[Zigzagzogzagzig]]
!! html
!! end
# The PHP parser strips the hash fragment for non-existent pages, but
# Parsoid does not. (T227693)
!! test
Broken link with fragment
!! wikitext
[[Zigzagzogzagzig#zug]]
!! html/php
!! end
# Parsoid does not strip fragment from red links: T227693
!! test
Nonexistent special page link with fragment
!! wikitext
[[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
!! html/php
!! end
!! article
prefixed article
!! text
Some text
!! endarticle
!! test
T45661: Piped links with identical prefixes
!! wikitext
[[prefixed article|prefixed articles with spaces]]
[[prefixed article|prefixed articlesaoeu]]
[[Main Page|Main Page test]]
!! html
!! 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 (T53680)
!! wikitext
[[MemoryAlpha:AlphaTest]]
!! html
!! end
# The previous test doesn't work correctly in html2*, due to not recognizing the
# link as an internal one. This one checks for the correct behavior.
!! test
Link to namespace preferred over interwiki with correct rel attribute
!! options
parsoid=html2wt,html2html
!! html/parsoid
!! end
!! test
Link containing }
!! wikitext
[[Usually caused by a typo (oops}]]
!! html
[[Usually caused by a typo (oops}]]
!! end
!! article
7% Solution
!! text
Just a test of an article title containing a percent.
!! endarticle
!! test
Link containing % (not as a hex sequence)
!! wikitext
[[7% Solution]]
[[7% Solution|7%25 Solution]]
!! html/php
!! end
# note that the parsoid HTML is identical to the previous test output,
# so the previous test ensures that the html2wt mode will generate the
# "not as a hex sequence" wikitext.
!! test
Link containing % as a single hex sequence interpreted to char
!! options
parsoid=wt2wt,wt2html,html2html
!! wikitext
[[7%25 Solution]]
[[7%25 Solution|7%25 Solution]]
!! html/php
!!end
!! test
Link containing % as a double hex sequence interpreted to hex sequence
!! wikitext
[[7%2525 Solution]]
!! html
[[7%2525 Solution]]
!!end
## Example for such a section: == < ==
!! test
Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
!! options
title=[[Main Page]]
!! config
wgFragmentMode=[ 'html5', 'legacy' ]
!! wikitext
[[%23%3c]][[%23%3e]]
!! html/php
!! end
## Example for such a section: == < ==
!! test
Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
!! config
wgFragmentMode=[ 'legacy' ]
!! wikitext
[[%23%3c]][[%23%3e]]
!! html/php
!! end
!! article
Foo & bar
!! text
Just a test of an article title containing an ampersand
!! endarticle
!! test
Link containing an ampersand
!! wikitext
[[Foo & bar]]
[[Foo & bar]]
[[Foo & bar]]
!! html/php+tidy
!! 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
!! wikitext
[[Foo~bar]]
!! html/php
!! end
!! test
Redirect containing double quotes and spaces
!! wikitext
#REDIRECT [[Cool "Gator"]]
!! html/parsoid
!! end
!! test
Link containing double-single-quotes '' in text (T6598 sanity check)
!! wikitext
Some [[Link|pretty ''italics'' and stuff]]!
!! html/php
!! end
!! test
Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
!! wikitext
''Some [[Link|pretty ''italics'' and stuff]]!''
!! html
!! end
## FIXME: Title part of filename is interpreted in php
!! test
Link with double quotes in title part (literal) and alternate part (interpreted)
!! wikitext
[[File:Denys_Savchenko_''Pentecoste''.jpg]]
[[''Pentecoste'']]
[[''Pentecoste''|Pentecoste]]
[[''Pentecoste''|''Pentecoste'']]
!! html/php
!! end
!! test
Broken image links with HTML captions (T41700)
!! wikitext
[[File:Nonexistent|]]
[[File:Nonexistent|100x100px|]]
[[File:Nonexistent|<]]
[[File:Nonexistent|abc]]
!! html/php
!! end
!! test
Plain link to URL containing special characters, with link text (see T213950).
!! wikitext
[[http://www.example.com/?q=%7Babc%7D Link text]]
!! html
!! end
# I'm fairly sure the expected result here is wrong.
# We want these to be URL links, not pseudo-pages with URLs for titles....
# However the current output is also pretty screwy.
#
# ----
# I'm changing it to match the current output--it arguably makes more
# sense in the light of the test above. Old expected result was:
#
# But I think this test is bordering on "garbage in, garbage out" anyway.
# -- wtm
!! test
Piped link to URL
!! wikitext
Piped link to URL: [[http://www.example.com|an example URL]]
!! html/php
!! end
# Parsoid does not mark self-links, by design.
!! test
T2337: Escaped self-links should be bold
!! options
title=[[Bug462]]
!! wikitext
[[Bug462]] [[Bug462]]
!! html/php+tidy
!! end
## Parsoid doesn't get this right and even fails wt2html because, when doing the
## normalization for comparison, the html serialization / re-parse doesn't
## roundtrip. This is T49963
!! test
!!end
# Add new article for the test below so that it doesn't red-link
!! article
Foo bar baz
!! text
boo
!! endarticle
!! test
Multiple spaces in titles should normalize to a single underscore
!! options
parsoid=wt2html,wt2wt
!! wikitext
[[Foo bar baz|x]]
[[Foo bar baz|x]]
[[Foo bar baz|x]]
!! html/php
!! end
!! test
Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
!! options
language=ca
!! wikitext
'''[[Main Page]]'''
!! html
!! end
!! test
Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
!! options
language=ca
!! wikitext
''[[Main Page]]''
!! html
!! end
## Mainly a sanity check for Parsoid
!! test
Handle title parsing for subpages
!! options
title=[[/123123]]
subpage
!! wikitext
123
!! html/php
123
!! html/parsoid
123
!! end
!! article
User:Test/123
!! text
test 123
!! endarticle
!! test
Link to a subpage from a namespace other than main
!! options
title=[[User:Test]]
subpage
!! wikitext
[[/123]]
!! html/php
!! end
!! test
Ensure that transclusion titles are not url-decoded
!! options
subpage title=[[Test]]
parsoid=wt2html
!! wikitext
{{Bar%C3%A9}} {{/Bar%C3%A9}}
!! html/php
{{Bar%C3%A9}} {{/Bar%C3%A9}}
!! html/parsoid
{{Bar%C3%A9}} {{/Bar%C3%A9}}
!! end
!! test
Purely hash wikilink
!! options
title=[[User:Test/123]]
subpage
!! wikitext
[[#a|b]]
!! html/php
!! end
!! article
Söfnuður
!! text
Test.
!! endarticle
!! test
Internal link with is link prefix
!! options
language=is
!! wikitext
Aðrir mótmælenda[[söfnuður|söfnuðir]] og
!! html
!! end
!! article
Mótmælendatrú
!! text
Test.
!! endarticle
!! test
Internal link with is link trail and link prefix
!! options
language=is
!! wikitext
[[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
!! html
!! wikitext
[[Test]]
[[[Test]]]
[[[[Test]]]]
[[[[[Test]]]]]
[[[[[[Test]]]]]]
[[[[[[[Test]]]]]]]
!! end
!! test
Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
!! wikitext
[[Foo| bar]]
[[Foo| ''bar'']]
[http://wp.org foo]
[http://wp.org ''foo'']
!! html
!! end
## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
!! test
Interwiki link encoding conversion (T3636)
!! options
parsoid=wt2html,wt2wt
!! wikitext
*[[Wikipedia:ro:Olteniţa]]
*[[Wikipedia:ro:Olteniţa]]
!! html/php+untidy
!! end
## The interwiki case here continued to be legacy escaped because of the
## default setting of $wgExternalInterwikiFragmentMode
!! test
Link scenarios with escaped fragments
!! options
title=[[Main Page]]
!! config
wgFragmentMode=[ 'html5', 'legacy' ]
!! wikitext
[[#Is this great?]]
[[Foo#Is this great?]]
[[meatball:Foo#Is this great?]]
!! html/php
!! end
!! test
Link scenarios with escaped fragments (legacy)
!! config
wgFragmentMode=[ 'legacy' ]
!! wikitext
[[#Is this great?]]
[[Foo#Is this great?]]
[[meatball:Foo#Is this great?]]
!! html/php
!! end
# Ideally the wikipedia: prefix here should be proto-relative too
# [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
# define the 'en' prefix, and originally the test used 'wikipedia',
# which isn't a localinterwiki prefix hence the links to the 'en:Foo'
# article.
!! test
Different interwiki prefixes mapping to the same URL
!! wikitext
[[:en:Foo]]
[[:en:Foo|Foo]]
[[wikipedia:Foo]]
[[:wikipedia:Foo|Foo]]
[[wikipedia:en:Foo]]
[[:wikipedia:en:Foo]]
[[ wikiPEdia :Foo]]
!! html/parsoid
!! end
!! test
Interwiki links that cannot be represented in wiki syntax
!! wikitext
[[meatball:ok]]
[[meatball:ok#foo|ok with fragment]]
[[meatball:ok_as_well?|ok ending with ? mark]]
[http://de.wikipedia.org/wiki/Foo?action=history has query]
[http://de.wikipedia.org/wiki/#foo is just fragment]
!! html/php
!! end
# Parsoid does not mark self-links, by design.
!! test
Local interwiki link: self-link to current page
!! options
title=[[Main Page]]
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[local:Main Page]]
!! html/php
!! end
!! test
Local interwiki link: with additional interwiki prefix (T63357)
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[local:meatball:Hello]]
!! html/php
!! end
!! test
Multiple local interwiki link prefixes
!! wikitext
[[local:local:local:local:mi:local:Foo]]
!! options
parsoid=wt2html,wt2wt,html2html
!! html/php
!! end
###
### Interlanguage links
### Language links (so that searching for '### language' matches..)
###
!! test
Interlanguage link
!! wikitext
Blah blah blah
[[zh:Chinese]]
!! html/php
Blah blah blah
!! html/parsoid
Blah blah blah
!! end
## parsoid html2wt will lose the space variations
!! test
Interlanguage link with spacing
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
Blah blah blah
[[ zh : Chinese ]]
!! html/php
Blah blah blah
!! html/parsoid
Blah blah blah
!! end
!! test
Double interlanguage link
!! wikitext
Blah blah blah
[[es:Spanish]]
[[zh:Chinese]]
!! html/php
Blah blah blah
!! html/parsoid
Blah blah blah
!! end
## parsoid html2wt will lose the space variations
!! test
Interlanguage link variations
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
Blah blah blah
[[ es :Spanish]]
[[ ZH :Chinese]]
[[es:Foo_bar]]
!! html/php
Blah blah blah
!! html/parsoid
Blah blah blah
!! end
!! test
Escaping of interlanguage links (T129218, T156308)
!! wikitext
Blah blah blah
[[:es:Spanish]]
[[ : zh : Chinese ]]
!! html/php
!! end
## parsoid html2wt will normalize the space to _
!! test
Space and question mark encoding in interlanguage links (T95473)
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
Blah blah blah
[[es:Foo bar?]]
!! html/php
Blah blah blah
!! html/parsoid
Blah blah blah
!! end
!! test
Interlanguage link, with prefix links
!! options
language=ln
!! wikitext
Blah blah blah
[[zh:Chinese]]
!! html/php
Blah blah blah
!! html/parsoid
Blah blah blah
!! end
!! test
Double interlanguage link, with prefix links (T10897)
!! options
language=ln
!! wikitext
Blah blah blah
[[es:Spanish]]
[[zh:Chinese]]
!! html/php
Blah blah blah
!! html/parsoid
Blah blah blah
!! end
!! test
"Extra" interlanguage links (T34189 / gerrit 111390)
!! wikitext
Blah blah blah
[[mul:Article]]
!! html/php
Blah blah blah
!! html/parsoid
Blah blah blah
!! end
## PHP parser tests script needs an update
## Parsoid html2wt will normalize output to [[:zh:Chinese]]
!! test
Language links render as inline links if $wgInterwikiMagic=false
!! options
wgInterwikiMagic=false
parsoid=wt2html,wt2wt,html2html
!! wikitext
Blah blah blah
[[zh:Chinese]]
!! html/parsoid
!! end
## PHP parser tests script needs an update
## Parsoid html2wt will normalize output to [[:zh:Chinese]]
!! test
Language links render as inline links in the Talk namespace
!! options
title=Talk:Foo
parsoid=wt2html,wt2wt,html2html
!! wikitext
Blah blah blah
[[zh:Chinese]]
!! html/parsoid
!! end
# html2wt will fail because of title normalization without data-parsoid
!! test
Parsoid: handle constructor well
!! options
parsoid=wt2html,wt2wt
!! wikitext
[[constructor]]
[[constructor:foo]]
!! html/php
!! end
# Note that `ko` isn't a known interwiki prefix
!! test
Parsoid: recognize interwiki links without a target page
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[:es:]]
[[:ko:]]
!! html/php
!! end
!! test
Interlanguage link with preceding local interwiki link (T70085)
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
Blah blah blah
[[local:es:Spanish]]
!! html/php
!! end
!! test
Looks like an interlanguage link, but is actually a local interwiki
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
Blah blah blah
[[mi:Template:Foo]]
!! html/php
!! end
###
### Redirects, Parsoid-only
###
!! test
1. Simple redirect to page
!! wikitext
#REDIRECT [[Main Page]]
!! html/parsoid
!! end
!! test
2. Other redirect variants
!! wikitext
#REDIRECT [[Main_Page]]
!! html/parsoid
!! end
# Not a valid redirect in PHP (although perhaps it was, once upon a time)
# This tests the Parsoid bail-out code.
!! test
3. Other redirect variants
!! options
parsoid=wt2html
!! wikitext
#REDIRECT [[[[Bar]]]]
!! html/parsoid
REDIRECT [[[[Bar]]]]
!! end
!! test
4. Redirect to a templated destination
!! wikitext
#REDIRECT [[{{1x|Foo}}bar]]
!! html/parsoid
!! end
!! test
Empty redirect
!! options
parsoid=wt2html,wt2wt
!! wikitext
#REDIRECT [[]]
!! html/parsoid
REDIRECT [[]]
!! 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
!! wikitext
#REDIRECT:[[Main Page]]
!! html/parsoid
!! 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
!! wikitext
#REDIRECT
:
[[Main Page]]
!! html/parsoid
!! 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
!! wikitext
#REDIRECT [[Main Page|bar]]
!! html/parsoid
!! end
!! test
Redirect to category (T104502)
!! options
parsoid=wt2html,wt2wt
!! wikitext
#REDIRECT [[Category:Foo]]
!! html/parsoid
!! end
!! test
Redirect to category with URL encoding (T104502)
!! options
parsoid=wt2html
!! wikitext
#REDIRECT [[Category%3AFoo]]
!! html/parsoid
!! end
!! test
Redirect to category page
!! wikitext
#REDIRECT [[:Category:Foo]]
!! html/parsoid
!! end
!! test
Redirect to image page (1)
!! wikitext
#REDIRECT [[File:Wiki.png]]
!! html/parsoid
!! end
!! test
Redirect to image page (2)
!! wikitext
#REDIRECT [[Image:Wiki.png]]
!! html/parsoid
!! end
# html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
# Next test confirms this.
!! test
Redirect to language (1) (T104918)
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
#REDIRECT [[en:File:Wiki.png]]
!! html/parsoid
!! end
!! test
Redirect to language (2) (T104918)
!! wikitext
#REDIRECT [[:en:File:Wiki.png]]
!! html/parsoid
!! end
!! test
Redirect to interwiki (T104918)
!! wikitext
#REDIRECT [[meatball:File:Wiki.png]]
!! html/parsoid
!! end
!! test
Non-English #REDIRECT
!! options
language=is
!! wikitext
#TILVÍSUN [[Main Page]]
!! html/parsoid
!! end
!! test
Redirect syntax under text isn't considered a redirect
!! wikitext
some text
#redirect [[Main Page]]
!! html/parsoid
!! end
!! test
New redirect
!! options
parsoid=html2wt
!! html/parsoid
Foo
!! wikitext
#REDIRECT [[Foo]]
Foo
!! end
!! test
Redirect followed by block on the same line
!! options
parsoid=wt2html
!! wikitext
#REDIRECT [[Main Page]]==hi==
!! html/parsoid
hi
!! end
!! test
Redirect followed by a newline
!! wikitext
#REDIRECT [[Main Page]]
A newline
!! html/parsoid
A newline
!! end
!! test
Redirect followed by multiple newlines
!! wikitext
#REDIRECT [[Main Page]]
A newline
!! html/parsoid
A newline
!! end
!! test
Drop duplicate redirects
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
#REDIRECT [[Foo]]
!! end
##
## XHTML tidiness
###
!! test
to
!! wikitext
1 2 3
!! html
1 2 3
!! end
!! test
Broken br tag sanitization
!! options
parsoid=wt2html,html2html
!! wikitext
!! html/php+untidy
</br>
!! html/php+tidy
!! html/parsoid
!! end
# TODO: Fix html2html mode (T53055)!
!! test
Parsoid: Broken br tag recognition
!! options
parsoid=wt2html
!! wikitext
!! html+tidy
!! end
!! test
Incorrecly removing closing slashes from correctly formed XHTML
!! wikitext
!! html
!! end
!! test
Failing to transform badly formed HTML into correct XHTML
!! wikitext
!! html
!!end
## Parsoid's behavior w/ self-closing HTML tags is now a bug;
## see T134423. Legacy Parser now implements proper HTML5 semantics.
!! test
Handling html with a div self-closing tag
!! wikitext
!! html+tidy
!! end
!! test
Elements with solidus in various attribute positions
!! options
parsoid=wt2html,html2html
!! wikitext
ha
ha
ha
!! html/php+tidy
ha
ha
ha
!! html/parsoid
ha
ha
ha
!! end
!! test
Handling html with a br self-closing tag
!! wikitext
!! html/php+tidy
!! html/parsoid
!! end
!! test
Quoted attributes without spaces
!! options
parsoid=wt2html
!! wikitext
red
!! html/php+tidy
red
!! html/parsoid
red
!! end
!! test
Horizontal ruler (should it add that extra space?)
!! wikitext
foo bar
!! html+tidy
foo
bar
!! html/parsoid
foo
bar
!! end
!! test
Horizontal ruler -- 4+ dashes render hr
!! wikitext
----
!! html
!! end
!! test
Horizontal ruler -- eats additional dashes on the same line
!! wikitext
---------
!! html
!! end
!! test
Horizontal ruler -- does not collapse dashes on consecutive lines
!! wikitext
----
----
!! html
!! end
!! test
Horizontal ruler -- <4 dashes render as plain text
!! wikitext
---
!! html
---
!! end
!! test
Horizontal ruler -- Supports content following dashes on same line
!! wikitext
---- Foo
!! html+untidy
Foo
!! html+tidy
Foo
!! html/parsoid
Foo
!! end
###
### Block-level elements
###
!! test
Common list
!! wikitext
*Common list
*item 2
*item 3
!! html
Common list
item 2
item 3
!! end
!! test
Numbered list
!! wikitext
#Numbered list
#item 2
#item 3
!! html
Numbered list
item 2
item 3
!! end
# the switch from level 3 to ordered should not introduce a newline between
!! test
Mixed list
!! wikitext
*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
!! html
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
!! end
!! test
1. Nested mixed wikitext and html list
!! wikitext
*hi
*
ho
*hi
**ho
!! html/php
hi
ho
hi
ho
!! html/parsoid
hi
ho
hi
ho
!! end
!! test
2. Nested mixed wikitext and html list (incompatible)
!! wikitext
;hi
:{{1x|
ho
}}
!! html/php
hi
ho
!! html/parsoid
hi
ho
!! end
!! test
Nested lists 1
!! wikitext
*foo
**bar
!! html
foo
bar
!! end
!! test
Nested lists 2
!! wikitext
**foo
*bar
!! html
foo
bar
!! end
!! test
Nested lists 3 (first element empty)
!! wikitext
*
**bar
!! html
bar
!! end
!! test
Nested lists 4 (first element empty)
!! wikitext
**
*bar
!! html
bar
!! end
!! test
Nested lists 5 (both elements empty)
!! wikitext
**
*
!! html
!! end
!! test
Nested lists 6 (both elements empty)
!! wikitext
*
**
!! html
!! end
!! test
Nested lists 7 (skip initial nesting levels)
!! wikitext
***foo
!! html
foo
!! end
!! test
Nested lists 8 (multiple nesting transitions)
!! wikitext
*foo
***bar
**baz
*boo
!! html
foo
bar
baz
boo
!! end
# XXX this test should be moved to citeParserTests, since it depends
# on the Cite extension, which is "built in" to Parsoid.
!! test
Nested lists 9 (extension interaction)
!! wikitext
*
!! html/php+tidy-DISABLED
!! html/parsoid
!! end
!! test
1. Lists with start-of-line-transparent tokens before bullets: Comments
!! wikitext
*foo
*bar
*baz
!! html
foo
bar
baz
!! html/parsoid
foo
bar
baz
!! end
!! test
Nested lists 10 (list and span siblings: wt2wt regression)
!! wikitext
*a x
**b y
!! html/parsoid
a x
b y
!! end
# Parsoid handles this case differently from the legacy parser, as a side
# effect of handling SOL state in the tokenizer.
!! test
2. Lists with start-of-line-transparent tokens before bullets: Template close
!! wikitext
*foo {{1x|bar
}}*baz
!! html/php+tidy
foo bar
baz
!! html/parsoid
foo bar
baz
!! end
!! test
List items are not parsed correctly following a
block (T2785)
!! wikitext
*
foo
*
bar
*zar
!! html/php
foo
bar
zar
!! html/parsoid
foo
bar
zar
!! end
# FIXME: Might benefit from a html/parsoid since this has a template
!! test
List items from template
!! wikitext
{{inner list}}
*item 2
*item 0
{{inner list}}
*item 2
*item 0
*notSOL{{inner list}}
*item 2
!! html
item 1
item 2
item 0
item 1
item 2
item 0
notSOL
item 1
item 2
!! end
!! test
List interrupted by empty line or heading
!! wikitext
*foo
**bar
==A heading==
*Another list item
!! html
!!end
!! test
Multiple list tags generated by templates
!! wikitext
{{1x|
}}a
{{1x|
}}b
{{1x|
}}c
!! html+untidy
a
b
c
!! html+tidy
a
b
c
!! html/parsoid
a
b
c
!! end
!! test
Multiple newlines in between HTML list items don't induce paragraph wrapping
!! wikitext
hi
ho
hi
ho
123
!! html/php+tidy
hi
ho
hi
ho
123
!! end
!!test
Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
!! wikitext
*a
*b
*c
*d
!! html
a
b
c
d
!!end
!!test
Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
!! wikitext
*a
*b
*c
*d
!! html
a
b
c
d
!!end
# FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
# That pass could possibly be removed.
!!test
Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
!!options
parsoid=wt2html,wt2wt
!! wikitext
*foo
*
li-hack
*{{1x|
templated li-hack}}
*
unsupported li-hack with preceding comments
not a li-hack
!! html+tidy
foo
li-hack
templated li-hack
unsupported li-hack with preceding comments
not a li-hack
!! html/parsoid
foo
li-hack
templated li-hack
unsupported li-hack with preceding comments
not a li-hack
!! end
!! test
Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
!! wikitext
#foo
##bar
*foo
**bar
:foo
::bar
!! html/php+tidy
foo
bar
foo
bar
foo
bar
!! html/parsoid
foo
bar
foo
bar
foo
bar
!! end
!! test
Parsoid: Test of whitespace serialization with Templated bullets
!! options
parsoid=wt2html
!! wikitext
* {{bullet}}
!! html/parsoid
Bar
!! end
# ------------------------------------------------------------------------
# The next set of tests are about Parsoid's ability to handle badly nested
# tags (parse, minimize scope of fixup, and roundtrip back)
# ------------------------------------------------------------------------
# Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
# Parsoid's list handling is more aware of block structure.
!! test
Unbalanced closing block tags break a list
!! wikitext
*a
*b
!! html+tidy
a
b
!! html/parsoid
a
b
!! end
!! test
Unbalanced closing non-block tags don't break a list
!! options
parsoid=wt2html,html2html
!! wikitext
*a
*b
!! html/php+tidy
a
b
!! html/parsoid
a
b
!! end
# Parsoid does some post-dom-building cleanup
# which is why its output differs from Remex.
!! test
Unclosed formatting tags that straddle lists are closed and reopened
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
# a
#b
!! html/php+tidy
a
b
!! html/parsoid
a
b
!! end
# Output is ugly because of all the misnested tag fixups.
!! test
1. List embedded in a formatting tag
!! wikitext
*foo
!! html/php+tidy
foo
!! html/parsoid
foo
!! end
# Output is ugly because of all the misnested tag fixups.
!! test
2. List embedded in a formatting tag in a misnested way
!! wikitext
*a
*b
!! html/php+tidy
a
b
!! html/parsoid
a
b
!! end
# Output is ugly because of all the misnested tag fixups.
!! test
3. List embedded in a formatting tag in a misnested way
!! wikitext
** 123
!! html/php+tidy
123
!! html/parsoid
123
!! 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: {{CURRENTDAY}}
!! wikitext
{{CURRENTDAY}}
!! html
1
!! end
!! test
Magic Word: {{CURRENTDAY2}}
!! wikitext
{{CURRENTDAY2}}
!! html
01
!! end
!! test
Magic Word: {{CURRENTDAYNAME}}
!! wikitext
{{CURRENTDAYNAME}}
!! html
Thursday
!! end
!! test
Magic Word: {{CURRENTDOW}}
!! wikitext
{{CURRENTDOW}}
!! html
4
!! end
!! test
Magic Word: {{CURRENTMONTH}}
!! wikitext
{{CURRENTMONTH}}
!! html
01
!! end
!! test
Magic Word: {{CURRENTMONTH1}}
!! wikitext
{{CURRENTMONTH1}}
!! html
1
!! end
!! test
Magic Word: {{CURRENTMONTHABBREV}}
!! wikitext
{{CURRENTMONTHABBREV}}
!! html
Jan
!! end
!! test
Magic Word: {{CURRENTMONTHNAME}}
!! wikitext
{{CURRENTMONTHNAME}}
!! html
January
!! end
!! test
Magic Word: {{CURRENTMONTHNAMEGEN}}
!! wikitext
{{CURRENTMONTHNAMEGEN}}
!! html
January
!! end
!! test
Magic Word: {{CURRENTTIME}}
!! wikitext
{{CURRENTTIME}}
!! html
00:02
!! end
!! test
Magic Word: {{CURRENTHOUR}}
!! wikitext
{{CURRENTHOUR}}
!! html
00
!! end
!! test
Magic Word: {{CURRENTWEEK}} (T6594)
!! wikitext
{{CURRENTWEEK}}
!! html
1
!! end
!! test
Magic Word: {{CURRENTYEAR}}
!! wikitext
{{CURRENTYEAR}}
!! html
1970
!! end
!! test
Magic Word: {{CURRENTTIMESTAMP}}
!! wikitext
{{CURRENTTIMESTAMP}}
!! html
19700101000203
!! end
!! test
Magic Words LOCAL (UTC)
!! wikitext
*{{LOCALMONTH}}
*{{LOCALMONTH1}}
*{{LOCALMONTHNAME}}
*{{LOCALMONTHNAMEGEN}}
*{{LOCALMONTHABBREV}}
*{{LOCALDAY}}
*{{LOCALDAY2}}
*{{LOCALDAYNAME}}
*{{LOCALYEAR}}
*{{LOCALTIME}}
*{{LOCALHOUR}}
*{{LOCALWEEK}}
*{{LOCALDOW}}
*{{LOCALTIMESTAMP}}
!! html
!! end
!! test
Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
!! options
parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
!! wikitext
{{PAGELANGUAGE}}
!! html/*
en
!! end
!! test
Case-sensitive magic words, when cased differently, should just be template transclusions
!! wikitext
{{CurrentMonth}}
{{currentday}}
{{cURreNTweEK}}
{{currentHour}}
!! html
!! end
!! test
Case-insensitive magic words should still work with weird casing.
!! wikitext
{{sErVeRNaMe}}
{{LCFirst:AOEU}}
{{ucFIRST:aoeu}}
{{SERver}}
!! html
!! end
# From plwiki:PLOS_ONE
!! test
Parsoid: Page property magic word with magic word contents
!! options
showtitle
!! config
wgAllowDisplayTitle=true
wgRestrictDisplayTitle=false
!! wikitext
{{DISPLAYTITLE:''{{PAGENAME}}''}}
!! html/php+tidy
Parser test
!! html/parsoid
!! end
# NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
# But, this is a limitation of our representation and is documented in
# TemplateHandler.js in processSpecialMagicWord
!! test
Parsoid: Template-generated DISPLAYTITLE
!! wikitext
{{{{1x|DISPLAYTITLE}}:Foo}}
!! options
showtitle
!! config
wgAllowDisplayTitle=true
wgRestrictDisplayTitle=false
!! html/php
Foo
!! html/parsoid
!! end
!! test
Namespace 1 {{ns:1}}
!! wikitext
{{ns:1}}
!! html
Talk
!! end
!! test
Namespace 1 {{ns:01}}
!! wikitext
{{ns:01}}
!! html
Talk
!! end
!! test
Namespace 0 {{ns:0}} (T6783)
!! wikitext
{{ns:0}}
!! html
!! end
!! test
Namespace 0 {{ns:00}} (T6783)
!! wikitext
{{ns:00}}
!! html
!! end
!! test
Namespace -1 {{ns:-1}}
!! wikitext
{{ns:-1}}
!! html
Special
!! end
!! test
Namespace User {{ns:User}}
!! wikitext
{{ns:User}}
!! html
User
!! end
!! test
Namespace User talk {{ns:User_talk}}
!! wikitext
{{ns:User_talk}}
!! html
User talk
!! end
!! test
Namespace User talk {{ns:uSeR tAlK}}
!! wikitext
{{ns:uSeR tAlK}}
!! html
User talk
!! end
!! test
Namespace File {{ns:File}}
!! wikitext
{{ns:File}}
!! html
File
!! end
!! test
Namespace File {{ns:Image}}
!! wikitext
{{ns:Image}}
!! html
File
!! end
!! test
Namespace (lang=de) Benutzer {{ns:User}}
!! options
language=de
!! wikitext
{{ns:User}}
!! html
Benutzer
!! end
!! test
Namespace (lang=de) Benutzer Diskussion {{ns:3}}
!! options
language=de
!! wikitext
{{ns:3}}
!! html
Benutzer Diskussion
!! end
!! test
Urlencode
!! wikitext
{{urlencode:hi world?!}}
{{urlencode:hi world?!|WIKI}}
{{urlencode:hi world?!|PATH}}
{{urlencode:hi world?!|QUERY}}
!! html/php
!! end
!! test
Magic Word: prioritize type info over data-parsoid
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
__FORCETOC__
!! end
!! test
Magic Word: serialize on separate line (parsoid)
!! options
parsoid=wt2wt,html2wt
!! wikitext
foo
__NOTOC__
bar
!! html/parsoid
foobar
!! end
!! test
Magic Word: case-insensitive (all-lowercase)
!! wikitext
foo
__notoc__
bar
!! html/php+tidy
foo
bar
!! html/parsoid
foo
bar
!! end
# wt2wt,html2wt disabled because we always (unless selser) serialize
# in a uniform case (all upper or all lower)
!! test
Magic Word: case-insensitive (mixed case)
!! options
parsoid=wt2html,html2html
!! wikitext
foo
__NOtOC__
bar
!! html/php+tidy
foo
bar
!! html/parsoid
foo
bar
!! end
!! test
Magic Word: rt non-english wikis
!! options
parsoid=wt2wt
language=de
!! wikitext
__NOEDITSECTION__
!! html/parsoid
!! end
!!test
__proto__ is treated as normal wikitext (T105997)
!!wikitext
__proto__
!!html
__proto__
!!end
###
### Magic links
###
!! test
Magic links: internal link to RFC (T2479)
!! wikitext
[[RFC 123]]
!! html/php
!! end
!! test
Magic links: ISBN (T67278)
!! wikitext
This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
!! html/php
This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
!! html/parsoid
This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
!! end
!! test
Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
!! wikitext
ISBN 978 0 316 09811 3
ISBN
9780316098113
ISBN 978
0316098113
!! html/php
!! end
# nodes shouldn't be inserted during html2wt by Parsoid,
# since these are ExtLinkText, not MagicLinkText
!! test
Magic links: use appropriate serialization for "almost" magic links.
!! wikitext
X[[Special:BookSources/0978739256|foo]]
X[https://tools.ietf.org/html/rfc1234 foo]
!! html/php
!! end
# The html2html output of this test is currently failing
# because the html2wt output is broken; see
# https://phabricator.wikimedia.org/T220018#5123777 for a discussion.
# Not (yet) including html2wt as a test mode because there are
# a couple of different correct ways this could be 'ed.
!! test
Template with just whitespace in it, T70421
!! wikitext
{{1x|{{ }}}}
!! options
parsoid=wt2html,html2html
!! html/php+tidy
{{ }}
!! html/parsoid
{{ }}
!! end
# This is currently the wikitext output of html2wt on the above test
# case; note that it is broken! Adding a around the closing
# brace changes how the open braces associate, breaking the outer
# {{1x}} template invocation. *However* this "broken" wikitext
# exposed a useful tokenizer bug (T221384) in how the broken_template
# rule was being backtracked into, so it's a useful test case even
# if/when the above test case gets its html2wt output fixed.
!! test
Template with just whitespace (bad template brace matching)
!! options
parsoid=wt2html
!! wikitext
{{1x|{{ }}}}
!! html/php+tidy
{{1x|{{ }}}}
!! html/parsoid
{{1x|{{ }}}}
!! end
!! article
Template:test
!! text
This is a test template
!! endarticle
!! test
Simple template
!! wikitext
{{test}}
!! html
This is a test template
!! end
!! test
Template with explicit namespace
!! wikitext
{{Template:test}}
!! html
This is a test template
!! end
!! article
Template:paramtest
!! text
This is a test template with parameter {{{param}}}
!! endarticle
!! test
Template parameter
!! wikitext
{{paramtest|param=foo}}
!! html
This is a test template with parameter foo
!! end
!! article
Template:paramtestnum
!! text
[[{{{1}}}|{{{2}}}]]
!! endarticle
!! test
Template unnamed parameter
!! wikitext
{{paramtestnum|Main Page|the main page}}
!! html
!! 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
!! wikitext
{{templateasargtestnum|templatesimple}}
!! html
(test)
!! end
!! test
Template with template name as argument
!! wikitext
{{templateasargtest|templ=simple}}
!! html
(test)
!! end
!! test
Template with template name as argument (2)
!! wikitext
{{templateasargtest2|templ=templatesimple}}
!! html
(test)
!! end
!! article
Template:templateasargtestdefault
!! text
{{{{{templ|templatesimple}}}}}
!! endarticle
!! article
Template:templa
!! text
'''templ'''
!! endarticle
!! test
Template with default value
!! wikitext
{{templateasargtestdefault}}
!! html
(test)
!! end
!! test
Template with default value (value set)
!! wikitext
{{templateasargtestdefault|templ=templa}}
!! html
templ
!! end
!! test
Template redirect
!! wikitext
{{templateredirect}}
!! html/php
(test)
!! html/parsoid
!! end
!! test
Template with argument in separate line
!! wikitext
{{ templateasargtest |
templ = simple }}
!! html
(test)
!! end
!! test
Template with complex template as argument
!! wikitext
{{paramtest|
param ={{ templateasargtest |
templ = simple }}}}
!! html
This is a test template with parameter (test)
!! end
!! test
Templates with templated name
!! wikitext
{{{{1x|1x}}|foo}}
{{{{1x|inner list}} }}
!! html
foo
item 1
!! html/parsoid
foo
item 1
!! end
## Regression test; the output here isn't really that interesting.
!! test
Templates with templated name and top level template args
!! wikitext
{{1{{2{{{3}}}|4=5}}}}
!! html/parsoid
{{1{{2{{{3}}}|4=5}}}}
!! end
# Parsoid markup is deliberate "broken". This is an edge case.
# See long comment in TemplateHandler.js:convertAttribsToString.
!! test
Templates with invalid templated targets
!! wikitext
{{1x
{{1x|foo}}
}}
!! html/php
{{1x
foo
}}
!! html/parsoid
{{1x
foo }}
!! end
!! test
Template with thumb image (with link in description)
!! wikitext
{{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
!! html/php+untidy
This is a test template with parameter
!! end
!! test
Don't abort table cell attribute parsing if wikilink is found in template arg
!! wikitext
{|
|Test {{#tag:ref|One two "[[three]]" four}}
|}
!! html/parsoid
!! end
!! test
Magic variable as template parameter
!! wikitext
{{paramtest|param={{SITENAME}}}}
!! html
This is a test template with parameter MediaWiki
!! end
!! article
Template:linktest
!! text
[[{{{param}}}|link]]
!! endarticle
!! test
Template parameter as link source
!! wikitext
{{linktest|param=Main Page}}
!! html
!! end
!!article
Template:paramtest2
!! text
including another template, {{paramtest|param={{{arg}}}}}
!! endarticle
!! test
Template passing argument to another template
!! wikitext
{{paramtest2|arg='hmm'}}
!! html
including another template, This is a test template with parameter 'hmm'
!! end
!! article
Template:Linktest2
!! text
Main Page
!! endarticle
!! test
Template as link source
!! wikitext
[[{{linktest2}}]]
[[{{linktest2}}|Main Page]]
[[{{linktest2}}]]Page
!! html
!! end
!! article
Template:table
!! text
{|
| 1 || 2
|-
| 3 || 4
|}
!! endarticle
!! test
T2529: Template with table, not included at beginning of line
!! wikitext
foo {{table}}
!! html
foo
1
2
3
4
!! end
!! test
T2523: Template shouldn't eat newline (or add an extra one before table)
!! wikitext
foo
{{table}}
!! html
foo
1
2
3
4
!! end
!! test
T2041: Template parameters shown as broken links
!! wikitext
{{{parameter}}}
!! html
{{{parameter}}}
!! end
!! test
Template with targets containing wikilinks
!! options
parsoid=wt2html
!! wikitext
{{[[foo]]}}
{{[[{{1x|foo}}]]}}
{{{{1x|[[foo}}]]}}
!! html/php
!! end
!! article
Template:''
!! text
bar
!! endarticle
!! test
Templates: Double quotes as template target
!! wikitext
foo {{''}} baz
!! html/php
foo bar baz
!! html/parsoid
foo bar baz
!! end
## This test is about making sure Parsoid's data-mw is well formed in the
## face of multiple templates with intersecting and overlapping ranges. The
## wikitext itself is wretched.
!! test
Templates with intersecting and overlapping ranges
!! wikitext
{|{{1x|
ha
}}
{|{{1x|
ho
}}
{{1x|{{!}}hi}}
|}
!! html/php+tidy
ha
ho
hi
!! html/parsoid
ha
ho
hi
!! end
!! article
Template:MSGNW test
!! text
''None'' of '''this''' should be
* interpreted
but rather passed unmodified
{{test}}
File:Foobar.jpg
!! endarticle
# hmm, fix this or just deprecate msgnw and document its behavior?
!! test
msgnw keyword
!! wikitext
{{msgnw:MSGNW test}}
!! html/php
''None'' of '''this''' should be
* interpreted
but rather passed unmodified
{{test}}
<gallery>
File:Foobar.jpg
</gallery>
<!-- comment -->
!! end
!! test
int keyword
!! wikitext
{{int:youhavenewmessages|lots of money|not!}}
!! html
You have lots of money (not!).
!! end
!! test
int keyword - non-existing message
!! wikitext
{{int:var}}
!! html
⧼var⧽
!! end
!! article
Template:Includes
!! text
Foozarbar
!! endarticle
!! test
and being included
!! wikitext
{{Includes}}
!! html
Foobar
!! end
!! article
Template:Includes2
!! text
Foobar
!! endarticle
!! test
being included
!! wikitext
{{Includes2}}
!! html/php+tidy
Foo
!! html/parsoid
Foo
!! end
!! article
Template:Includes3
!! text
Foobarzar
!! endarticle
!! test
and being included
!! wikitext
{{Includes3}}
!! html/php+tidy
Foo
!! html/parsoid
Foo
!! end
# FIXME: Parsoid's markup for this is quite ugly.
!! test
and on a page
!! wikitext
Foozarbar
!! html/php+tidy
Foozar
!! html/parsoid
Foozar
!! end
!! test
Un-closed
!! wikitext
!! html/php+tidy
!! html/parsoid
!! end
!! test
Empty
!! wikitext
Hello!
!! html/php+tidy
Hello!
!! html/parsoid
Hello!
!! end
!! test
on a page
!! wikitext
Foobar
!! html
Foobar
!! end
!! test
Un-closed
!! wikitext
!! html
!! end
!! test
T236868: Un-closed caused bad SourceRange length
!! wikitext
{|
|-
| A
|-
|}
!! html/parsoid
!! end
!!test
Self-closed noinclude, includeonly, onlyinclude tags
!! wikitext
!! html
!!end
!!test
Unbalanced includeonly and noinclude tags
!! wikitext
{|
|a
|b
|c
|d
|}
!! html
a
b
c</includeonly>
d</includeonly></includeonly>
!!end
!! article
Template:Includeonly section
!! text
==Includeonly section==
==Section T-1==
!!endarticle
!! test
T8563: Edit link generation for section shown by
!! wikitext
{{includeonly section}}
!! html+untidy
!! end
# Uses same input as the contents of [[Template:Includeonly section]]
!! test
T8563: Section extraction for section shown by
!! options
section=T-2
!! wikitext
==Includeonly section==
==Section T-2==
!! html
==Section T-2==
!! end
!! test
T8563: Edit link generation for section suppressed by
!! wikitext
==Includeonly section==
==Section 1==
!! html
!! end
!! test
T8563: Section extraction for section suppressed by
!! options
section=1
!! wikitext
==Includeonly section==
==Section 1==
!! html
==Section 1==
!! end
!! test
Un-closed
!! wikitext
!! html/php
!! html/parsoid
!! end
## We used to, but no longer wt2wt this test since the default serializer
## will normalize the include directives to serialize on their own line.
## Selser will take care of preserving formatting in scenarios where they
## intermingled with other wikitext.
## This test also triggered T223411 during Parsoid-PHP porting.
!! test
Includes and comments at SOL
!! options
parsoid=wt2html,html2html
!! wikitext
==hu==
some
*stuff
*here
some* stuff
* here
can have stuff===here===
!! html/php
hu
some
stuff
here
some* stuff
here
here
!! html/parsoid
hu
some
stuff
here
some* stuff
here
here
!! end
# TODO: test with DOM fragment reuse!
!! test
Parsoid: DOM fragment reuse
!! options
parsoid=wt2wt,wt2html
!! wikitext
a{{1x|b
c}}d
a{{1x|b
c}}d
{{1x|a
b}}
!! html/php+tidy
ab
cd
ab
cd
a
b
!! html/parsoid
ab
cd
ab
cd
a
b
!! end
!! test
Parsoid: Merge double tds (T52603)
!! wikitext
{|
|{{1x|{{!}} foo}}
|}
!! html/php+tidy
foo
!! html/parsoid
foo
!! end
!! test
Parsoid: Merge double tds in nested transclusion content (T52603)
!! wikitext
{{1x|
}}
{|
|{{1x|{{!}} foo}}
|}
{{1x|
}}
!! html/php+tidy
foo
!! html/parsoid
foo
!! end
###
### and in attributes
###
!!test
0. includeonly around the entire attribute
!! wikitext
id="v1"id="v2">bar
!! html
bar
!!end
!!test
1. includeonly in html attr key
!! wikitext
idabout="foo">bar
!! html
bar
!!end
!!test
2. includeonly in html attr value
!! wikitext
bar"v1""v2">bar
!! html
barbar
!!end
!!test
3. includeonly in part of an attr value
!! wikitext
bar
!! html
bar
!!end
!!test
4. includeonly in table attributes
!! wikitext
{|
|-
|-
|a
|-
|-
|b
|}
!! html
a
!!end
###
### Preprocessor precedence tests
### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
###
##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
!! test
Preprocessor precedence 1: link is rightmost opening
!! options
parsoid=wt2html
!! wikitext
{{[[Foo|bar}}]]
But close-brace is not a valid character in a link title:
{{[[Foo}}|bar]]
However, we can still tell this was handled as a link in the preprocessor:
{{1x|[[Foo}}|bar]]|bat}}
!! html/php
But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]
However, we can still tell this was handled as a link in the preprocessor: [[Foo}}|bar]]
!! end
!! test
Preprocessor precedence 2: template is rightmost opening
!! options
language=zh
!! wikitext
-{{1x|foo}-}}-
!! html/php
-foo}--
!! html/parsoid
-foo}--
!! end
!! test
Preprocessor precedence 3: language converter is rightmost opening
!! options
language=zh
parsoid=wt2html
!! wikitext
{{1x|hi}}
{{-{R|1x|hi}}}-
[[-{R|raw]]}-
!! html/php
hi
{{1x|hi}}
[[raw]]
!! html/parsoid
hi
{{
[[
!! end
!! test
Preprocessor precedence 4: left-most angle bracket
!! options
language=zh
!! wikitext
!! html/php
!! html/parsoid
!! end
!! article
Template:Precedence5
!! text
{{{{{1}}}}}
!! endarticle
!! test
Preprocessor precedence 5: tplarg takes precedence over template
!! wikitext
{{Precedence5|Bullet}}
!! html/php
Bar
!! html/parsoid
Bar
!! end
!! test
Preprocessor precedence 6: broken link is rightmost opening
!! options
parsoid=wt2html
!! wikitext
{{1x|[[Foo}}
{{1x|[[Foo|bar|bat=baz}}
!! html/php
{{1x|[[Foo}}
{{1x|[[Foo|bar|bat=baz}}
!! html/parsoid
{{1x|[[Foo}}
{{1x|[[Foo|bar|bat=baz}}
!! end
# This next test exposes a difference between PHP and Parsoid:
# Given [[Foo|{{1x|Bar]]x}}y]]z:
# 1) Both PHP and Parsoid ignore the `]]` inside the `1x` in the
# "preprocessor" stage. The `{{1x` extends until the `x}}`, and the
# outer `[[Foo` extends until the `y]]`
# 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
# intermediate result (after template expansion), and link processing
# happens on this intermediate result, which moves the wikilink
# boundary leftward to `[[Foo|Bar]]`
# 2b) Parsoid works in a single step, so it's going to keep the
# wikilink as extending to the `y]]`
# 3a) Then PHP does linktrail processing which slurps up the trailing
# `xy` inside the link.
# 3b) Parsoid will do linktrail processing to slurp up the trailing
# `z` inside the link.
# This is "correct" behavior. Parsoid's basic worldview is that the
# `]]` inside the template shouldn't be allowed to leak out to affect
# the surrounding wikilink. PHP may match Parsoid (in the future)
# if you use {{#balance}} (T114445).
!! test
Preprocessor precedence 7: broken template is rightmost opening
!! options
parsoid=wt2html
!! wikitext
[[Foo|{{1x|Bar]]
[[Foo|{{1x|Bar]]-x}}-y]]-z
Careful: linktrails can move the end of the wikilink:
[[Foo|{{1x|y']]a}}l]]l
!! html/php
Careful: linktrails can move the end of the wikilink:
y']]all
!! end
!! test
Preprocessor precedence 8: broken language converter is rightmost opening
!! options
language=zh
!! wikitext
[[Foo-{R|raw]]
!! html
[[Foo-{R|raw]]
!! end
!! article
Template:Preprocessor_precedence_9
!! text
;4: {{{{1}}}}
;5: {{{{{2}}}}}
;6: {{{{{{3}}}}}}
;7: {{{{{{{4}}}}}}}
!! endarticle
!! test
Preprocessor precedence 9: groups of braces
!! wikitext
{{Preprocessor precedence 9|Four|Bullet|1|2}}
!! html/php
4
{Four}
5
Bar
6
Four
7
{Bullet}
!! html/parsoid
4
{Four}
5
Bar
6
Four
7
{Bullet}
!! end
!! article
Template:Preprocessor_precedence_10
!! text
;1: -{R|raw}-
;2: -{{Bullet}}-
;3: -{{{1}}}-
;4: -{{{{2}}}}-
;5: -{{{{{3}}}}}-
;6: -{{{{{{4}}}}}}-
;7: -{{{{{{{5}}}}}}}-
!! endarticle
!! test
Preprocessor precedence 10: groups of braces with leading dash
!! options
language=zh
!! wikitext
{{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
!! html/php
1
raw
2
-
Bar-
3
-Three-
4
raw2
5
-
Bar-
6
-Three-
7
raw2
!! html/parsoid
1
2
-
Bar-
3
-Three-
4
5
-
Bar-
6
-Three-
7
!! end
!! test
Preprocessor precedence 11: found during visual diff testing
!! wikitext
{{#tag:span|-{{#tag:span|-{{1x|x}}}}}}
{{1x|-{{1x|-{{1x|x}}}}}}
{{1x|-{{1x|x}}}}
!! html/php
--x
--x
-x
!! html/parsoid
--x
--x
-x
!! end
!! test
Preprocessor precedence 12: broken language converter closed by brace.
!! options
parsoid=wt2html
!! wikitext
This form breaks the template, which is unfortunate:
*{{1x|foo-{bar}bat}}
But if the broken language converter markup is inside an extension
tag, nothing bad happens:
*foo-{bar}bat
*{{1x|foo-{bar}bat}}
*
This form breaks the template, which is unfortunate:
{{1x|foo-{bar}bat}}
But if the broken language converter markup is inside an extension
tag, nothing bad happens:
foo-{bar}bat
foo-{bar}bat
foo-{bar}bat
foo-{bar}bat
'foo-{bar}bat'
array (
)
'foo-{bar}bat'
array (
)
!! html/parsoid
This form breaks the template, which is unfortunate:
{{1x|foo-{bar}bat}}
But if the broken language converter markup is inside an extension tag, nothing bad happens:
foo-{bar}bat
foo-{bar}bat
foo-{bar}bat
foo-{bar}bat
!! end
!! test
Preprocessor precedence 13: broken language converter in external link
!! options
parsoid=wt2html
!! wikitext
*[http://example.com/-{foo Example in URL]
*[http://example.com Example in -{link} description]
*{{1x|[http://example.com/-{foo Breaks template, however]}}
!! html/php+tidy
!! end
!! test
Preprocessor precedence 14: broken language converter in comment
!! wikitext
*...should be ok
*...extra dashes
*{{1x|foobat}}...should be ok
!! html/php+tidy
!! end
# Ensure we're using a language without variants for this test; even
# if $wgUsePigLatinVariant is true. We've picked `de` arbitrarily.
!! test
Preprocessor precedence 18: another rightmost wins scenario
!! options
parsoid=wt2html
language=de
!! wikitext
{{ -{{{{1|tplarg}}} }} }-
!! html/php
{{ -{tplarg }} }-
!! html/parsoid
{{ -{tplarg }} }-
!! end
!! test
Preprocessor precedence 19: break syntax
!! options
parsoid=wt2html
!! wikitext
-{{
!! html/php
-{{
!! html/parsoid
-{{
!! end
###
### Token Stream Patcher tests
###
### These tests won't always pass wt2wt and other modes because
### on serialization, the table will be output on a new line.
### For now, we are blacklisting them, and using this to test selser.
###
!!test
1. Table tag in SOL posn. should get reparsed correctly with valid TSR
!!options
parsoid=wt2html,wt2wt
!!wikitext
{{1x|}}{| width = '100%'
|foo
|}
!!html/parsoid
foo
!!end
## We used to, but no longer wt2wt this test since the default serializer
## will normalize the include directives to serialize on their own line.
## Selser will take care of preserving formatting in scenarios where they
## intermingled with other wikitext.
!!test
2. Table tag in SOL posn. should get reparsed correctly with valid TSR
!!options
parsoid=wt2html
!!wikitext
a{| {{{b}}}
|c
|}
!!html/parsoid
c
!!end
!! test
Table wikitext syntax outside wiki-tables
!! wikitext
a
|+ not a caption
! not a table heading
|- not a table row
| not a table cell
| class="foo bar" | baz
b
|}
|-
c
!! html
a
|+ not a caption
! not a table heading
|- not a table row
| not a table cell
| class="foo bar" | baz
b
|}
|-
c
!! 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: Template Name/Arg clash: 1. Use of positional param
!! wikitext
{{quote|foo}}
!! html
foo
!!end
!!test
Templates: Template Name/Arg clash: 2. Use of named param
!! wikitext
{{quote|quote=foo}}
!! html
foo
!!end
!!test
Templates: Template Name/Arg clash: 3. Use of named param with empty input
!! wikitext
{{quote|quote}}
!! html
quote
!!end
###
### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
###
!!test
Templates: 1. Simple use
!! wikitext
{{1x|Foo}}
!! html
Foo
!!end
!!test
Templates: 2. Inside a block tag
!! wikitext
{{1x|Foo}}
{{1x|Foo}}
!! html+untidy
Foo
Foo
!! html+tidy
Foo
Foo
!!end
!!test
Templates: P-wrapping: 1a. Templates on consecutive lines
!! wikitext
{{1x|Foo}}
{{1x|bar}}
!! html
Foo
bar
!!end
!!test
Templates: P-wrapping: 1b. Templates on consecutive lines
!! wikitext
Foo
{{1x|bar}}
{{1x|baz}}
!! html
!!end
!!test
Templates: Links: 3. Generation of part of a link href
!! wikitext
[[Fo{{1x|o}}|bar]]
[[Foo{{1x|bar}}]]
[[Foo{{1x|bar}}baz]]
[[Foo{{1x|bar}}|bar]]
[[:Foo{{1x|bar}}]]
[[:Foo{{1x|bar}}|bar]]
!! html
!!end
!! test
File with template filename
!! wikitext
[[File:{{1x|Foobar.jpg}}]]
!! html/parsoid
!! end
!!test
Templates: HTML Tag: 1. Generation of HTML attr. key
!! wikitext
foo
!! html
foo
!!end
!!test
Templates: HTML Tag: 2. Generation of HTML attr. value
!! wikitext
foo
!! html
foo
!!end
!!test
Templates: HTML Tag: 3. Generation of HTML attr key and value
!! wikitext
foo
!! html
foo
!!end
!!test
Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
!! wikitext
foo
!! html
foo
!!end
!!test
Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
!! wikitext
foo
!! html
foo
!!end
!!test
Templates: HTML Tag: 6. Generation of end piece of HTML attr value
!! wikitext
foo
!! html
foo
!!end
# SSS FIXME: While it is great we added support for all this,
# do we want to make this part of the spec? Maybe we want to
# deprecate this kind of usage in the future?
!!test
Templates: HTML Tag: 7. Generation of partial attribute key string
!! wikitext
foo
!! html
foo
!!end
!! test
Templates: HTML Tag: 8. Template-generated attribute (k=v)
!! wikitext
bar
!! html
bar
!!end
!! test
Templates: HTML Tag: 9. Multiple template-generated attributes
!! wikitext
bar
!! html
bar
!!end
!! test
Templates: Support for templates generating attributes and content
!! wikitext
{| {{mixed_attr_content_template}}
|-
|bar
|}
!! html/php
foo
bar
!! html/parsoid
foo
bar
!!end
!! test
Templates: Support for templates generating table attributes and content (with fostered categories)
!! wikitext
{| {{mixed_attr_content_template_2}}
|-
|bar
|}
!! html/php
foo
bar
!! html/parsoid
foo
bar
!!end
!! article
Template:attribute_from_template
!! text
class="123"
!! endarticle
!! test
Table cell with attribute before expanded attribute
!! wikitext
{|
| align="center" {{attribute_from_template}} |456
|}
!! html/parsoid
456
!! end
!! test
1. Entities and nowikis inside templated attributes should be handled correctly
!! wikitext
foo
!! html/php
foo
!! html/parsoid
foo
!! end
!! test
2. Entities and nowikis inside templated attributes should be handled correctly
!! wikitext
{|
|{{table_attribs_3}}
|}
!! html/php
Foo
!! html/parsoid
Foo
!! end
!! test
3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
!! wikitext
{{tbl-start}}
|{{table_attribs_3}}
{{tbl-end}}
!! html/php
Foo
!! html/parsoid
Foo
!! end
# T107622
!! test
4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
!! wikitext
{|
|{{table_attribs_6}} hi
|}
!! html/php
hi
!! html/parsoid
hi
!! end
!!test
Templates: HTML Tables: 1. Generating start of a HTML table
!! wikitext
{{1x|
foo
}}
!! html
foo
!!end
!!test
Templates: HTML Tables: 2a. Generating middle of a HTML table
!! wikitext
{{1x|
foo
}}
!! html
foo
!!end
!!test
Templates: HTML Tables: 2b. Generating middle of a HTML table
!! wikitext
{{1x|
foo
}}
!! html
foo
!!end
!!test
Templates: HTML Tables: 3. Generating end of a HTML table
!! wikitext
{{1x|
foo
}}
!! html
foo
!! end
!!test
Templates: HTML Tables: 4a. Generating a single tag of a HTML table
!! wikitext
{{1x|
}}
foo
!! html
foo
!! end
!!test
Templates: HTML Tables: 4b. Generating a single tag of a HTML table
!! wikitext
{{1x|
}}
foo
!! html
foo
!! end
!!test
Templates: HTML Tables: 4c. Generating a single tag of a HTML table
!! wikitext
{{1x|
}}foo
!! html
foo
!! end
!!test
Templates: HTML Tables: 4d. Generating a single tag of a HTML table
!! wikitext
foo{{1x|
}}
!! html
foo
!! end
!!test
Templates: HTML Tables: 4e. Generating a single tag of a HTML table
!! wikitext
foo
{{1x|
}}
!! html
foo
!! end
!!test
Templates: HTML Tables: 4f. Generating a single tag of a HTML table
!! wikitext
foo
{{1x|
}}
!! html
foo
!! end
!!test
Templates: HTML Tables: 5. Proper fostering of categories from inside
!!options
parsoid=wt2html,wt2wt
!! wikitext
[[Category:foo1]]
foo
[[Category:bar1]][[Category:bar2]]
foo
!! html/php+tidy
foo
foo
!! html/parsoid
foo
foo
!!end
## Remex doesn't account for fostered content.
!! test
Templates: Wiki Tables: 1a. Fostering of entire template content
!! wikitext
{|
{{1x|a}}
|}
!! html/php+untidy
a
!! html/php+tidy
a
!! html/parsoid
a
!! end
!!test
Templates: Wiki Tables: 1b. Fostering of entire template content
!! wikitext
{|
{{1x|
}}
foo
{{1x|
}}
|}
!! html+untidy
foo
!! html/php+tidy
foo
!! html/parsoid
foo
!! end
## Remex doesn't account for fostered content.
!! test
Templates: Wiki Tables: 2. Fostering of partial template content
!! wikitext
{|
{{1x|a
b
}}
|}
!! html/php+untidy
a
b
!! html/php+tidy
a
b
!! html/parsoid
a
b
!! end
!!test
Templates: Wiki Tables: 3. td-content via multiple templates
!! wikitext
{|
{{1x|{{pipe}}a}}{{1x|b}}
|}
!! html
ab
!! end
!!test
Templates: Wiki Tables: 4. Templated tags, no content
!! wikitext
{{tbl-start}}
{{tbl-end}}
!! html
!! end
!!test
Templates: Wiki Tables: 5. Templated tags, regular td-tags
!! wikitext
{{tbl-start}}
|foo
{{tbl-end}}
!! html
foo
!! end
!!test
Templates: Wiki Tables: 6. Templated tags, templated td-tags
!! wikitext
{{tbl-start}}
{{!}}foo
{{tbl-end}}
!! html
foo
!! end
## This test case is very specific to Parsoid's internals
## and is hence only tested for Parsoid's code. Parsoid uses
## a marker tag for tags and they are expanded
## much later. We are verifying that this tag usage
## doesn't prevent foster parenting.
!! test
Templates: Wiki Tables: 7. Fosterable s should get fostered
!! wikitext
{{PartialTable}}foo
|}
!! html/parsoid
!!end
!!test
Templates: Ugly nesting: 1. Quotes opened/closed across templates (1x)
!! wikitext
{{1x|''a}}{{1x|b''c''d}}{{1x|''e}}
!! html
abcde
!!end
## Legacy parser generates misnested html
!! test
Templates: Ugly nesting: 2. Quotes opened/closed across templates (1x_with_span)
!! wikitext
{{1x_with_span|''a}}{{1x_with_span|b''c''d}}{{1x_with_span|''e}}
!! html/parsoid
abcde
!! end
## Legacy parser generates misnested html; Parsoid html2wt mode adds newlines between {{1x}}s
!! test
Templates: Ugly nesting: 3. Quotes opened/closed across templates (1x_with_div)
!! options
parsoid=wt2html,wt2wt
!! wikitext
{{1x_with_div|''a}}{{1x_with_div|b''c''d}}{{1x_with_div|''e}}
!! html/php+tidy
a
bcd
e
!! html/parsoid
a
bcd
e
!! end
!! test
Templates: Ugly nesting: 4. Divs opened/closed across templates
!! wikitext
a
b{{1x|c
d}}e
!! html+untidy
a
bc
de
!! html+tidy
a
bc
de
!! end
!! test
Templates: Ugly templates: 3. newline-only template parameter
!! wikitext
foo {{1x|
}}
!! html
foo
!! end
# This looks like a bug: a single newline triggers p/br for some reason.
!! test
Templates: Ugly templates: 4. newline-only template parameter inconsistency
!! wikitext
{{1x|
}}
!! html
!! end
# T66017 -- ugly wikitext with fostered content generates two template ranges that
# have a true overlap (T1-start - T2-start - T1-end - T2-end).
!! test
Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
!! wikitext
{{1x|
}}
{{1x|
foo}}
{{1x|
}}
!! html/parsoid
foo
!! end
# T66017 -- ugly wikitext with fostered content generates two template ranges
# that are "identical" and generate nesting cycles in the algorithm
!! test
Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
!! wikitext
{{1x|
}}
{{1x|
}}
{{1x|
}}
!! html/parsoid
!! end
!! test
Templates: Parameters substituted at the top-level
!! wikitext
{{{foo|''who'' {{1x|me}}? '''never!'''}}}
{{{foo|bar|baz}}}
!! html/php
who me? never!
bar
!! html/parsoid
who me? never!
bar
!! end
!! test
Templates: Param with empty arg in the final position
!! wikitext
{{{hi|}}}
!! html/parsoid
!! end
!!test
Parser Functions: 1. Simple example
!! wikitext
{{uc:foo}}
!! html
FOO
!!end
!!test
Parser Functions: 2. Nested use (only outermost should be marked up)
!! wikitext
{{uc:{{lc:FOO}}}}
!! html
FOO
!!end
## Note that the templates inside the references are not wrapped
!! test
Template nested in extension tag in template
!! options
title=[[Main Page]]
language=zh
!! wikitext
{{1x|hi[[ho|{{1x|hi}}]]}}
{{1x|hi[http://test.com?q={{1x|ho}}]}}
{{1x|hi-{ho|{{1x|hi}}}-}}
!! html/parsoid
!! end
###
### Pre-save transform tests
###
!! test
pre-save transform: subst:
!! options
pst
!! wikitext
{{subst:test}}
!! html/php
This is a test template
!! end
!! test
pre-save transform: normal template
!! options
pst
!! wikitext
{{test}}
!! html/php
{{test}}
!! end
!! test
pre-save transform: nonexistent template
!! options
pst
!! wikitext
{{thistemplatedoesnotexist}}
!! html/php
{{thistemplatedoesnotexist}}
!! end
!! test
pre-save transform: subst magic variables
!! options
pst
!! wikitext
{{subst:SITENAME}}
!! html/php
MediaWiki
!! end
# This is T2089, which I fixed. -- wtm
!! test
pre-save transform: subst: templates with parameters
!! options
pst
!! wikitext
{{subst:paramtest|param="something else"}}
!! html/php
This is a test template with parameter "something else"
!! end
!! article
Template:nowikitest
!! text
'''not wiki'''
!! endarticle
!! test
pre-save transform: nowiki in subst (T3188)
!! options
pst
!! wikitext
{{subst:nowikitest}}
!! html/php
'''not wiki'''
!! end
!! article
Template:commenttest
!! text
This template has in it.
!! endarticle
!! test
pre-save transform: comment in subst (T3936)
!! options
pst
!! wikitext
{{subst:commenttest}}
!! html/php
This template has in it.
!! end
!! test
pre-save transform: unclosed tag
!! options
pst
!! wikitext
'''not wiki'''
!! html/php
'''not wiki'''
!! end
!! test
pre-save transform: mixed tag case
!! options
pst
!! wikitext
'''not wiki'''
!! html/php
'''not wiki'''
!! end
!! test
pre-save transform: unclosed comment in
!! options
pst
!! wikitext
wikinowiki
!! html/php
!!end
!! test
pre-save transform: comment containing extension
!! options
pst
!! wikitext
!! html/php
!!end
!! test
pre-save transform: comment containing nowiki
!! options
pst
!! wikitext
!! html/php
!!end
!! test
pre-save transform: in subst (T5298)
!! options
pst
!! wikitext
{{subst:Includes}}
!! html/php
Foobar
!! end
!! test
pre-save transform: in subst (T5298)
!! options
pst
!! wikitext
{{subst:Includes2}}
!! html/php
Foo
!! end
!! article
Template:SubstTest
!!text
{{subst:Includes}}
!! endarticle
!! article
Template:SafeSubstTest
!! text
{{safesubst:Includes}}
!! endarticle
!! test
T24297: safesubst: works during PST
!! options
pst
!! wikitext
{{subst:SafeSubstTest}}{{safesubst:SubstTest}}
!! html/php
FoobarFoobar
!! end
!! test
T24297: safesubst: works during normal parse
!! wikitext
{{SafeSubstTest}}
!! html
Foobar
!! end
!! test
subst: does not work during normal parse
!! wikitext
{{SubstTest}}
!! html
{{subst:Includes}}
!! end
!! test
pre-save transform: context links ("pipe trick")
!! options
pst
!! wikitext
[[Article (context)|]]
[[Bar:Article|]]
[[:Bar:Article|]]
[[Bar:Article (context)|]]
[[:Bar:Article (context)|]]
[[|Article]]
[[|Article (context)]]
[[Bar:X (Y) Z|]]
[[:Bar:X (Y) Z|]]
!! html/php
[[Article (context)|Article]]
[[Bar:Article|Article]]
[[:Bar:Article|Article]]
[[Bar:Article (context)|Article]]
[[:Bar:Article (context)|Article]]
[[Article]]
[[Article (context)]]
[[Bar:X (Y) Z|X (Y) Z]]
[[:Bar:X (Y) Z|X (Y) Z]]
!! end
!! test
pre-save transform: context links ("pipe trick") with interwiki prefix
!! options
pst
!! wikitext
[[interwiki:Article|]]
[[:interwiki:Article|]]
[[interwiki:Bar:Article|]]
[[:interwiki:Bar:Article|]]
!! html/php
[[interwiki:Article|Article]]
[[:interwiki:Article|Article]]
[[interwiki:Bar:Article|Bar:Article]]
[[:interwiki:Bar:Article|Bar:Article]]
!! end
!! test
pre-save transform: context links ("pipe trick") with parens in title
!! options
pst title=[[Somearticle (context)]]
!! wikitext
[[|Article]]
!! html/php
[[Article (context)|Article]]
!! end
!! test
pre-save transform: context links ("pipe trick") with comma in title
!! options
pst title=[[Someplace, Somewhere]]
!! wikitext
[[|Otherplace]]
[[Otherplace, Elsewhere|]]
[[Otherplace, Elsewhere, Anywhere|]]
!! html/php
[[Otherplace, Somewhere|Otherplace]]
[[Otherplace, Elsewhere|Otherplace]]
[[Otherplace, Elsewhere, Anywhere|Otherplace]]
!! end
!! test
pre-save transform: context links ("pipe trick") with parens and comma
!! options
pst title=[[Someplace (IGNORED), Somewhere]]
!! wikitext
[[|Otherplace]]
[[Otherplace (place), Elsewhere|]]
!! html/php
[[Otherplace, Somewhere|Otherplace]]
[[Otherplace (place), Elsewhere|Otherplace]]
!! end
!! test
pre-save transform: context links ("pipe trick") with comma and parens
!! options
pst title=[[Who, me? (context)]]
!! wikitext
[[|Yes, you.]]
[[Me, Myself, and I (1937 song)|]]
!! html/php
[[Yes, you. (context)|Yes, you.]]
[[Me, Myself, and I (1937 song)|Me, Myself, and I]]
!! end
!! test
pre-save transform: context links ("pipe trick") with namespace
!! options
pst title=[[Ns:Somearticle]]
!! wikitext
[[|Article]]
!! html/php
[[Ns:Article|Article]]
!! end
!! test
pre-save transform: context links ("pipe trick") with namespace and parens
!! options
pst title=[[Ns:Somearticle (context)]]
!! wikitext
[[|Article]]
!! html/php
[[Ns:Article (context)|Article]]
!! end
!! test
pre-save transform: context links ("pipe trick") with namespace and comma
!! options
pst title=[[Ns:Somearticle, Context, Whatever]]
!! wikitext
[[|Article]]
!! html/php
[[Ns:Article, Context, Whatever|Article]]
!! end
!! test
pre-save transform: context links ("pipe trick") with namespace, comma and parens
!! options
pst title=[[Ns:Somearticle, Context (context)]]
!! wikitext
[[|Article]]
!! html/php
[[Ns:Article (context)|Article]]
!! end
!! test
pre-save transform: context links ("pipe trick") with namespace, parens and comma
!! options
pst title=[[Ns:Somearticle (IGNORED), Context]]
!! wikitext
[[|Article]]
!! html/php
[[Ns:Article, Context|Article]]
!! end
!! test
pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
!! options
pst
!! wikitext
[[Article(context)|]]
[[Bar:Article(context)|]]
[[:Bar:Article(context)|]]
[[|Article(context)]]
[[Bar:X(Y)Z|]]
[[:Bar:X(Y)Z|]]
!! html/php
[[Article(context)|Article]]
[[Bar:Article(context)|Article]]
[[:Bar:Article(context)|Article]]
[[Article(context)]]
[[Bar:X(Y)Z|X(Y)Z]]
[[:Bar:X(Y)Z|X(Y)Z]]
!! end
!! test
pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
!! options
pst
!! wikitext
[[Article (context)|]]
[[Bar:Article (context)|]]
[[:Bar:Article (context)|]]
[[|Article (context)]]
[[Bar:X (Y) Z|]]
[[:Bar:X (Y) Z|]]
!! html/php
[[Article (context)|Article]]
[[Bar:Article (context)|Article]]
[[:Bar:Article (context)|Article]]
[[Article (context)]]
[[Bar:X (Y) Z|X (Y) Z]]
[[:Bar:X (Y) Z|X (Y) Z]]
!! end
!! test
pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
!! options
pst
!! wikitext
[[Article(context)|]]
[[Bar:Article(context)|]]
[[:Bar:Article(context)|]]
[[|Article(context)]]
[[Bar:X(Y)Z|]]
[[:Bar:X(Y)Z|]]
!! html/php
[[Article(context)|Article]]
[[Bar:Article(context)|Article]]
[[:Bar:Article(context)|Article]]
[[Article(context)]]
[[Bar:X(Y)Z|X(Y)Z]]
[[:Bar:X(Y)Z|X(Y)Z]]
!! end
!! test
pre-save transform: context links ("pipe trick") with commas (T23660)
!! options
pst
!! wikitext
[[Article (context), context|]]
[[Article (context),context|]]
[[Bar:Article (context), context|]]
[[Bar:Article (context),context|]]
[[:Bar:Article (context), context|]]
[[:Bar:Article (context),context|]]
!! html/php
[[Article (context), context|Article]]
[[Article (context),context|Article]]
[[Bar:Article (context), context|Article]]
[[Bar:Article (context),context|Article]]
[[:Bar:Article (context), context|Article]]
[[:Bar:Article (context),context|Article]]
!! end
!! test
Parsoid: backwards pipe trick
!! wikitext
[[|'''bar''']]
!! html/php
[[|bar]]
!! html/parsoid
[[|bar]]
!! end
!! test
pre-save transform: trim trailing empty lines
!! options
pst
!! wikitext
Empty lines are trimmed
!! html/php
Empty lines are trimmed
!! end
!! test
pre-save transform: Signature expansion
!! options
pst
!! wikitext
* ~~~
* ~~~~
* ~~~~~
* ~~~
* ~~~
* ~~~
!! html/php
* [[Special:Contributions/127.0.0.1|127.0.0.1]]
* [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
* 00:02, 1 January 1970 (UTC)
* [[Special:Contributions/127.0.0.1|127.0.0.1]]
* [[Special:Contributions/127.0.0.1|127.0.0.1]]
* [[Special:Contributions/127.0.0.1|127.0.0.1]]
!! end
!! test
ParserOutput flags from signature expansion (T84843)
!! options
pst
showflags
!! wikitext
~~~~
!! html/php
[[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
flags=user-signature
!! end
!! test
pre-save transform: Signature expansion in nowiki tags (T2093)
!! options
pst disabled
!! wikitext
Shall not expand:
~~~~~~~~~~~~~~~~
{{subst:Foo}} shall be converted to FOO
As well as inside noinclude/onlyinclude
{{subst:Foo}}{{subst:Foo}}
But not inside includeonly
{{subst:Foo}}
!! html/php
Shall not expand:
~~~~~~~~~~~~~~~~
FOO shall be converted to FOO
As well as inside noinclude/onlyinclude
FOOFOO
But not inside includeonly
{{subst:Foo}}
!! end
!! test
Parsoid: Recognize nowiki with trailing space in tags
!! options
parsoid=wt2html
!! wikitext
[[foo]]
ab
cd
ef
!! html/php+tidy
<div>[[foo]]
a<nowiki / >b
cd
e<nowiki/ >f
!! html/parsoid
<div>[[foo]]
a<nowiki / >b
cd
e<nowiki/ >f
!! end
!! test
Parsoid: Recognize nowiki with odd capitalization
!! options
parsoid=wt2html
!! wikitext
[[foo]]
!! html/php+tidy
<div>[[foo]]
!! html/parsoid
<div>[[foo]]
!! end
!! test
Parsoid: Escape nowiki with trailing space in tags
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
<noWikI > foo </NoWikI >
!! end
###
### Message transform tests
###
!! test
message transform: magic variables
!! options
msg
!! wikitext
{{SITENAME}}
!! html
MediaWiki
!! end
!! test
message transform: should not transform wiki markup
!! options
msg
!! wikitext
''test''
!! html
''test''
!! end
!! test
message transform: in transcluded template (T6926)
!! options
msg
!! wikitext
{{Includes}}
!! html
Foobar
!! end
!! test
message transform: in transcluded template (T6926)
!! options
msg
!! wikitext
{{Includes2}}
!! html
Foo
!! end
!! test
{{#special:}} page name, known
!! options
msg
!! wikitext
{{#special:Recentchanges}}
!! html
Special:RecentChanges
!! end
!! test
{{#special:}} page name with subpage, known
!! options
msg
!! wikitext
{{#special:Recentchanges/param}}
!! html
Special:RecentChanges/param
!! end
!! test
{{#special:}} page name, unknown
!! options
msg
!! wikitext
{{#special:foobar nonexistent}}
!! html
Special:Foobar nonexistent
!! end
!! test
{{#speciale:}} page name, known
!! options
msg
!! wikitext
{{#speciale:Recentchanges}}
!! html
Special:RecentChanges
!! end
!! test
{{#speciale:}} page name with subpage, known
!! options
msg
!! wikitext
{{#speciale:Recentchanges/param}}
!! html
Special:RecentChanges/param
!! end
!! test
{{#speciale:}} page name, unknown
!! options
msg
!! wikitext
{{#speciale:foobar nonexistent}}
!! html
Special:Foobar_nonexistent
!! end
###
### Images
###
### For Parsoid-specific tests, see
#### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
!! test
Simple image
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[Image:foobar.jpg]]
!! html/php
!! html/parsoid
!! end
!! test
Serialize simple image with span wrapper
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
[[File:Foobar.jpg]]
!! end
!! test
Simple image (using File: namespace, now canonical)
!! wikitext
[[File:Foobar.jpg]]
!! html/php
!! html/parsoid
!! end
!! test
Right-aligned image
!! wikitext
[[File:Foobar.jpg|right]]
!! html/php
!! html/parsoid
!! end
!! test
Image with caption
!! wikitext
[[File:Foobar.jpg|right|Caption text]]
!! html/php
!! html/parsoid
Caption text
!! end
!! test
Image with caption, T55312 #1
!! wikitext
[[File:Foobar.jpg|right|Caption page stuff]]
!! html/php
!! html/parsoid
Caption page stuff
!! end
!! test
Image with caption, T55312 #2
!! wikitext
[[File:Foobar.jpg|right|Caption page=]]
!! html/php
!! html/parsoid
Caption page=
!! end
!! test
Image with caption, T55312 #3
!! wikitext
[[File:Foobar.jpg|right|Caption page=stuff]]
!! html/php
!! html/parsoid
Caption page=stuff
!! end
!! test
Image caption with pipe entity
!! wikitext
[[File:Foobar.jpg|thumb|one | two]]
[[File:Foobar.jpg|thumb|one ''two'' | three]]
!! html/php
one | two
one two | three
!! html/parsoid
one | twoone two| three
!! end
!! test
Allow empty links in image captions (T62753)
!! options
thumbsize=220
!! wikitext
[[File:Foobar.jpg|thumb|Caption [[Link1]]
[[]]
[[Link2]]
]]
!! html/php
!! html/parsoid
Caption Link1
[[]]
Link2
!! end
!! test
Titles in unlinked images (T23454)
!! wikitext
[[File:Foobar.jpg|link=|stuff]]
!! html/php
!! html/parsoid
!! end
!! test
Link with empty target
!! wikitext
[[]]
!! html
[[]]
!! end
!! test
Image with link trail
!! wikitext
Linktrails should not work for images: [[File:Foobar.jpg]]s
!! html/php
Linktrails should not work for images: s
!! html/parsoid
Linktrails should not work for images: s
!! end
!! test
Image with empty attribute
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|right||Caption text]]
!! html/php
!! html/parsoid
Caption text
!! end
!! test
1. Block image with individual attributes from templates
!! wikitext
[[File:Foobar.jpg|thumb|{{1x|137px}}|This is a caption]]
!! html/php
This is a caption
!! html/parsoid
This is a caption
!! end
!! test
2. Block Image with individual attributes from templates
!! wikitext
[[File:Foobar.jpg|{{1x|thumb}}|{{1x|137px}}|This is a caption]]
!! html/php
This is a caption
!! html/parsoid
This is a caption
!! end
!! test
3. Inline image with individual attributes from templates
!! wikitext
[[File:Foobar.jpg|{{1x|50px}}]]
!! html/php
!! html/parsoid
!! end
## Parsoid does not provide editing support for images where templates produce multiple image attributes.
## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
!! test
Image with multiple attributes from the same template
!! wikitext
[[File:Foobar.jpg|{{image_attribs}}]]
!! html/php
!! html/parsoid
Caption text
!! end
!! test
Image with link tails
!! options
thumbsize=220
!! wikitext
123[[File:Foobar.jpg]]456
123[[File:Foobar.jpg|right]]456
123[[File:Foobar.jpg|thumb]]456
!! html/php+untidy
123456
123
456
123
456
!! html/php+tidy
123456
123
456
123
456
!! html/parsoid
123456
123
456
123
456
!! end
!! test
Image with multiple captions -- only last one is accepted
!! wikitext
[[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
!! html/php
!! html/parsoid
Caption3 - accepted
!! end
!! test
Image with multiple widths -- use last
!! wikitext
[[File:Foobar.jpg|200px|300px|caption]]
!! html/php
!! html/parsoid
!! end
!! test
Image with multiple alignments -- use first (T50664)
!! options
thumbsize=220
!! wikitext
[[File:Foobar.jpg|thumb|left|right|center|caption]]
[[File:Foobar.jpg|middle|text-top|caption]]
!! html/php
caption
!! html/parsoid
caption
!! end
!! test
Image with width attribute at different positions
!! wikitext
[[File:Foobar.jpg|200px|right|Caption]]
[[File:Foobar.jpg|right|200px|Caption]]
[[File:Foobar.jpg|right|Caption|200px]]
!! html/php
!! html/parsoid
CaptionCaptionCaption
!! end
# a sad bit of backward-compatibility
!! test
Image with size specified with pxpx (T15500, T53628)
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|20pxpx]]
[[File:Foobar.jpg|200x20pxpx]]
!! html/php
!! html/parsoid
!! end
!! test
Image with link parameter, wiki target
!! wikitext
[[File:Foobar.jpg|link=Main Page]]
!! html/php
!! html/parsoid
!! end
# parsoid T51293 (part 1)
!! test
Image with link parameter, URL target
!! wikitext
[[File:Foobar.jpg|link=http://example.com/]]
!! html/php
!! html/parsoid
!! end
# parsoid T51293 (part 2)
!! test
Image with link parameter, protocol-less URL target
!! wikitext
[[File:Foobar.jpg|link=//example.com/]]
!! html/php
!! html/parsoid
!! end
!! test
Escaping non-block captions (T107435)
!! options
parsoid={
"modes": ["wt2wt"],
"changes": [
["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
]
}
!! wikitext
[[Image:Foobar.jpg|caption]]
!! wikitext/edited
[[Image:Foobar.jpg||]]
!! end
# wgExternalLinkTarget not supported by Parsoid
!! test
Image with link parameter, wgExternalLinkTarget
!! wikitext
[[Image:foobar.jpg|link=http://example.com/]]
!! config
wgExternalLinkTarget='foobar'
!! html/php
!! end
!! test
Image with link parameter, wgNoFollowLinks set to false
!! wikitext
[[Image:foobar.jpg|link=http://example.com/]]
!! config
wgNoFollowLinks=false
!! html/php
!! end
!! test
Image with link parameter, wgNoFollowDomainExceptions
!! wikitext
[[Image:foobar.jpg|link=http://example.com/]]
!! config
wgNoFollowDomainExceptions='example.com'
!! html/php
!! end
# wgExternalLinkTarget not supported by Parsoid
!! test
Image with link parameter, wgExternalLinkTarget, unnamed parameter
!! wikitext
[[Image:foobar.jpg|link=http://example.com/|Title]]
!! config
wgExternalLinkTarget='foobar'
!! html/php
!! end
!! test
Image with empty link parameter
!! wikitext
[[File:Foobar.jpg|link=]]
!! html/php
!! html/parsoid
!! end
!! test
Image with link parameter (wiki target) and unnamed parameter
!! wikitext
[[File:Foobar.jpg|link=Main_Page|Title]]
!! html/php
!! html/parsoid
!! end
!! test
Image with link parameter (URL target) and unnamed parameter
!! wikitext
[[File:Foobar.jpg|link=http://example.com/|Title]]
!! html/php
!! html/parsoid
!! end
!! test
Thumbnail image with link parameter
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
!! html/php
Title
!! html/parsoid
Title
!! end
!! test
Manually-specified thumbnail image
!! options
thumbsize=220
!! wikitext
[[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
!! html/php
Title
!! html/parsoid
Title
!! end
!! test
Manually-specified thumbnail image (backwards compat)
!! options
thumbsize=220
parsoid=html2wt
!! wikitext
[[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
!! html/php
Title
!! html/parsoid
Title
!! end
!! test
Manually-specified thumbnail image with explicit link to wiki page
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
!! html/php
Title
!! html/parsoid
Title
!! end
!! test
Manually-specified thumbnail image with explicit link to url
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
!! html/php
Title
!! html/parsoid
Title
!! end
!! test
Manually-specified thumbnail image with explicit no link
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
!! html/php
Title
!! html/parsoid
Title
!! end
!! test
Manually-specified thumbnail image with explicit link and alt text
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
!! html/php
Title
!! html/parsoid
Title
!! end
!! test
Image with frame and link
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
!! html/php
!! html/parsoid
This is a test image Main Page
!! end
!! test
Image with frame and link and explicit alt
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
!! html/php
!! html/parsoid
This is a test image Main Page
!! end
!! test
Image with wiki markup in implicit alt
!! wikitext
[[Image:Foobar.jpg|testing '''bold''' in alt]]
[[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
!! html/php
!! html/parsoid
!! end
!! test
Alt image option should handle most kinds of wikitext without barfing
!! wikitext
[[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{1x|''bold template''}}.]]
!! html/php
This is the image caption
!! html/parsoid
This is the image caption
!! end
!! test
Ampersand in alt attribute (T206940)
!! wikitext
[[File:Foobar.jpg|alt=&]]
File:Foobar.jpg|alt=&
!! html/php+tidy
!! html/parsoid
!! end
## FIXME: The inconsistency in the gallery extension on the php side is T49646
!! test
Link with encoded pipe in alt option
!! options
parsoid={
"modes": ["wt2html", "html2html"]
}
!! wikitext
[[File:Foobar.jpg|alt=http://testing.123?4=5|6|caption]]
File:Foobar.jpg|alt=http://testing.123?4=5|6|caption
!! html/php+tidy
!! html/parsoid
caption
!! end
!! test
Italics markup in alt attribute (T206940)
!! options
parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|alt=''x''|caption]]
File:Foobar.jpg|alt=''x''|caption
!! html/php+tidy
caption
!! html/parsoid
caption
!! end
## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
## are no longer in storage.
!! test
Nowiki markup in alt attribute (T206940)
!! options
parsoid=html2wt
!! wikitext
[[File:Foobar.jpg|alt=''x''|caption]]
File:Foobar.jpg|alt=''x''|caption
!! html/php+tidy
caption
!! html/parsoid
caption
!! end
!! test
Nowiki markup in alt attribute (edited html, no data-parsoid) (T206940)
!! wikitext
[[File:Foobar.jpg|alt=''x''|caption]]
File:Foobar.jpg|alt=''x''|caption
!! html/php+tidy
caption
!! html/parsoid
caption
!! end
## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
## are no longer in storage.
!! test
Ampersand in link attribute (T206940)
!! options
parsoid=html2wt
!! wikitext
[[File:Foobar.jpg|link=Foo & bar]]
File:Foobar.jpg|link=Foo & bar
!! html/php+tidy
!! html/parsoid
!! end
!! test
Ampersand in link attribute (edited html, no data-parsoid) (T206940)
!! wikitext
[[File:Foobar.jpg|link=Foo_&_bar]]
File:Foobar.jpg|link=Foo_&_bar
!! html/php+tidy
!! html/parsoid
!! end
!! test
Italics markup in link attribute (T206940)
!! options
parsoid=wt2html,html2html
!! wikitext
[[Foo''s bar''s]]
[[File:Foobar.jpg|link=Foo''s bar''s|caption1]]
[[File:Foobar.jpg|link=''Main Page''|caption2]]
File:Foobar.jpg|link=Foo''s bar''s|caption1
File:Foobar.jpg|link=''Main Page''|caption2
!! html/php+tidy
!! end
## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
## are no longer in storage.
!! test
Nowiki markup in link attribute (T206940)
!! options
parsoid=html2wt
!! wikitext
[[File:Foobar.jpg|link=Foo''s_bar''s|caption]]
File:Foobar.jpg|link=Foo''s_bar''s|caption
!! html/php+tidy
caption
!! html/parsoid
caption
!! end
!! test
Nowiki markup in link attribute (edited html, no data-parsoid) (T206940)
!! wikitext
[[File:Foobar.jpg|link=Foo''s_bar''s|caption]]
File:Foobar.jpg|link=Foo''s_bar''s|caption
!! html/php+tidy
caption
!! html/parsoid
caption
!! end
!! test
HTML entity prefix in link markup (T209236)
!! wikitext
[[File:Foobar.jpg|link=https://example.com?foo¶ms=bar]]
File:Foobar.jpg|link=https://example.com?foo¶ms=bar
!! html/php+tidy
!! html/parsoid
!! end
!! test
Image with table with attributes in caption
!! options
parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|thumb|
{| class="123" |
|- class="456" |
| ha
|}
]]
!! html/parsoid
ha
!! end
!! test
Image with table with rows from templates in caption
!! wikitext
[[File:Foobar.jpg|thumb|
{|
{{1x|{{!}} hi}}
|}
]]
!! html/parsoid
hi
!! end
!! test
Image with nested tables in caption
!! wikitext
[[File:Foobar.jpg|thumb|Foo
{|
|
{|
|z
|}
|}
]]
!! html/parsoid
Foo
z
!! end
!! test
Image with heading and horizontal rule in caption
!! wikitext
[[File:Foobar.jpg|thumb|
===Testing===
123
--------------
]]
!! html/php
123
!! end
###################
# Conflicting image format options.
# First option specified should 'win'.
# All three cases in each test should be identical.
!! test
Image with 'frameless' first.
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|frameless|caption]]
[[File:Foobar.jpg|frameless|frame|caption]]
[[File:Foobar.jpg|frameless|thumb|caption]]
!! html/php
!! html/parsoid
!! end
!! test
Image with 'frame' first.
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|frame|caption]]
[[File:Foobar.jpg|frame|frameless|caption]]
[[File:Foobar.jpg|frame|thumb|caption]]
!! html/php
caption
caption
caption
!! html/parsoid
captioncaptioncaption
!! end
!! test
Image with 'thumb' first.
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|thumb|caption]]
[[File:Foobar.jpg|thumb|frameless|caption]]
[[File:Foobar.jpg|thumb|frame|caption]]
!! html/php
caption
caption
caption
!! html/parsoid
captioncaptioncaption
!! end
###################
# Image sizing.
# See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
# and https://phabricator.wikimedia.org/T64258
# Foobar has actual size of 1941x220
# 1. Thumbs & frameless always reduce, can't be enlarged unless it's
# a scalable format.
# 2. Framed images always ignore size options; always render at default size.
# 3. "Unspecified format" and border are the only types which can be
# enlarged.
!! test
Image: unspecified format and border enlarge
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|2000px]]
[[File:Foobar.jpg|border|2000px]]
!! html/php
!! html/parsoid
!! end
!! test
Image: "unspecified format" and border reduce
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|1000px]]
[[File:Foobar.jpg|border|1000px]]
!! html/php
!! html/parsoid
!! end
!! test
Image: thumbs reduce
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|thumb|50px]]
!! html/php
!! html/parsoid
!! end
!! test
Image: bitmap thumbs can't be enlarged past original size, but vector can.
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|thumb|2000px]]
[[File:Foobar.svg|thumb|2000px]]
!! html/php
!! html/parsoid
!! end
!! test
Image: frameless can reduce in size
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|frameless|50px]]
!! html/php
!! html/parsoid
!! end
!! test
Image: bitmap frameless can't be enlarged past original size, but vector can
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|frameless|2000px]]
[[File:Foobar.svg|frameless|2000px]]
!! html/php
!! html/parsoid
!! end
!! test
Image: framed images are always unscaled.
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|frame]]
[[File:Foobar.jpg|frame|50px]]
[[File:Foobar.jpg|frame|50x50px]]
[[File:Foobar.jpg|frame|2000px]]
!! html/php
!! html/parsoid
!! end
!! test
Bogus sizes during html2wt
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
[[File:Foobar.jpg]]
[[File:Foobar.jpg|10x10px]]
!! end
###################
!! test
Link to image page- image page normally doesn't exist, hence edit link
Add test with existing image page
#
!! html/parsoid
http://example.com
!! end
!! test
Thumbnail image caption with a free URL and explicit alt
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
!! html/php
!! html/parsoid
http://example.com
!! end
!! test
SVG thumbnails with no language set
!! options
!! wikitext
[[File:Foobar.svg|thumb|caption]]
!! html/php
caption
!! html/parsoid
caption
!! end
!! test
SVG thumbnails with language de
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.svg|thumb|caption|lang=de]]
!! html/php
caption
!! html/parsoid
caption
!! end
!! test
SVG thumbnails with invalid language code
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
!! html/php
lang=invalid:language:code
!! html/parsoid
lang=invalid:language:code
!! end
!! test
SVG thumbnails in page language
!! options
language=ru
!! wikitext
[[File:Foobar.svg]] [[File:Foobar.svg|lang=en]]
!! html/php
!! end
!! test
SVG thumbnails in page language not present in the file
!! options
language=de
!! wikitext
[[File:Foobar.svg]] [[File:Foobar.svg|lang=ru]]
!! html/php
!! end
!! test
T3887: A ISBN with a thumbnail
!! wikitext
[[File:Foobar.jpg|thumb|ISBN 1235467890]]
!! html/php
!! html/parsoid
This is RFC 12354
!! end
!! test
T3887: A mailto link with a thumbnail
!! wikitext
[[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
!! html/php
!! html/parsoid
Please mailto:nobody@example.com
!! end
# Pending resolution to T2368
!! test
T2648: Frameless image caption with a link
!! wikitext
[[File:Foobar.jpg|text with a [[link]] in it]]
!! html/php
!! html/parsoid
!! end
!! test
T2648: Frameless image caption with a link (suffix)
!! wikitext
[[File:Foobar.jpg|text with a [[link]]foo in it]]
!! html/php
!! html/parsoid
!! end
!! test
T2648: Frameless image caption with an interwiki link
!! wikitext
[[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
!! html/php
!! html/parsoid
!! end
!! test
T2648: Frameless image caption with a piped interwiki link
!! wikitext
[[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
!! html/php
!! html/parsoid
!! end
!! test
T107474: Frameless image caption with
!! wikitext
[[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
!! html/parsoid
!! end
!! test
Escape HTML special chars in image alt text
!! wikitext
[[File:Foobar.jpg|& < > "]]
!! html/php
!! html/parsoid
!! end
!! test
Escape HTML special chars in image alt text with LanguageConverter
!! options
language=zh
!! wikitext
[[File:Foobar.jpg|& < > "]]
!! html/php
!! html/parsoid
!! end
!! test
Entities in file name and attributes
!! wikitext
[[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
!! html/php
!! end
!! test
T2499: Alt text should have Ӓ, not &1234;
!! wikitext
[[File:Foobar.jpg|♀]]
!! html/php
!! html/parsoid
!! end
!! test
Broken image caption with link
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
!! html/php
[[Image:Foobar.jpg|thumb|This is a broken caption. But this is just an ordinary link.
!! html/parsoid
[[Image:Foobar.jpg|thumb|This is a broken caption. But this is just an ordinary link.
!! end
!! test
Image caption containing another image
!! wikitext
[[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
!! html/php
This is a caption with another inside it!
!! html/parsoid
This is a caption with another inside it!
!! end
!! test
Image: caption containing a newline
!! wikitext
[[File:Foobar.jpg|This
*is some text]]
!! html/php
!! html/parsoid
!!end
!!test
Image: caption containing leading space
(The leading space should not trigger nowiki escaping in wt2wt mode)
!! wikitext
[[File:Foobar.jpg|thumb| bar]]
!! html/php
bar
!! html/parsoid
bar
!!end
# html/php output not have newlines after table, td, th, etc. because
# Linker::makeThumbLink2() replaces the newlines with spaces since
# the table is inside a caption.
# FIXME: Verify if that circa 2004 fix is still required.
!! test
Image: caption containing a table
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
{|
!Foo!!Bar
|-
|Foo1||Bar1
|}
and some more text.]]
!! html/php
This is an example image thumbnail caption with a table
Foo
Bar
Foo1
Bar1
and some more text.
!! html/parsoid
This is an example image thumbnail caption with a table
Foo
Bar
Foo1
Bar1
and some more text.
!! end
!! test
T5090: External links other than http: in image captions
!! wikitext
[[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
!! html/php
!! html/parsoid
This caption has irc and Secure ext links in it.
!! end
!! test
Custom class
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[Image:foobar.jpg|a|class=b]]
!! html/php
!! html/parsoid
!! end
!! test
Localized image handling (1).
!! options
parsoid=wt2html,wt2wt,html2html
language=es
!! wikitext
[[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
!! html/php
!! html/parsoid
caption
!! end
!! test
Localized image handling (3).
!! options
language=fa
parsoid=html2wt
!! html/parsoid
!! wikitext
[[File:Foobar.jpg|بندانگشتی]]
!! end
!! test
"border", "frameless" and "class" attributes on an image.
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|frameless|border|class=extra|caption]]
!! html/php
!! html/parsoid
!! end
# Note that 'right' is the default alignment, despite the misspelled 'righ' below
!! test
Invalid image attributes (T64500)
!! options
thumbsize=220
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|thumb|float|left|caption]]
[[File:Foobar.jpg|thumb|righ|caption]]
[[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
!! html/php
caption
caption
caption
!! html/parsoid
captioncaptioncaption
!! end
!! article
File:Barfoo.jpg
!! text
#REDIRECT [[File:Barfoo.jpg]]
!! endarticle
# FIXME: Parsoid should run this test -- but we'd need to teach the
# mockAPI about the redirected Barfoo.jpg image.
!! test
Redirected image
!! wikitext
[[Image:Barfoo.jpg]]
!! html/php
!! end
## FIXME: Parsoid needs to learn about this flag.
!! test
Missing image with uploads disabled
!! options
wgEnableUploads=0
!! wikitext
[[File:Foobaz.jpg]]
!! html/php
!! end
# Parsoid-specific testing for images
# https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
# Currently imperfect due to a flaw in the Parsoid testrunner
# Work in progress
# THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
# image tests.
!! test
Parsoid-specific image handling - simple image with size and middle alignment
!! wikitext
[[File:Foobar.jpg|middle|50px]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
!! options
parsoid=wt2wt,wt2html,html2html
!! wikitext
[[Image:Foobar.jpg|middle|50px]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - simple image with size and middle alignment (existing content)
!! wikitext
[[File:Foobar.jpg|50px|middle]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[Image:Foobar.jpg|50px|middle]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
!! wikitext
[[File:Foobar.jpg|500x10px|baseline|caption]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - simple image with border and size spec
!! wikitext
[[File:Foobar.jpg|50px|border|caption]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - thumbnail with halign, valign, and caption
!! options
parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|left|baseline|thumb|caption content]]
!! html/parsoid
caption content
!! end
!! test
Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
!! options
parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|thumb|left|baseline|caption content]]
!! html/parsoid
caption content
!! end
!! test
Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
!! options
parsoid=wt2html,html2html
!! wikitext
[[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
!! html/parsoid
caption
!! end
!! test
Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
!! options
parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
!! html/parsoid
caption
!! end
!! test
Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|frame|500x50px|caption]]
!! html/parsoid
caption
!! end
!! test
Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
!! options
parsoid=wt2html,html2html
!! wikitext
[[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
!! html/parsoid
caption
!! end
!! test
Parsoid-specific image handling - frameless image with specific size, border, and caption
!! wikitext
[[File:Foobar.jpg|frameless|442x50px|border|caption]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - simple image with a formatted caption
!! wikitext
[[File:Foobar.jpg|
a
b
c
]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - caption with a template in it
!! wikitext
[[File:Foobar.jpg|thumb|200x23px|This caption has a {{1x|transclusion}} in it.]]
!! html/parsoid
This caption has a transclusion in it.
!! end
!! test
Parsoid-specific image handling - caption with unbalanced tags in it
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
foo
[[File:Foobar.jpg|thumb|200x200px|This caption has a
unbalanced tag in it.]]
bar
!! html/parsoid
foo
This caption has a
unbalanced tag in it.
bar
!! end
!! test
Parsoid-specific image handling - empty caption (1)
!! options
parsoid=wt2html,wt2wt
!! wikitext
[[File:Foobar.jpg|thumb|]]
!! html/parsoid
!! end
# empty captions don't get serialized unless we're in the "round trip" case
!! test
Parsoid-specific image handling - empty caption (2)
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
[[File:Foobar.jpg|thumb]]
!! end
!! test
Parsoid-specific image handling - whitespace caption
!! wikitext
[[File:Foobar.jpg|thumb| ]]
!! html/parsoid
!! end
!! test
Parsoid-specific image handling - lang option
!! wikitext
foo
[[File:Foobar.svg|lang=de|caption]]
bar
!! html/parsoid
foo
bar
!! end
## Edge case bugs in Parsoid from T93580
!! test
T93580: 1. Templated inside block images
!! wikitext
[[File:Foobar.jpg|thumb|Caption with templated ref: {{1x|foo}}]]
!! html/parsoid
Caption with templated ref: [1]
!! end
###
### Categories
###
!! article
Category:MediaWiki User's Guide
!! text
blah
!! endarticle
!! test
Link to category
!! wikitext
[[:Category:MediaWiki User's Guide]]
!! html
!! end
!! test
Simple category
!! options
cat
!! wikitext
[[Category:MediaWiki User's Guide]]
!! html/php
cat=MediaWiki_User's_Guide sort=
!! html/parsoid
!! end
!! test
PAGESINCATEGORY invalid title fatal (r33546 fix)
!! wikitext
{{PAGESINCATEGORY:}}
!! html
0
!! end
!! test
Category with different sort key
!! options
cat
!! wikitext
[[Category:MediaWiki User's Guide|Foo]]
!! html/php
cat=MediaWiki_User's_Guide sort=Foo
!! html/parsoid
!! end
!! test
Category with identical sort key
!! options
cat
!! wikitext
[[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
!! html/php
cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
!! html/parsoid
!! end
!! test
Category with template-generated sort key
!! options
cat
!! wikitext
[[Category:MediaWiki User's Guide|MediaWiki {{1x|Foo}} Guide]]
!! html/php
cat=MediaWiki_User's_Guide sort=MediaWiki Foo Guide
!! html/parsoid
!! end
!! test
Category with empty sort key
!! options
cat
pst
!! wikitext
[[Category:MediaWiki User's Guide|]]
!! html/php
[[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
!! end
!! test
Category with empty sort key and parentheses
!! options
cat
pst
!! wikitext
[[Category:Foo (bar)|]]
!! html/php
[[Category:Foo (bar)|Foo]]
!! end
!! test
Category with link tail
!! options
cat
pst
!! wikitext
123[[Category:Foo]]456
!! html/php
123[[Category:Foo]]456
!! end
!! test
Category with template
!! options
cat
pst
!! wikitext
[[Category:{{1x|Foo}}]]
!! html/php
[[Category:{{1x|Foo}}]]
!! end
!! test
Category with template in sort key
!! options
cat
pst
!! wikitext
[[Category:Foo|{{1x|Bar}}]]
!! html/php
[[Category:Foo|{{1x|Bar}}]]
!! end
!! test
Category with template in sort key and title
!! options
cat
pst
!! wikitext
[[Category:{{1x|Foo}}|{{1x|Bar}}]]
!! html/php
[[Category:{{1x|Foo}}|{{1x|Bar}}]]
!! end
## We used to, but no longer wt2wt this test since the default serializer
## will normalize all categories to serialize on their own line.
## This wikitext usage is going to be fairly uncommon in production and
## selser will take care of preserving formatting in those scenarios.
!! test
Category / paragraph interactions
!! options
parsoid=wt2html
!! wikitext
Foo [[Category:Baz]] Bar
Foo [[Category:Baz]]
Bar
Foo
[[Category:Baz]]
Bar
Foo
[[Category:Baz]] Bar
Foo
[[Category:Baz]]
[[Category:Baz]]
[[Category:Baz]]
Bar
[[Category:Baz]]
[[Category:Baz]]
[[Category:Baz]]
[[Category:Baz]]
{{1x|[[Category:Baz]]}}
[[Category:Baz]]
!! html/php
Foo Bar
Foo
Bar
Foo
Bar
Foo Bar
Foo
Bar
!! html/parsoid
Foo Bar
Foo Bar
Foo Bar
Foo Bar
Foo Bar
!! end
## We used to, but no longer wt2wt this test since the default serializer
## will normalize all categories to serialize on their own line.
## This wikitext usage is going to be fairly uncommon in production and
## selser will take care of preserving formatting in those scenarios.
##
## The whitespace on the empty line is part of the test. Please do not delete
!! test
1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
!! options
parsoid=wt2html
!! wikitext
This
[[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
{{1x|[[Category:Foo]] and so should this!}}
!! html/php
This and this should be part of same paragraph (not an indent-pre) and so should this!
!! html/parsoid
This
and this should be part of same paragraph (not an indent-pre)
and so should this!
!! end
## Parsoid will not try to wt2wt this while preserving newlines because
## it suppresses excess newlines within list items -- and we don't want to
## introduce a special case just for categories, which is, in reality somewhat
## odd behavior -- categories are unlikely to be used in list items like this
## in top-level pages and are only likely to show up in template-generated
## list items where this RT-ing is a non-issue.
##
## The whitespace on the empty line is part of the test. Please do not delete
!! test
2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
!! options
parsoid=wt2html
!! wikitext
* This
[[Category:Foo]] and this should be part of the same list item
* So should this
{{1x|[[Category:Foo]] and this should be part of the same list item}}
!! html/php+tidy
This and this should be part of the same list item
So should this and this should be part of the same list item
!! html/parsoid
This and this should be part of the same list item
So should this and this should be part of the same list item
!! end
## Newlines and categories that follow the last item of a list
## are treated differently because this (list followed by categories)
## is an extremely common pattern on wikis.
!! test
3. Categories and newlines: newline suppression for last list item should RT properly
!! wikitext
*a
*b
[[Category:Foo]]
[[Category:Bar]]
[[Category:Baz]]
:c
[[Category:C]]
;d
[[Category:D]]
!! html/parsoid
a
b
c
d
!! end
!! test
4. Categories and newlines: newline suppression for last list item should RT properly
!! wikitext
*a
****b
[[Category:Foo]]
!! html/parsoid
a
b
!! end
## only wt2html for this to make sure the algo only applies to the rightmost path
!! test
5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
!! options
parsoid=wt2html
!! wikitext
*a
**b
[[Category:Foo]]
*c
**d
[[Category:Foo]]
!! html/parsoid
a
b
c
d
!! end
## We used to, but no longer wt2wt this test since the default serializer
## will normalize all categories to serialize on their own line.
## This wikitext usage is going to be fairly uncommon in production and
## selser will take care of preserving formatting in those scenarios.
!! test
6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
!! options
parsoid=wt2html
!! wikitext
*a [[Category:Foo]]
!! html/parsoid
a
!! end
# This test also demonstrates because of newline+category tunneling
# through the list hander, template wrapping doesn't expand to the
# containing list when the list item swallows the category.
!! test
7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
!! wikitext
*{{1x|a
[[Category:Foo]]}}
!! html/parsoid
a
!! end
!! test
8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
!! wikitext
*a
{{1x|[[Category:Foo]]
[[Category:Bar]]}}
[[Category:Baz]]
!! html/parsoid
a
!! end
!! test
Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
!! wikitext
*a
[[Category:Bar]]
[[Category:Baz]]
!! html/parsoid
a
!! end
!! test
Categories and newlines: should behave properly with linkprefix (T87753)
!! options
language=ar
!! wikitext
foo bar
foo bar
[[تصنيف:Foo]]
[[تصنيف:Bar]]
!! html/php
foo bar
foo bar
!! html/parsoid
foo bar
foo bar
!! end
!! test
No regressions on internal links following category (T174639)
!! options
parsoid=wt2html,html2html
!! wikitext
[[Category:Foo]]
!! end
# Note that Parsoid differs slightly from PHP due to T175421
!! test
11. Special case where only newlines separate links (T175416)
!! options
parsoid=wt2html,html2html
!! wikitext
[[Category:Foo]]
[[Foo]][[es:Alimento]]
[[Foo]]
!! html/php
!! end
!! test
Category links with multiple namespaces
!! wikitext
[[Category:Project:Foo]]
!! html/parsoid
!! end
!! test
Parsoid: Serialize link to category page with colon escape
!! wikitext
[[:Category:Foo]]
[[:Category:Foo|Bar]]
!! html/php+tidy
!! end
# We used to, but no longer wt2wt this test since the default serializer
# will normalize all categories to serialize on their own line.
# This wikitext usage is going to be fairly uncommon in production and
# selser will take care of preventing whitespace insertion if this
# occurs in an article.
#
# html2html disabled for the same reason (whitespace insertion between
# x and y).
#
# html2wt disabled because it localizes the "Category" namespace.
!! test
Link prefix/suffixes aren't applied to category links
!! options
parsoid=wt2html
language=is
!! wikitext
x[[Category:Foo]]y
!! html/php
xy
!! html/parsoid
xy
!! end
!! test
Link prefix/suffixes aren't applied to language links
!! options
parsoid=wt2html
language=is
!! wikitext
x[[es:Foo]]y
!! html/php
xy
!! html/parsoid
xy
!! end
!! test
Parsoid: Serialize link to file page with colon escape
!! wikitext
[[:File:Foo.png]]
[[:File:Foo.png|Bar]]
!! html/php+tidy
!! end
!! test
Parsoid: Serialize a genuine category link without colon escape
!! wikitext
[[Category:Foo]]
[[Category:Foo|Bar]]
!! html/php+tidy
!! html/parsoid
!! end
!! test
Normalize hrefs properly before testing for invalid link targets (T72894)
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
[[Category:Toxine bactérienne]]
!! end
!! test
Parsoid: Defaultsort
!! wikitext
{{DEFAULTSORT:Foo}}
!! html/parsoid
!! end
!! test
Parsoid: Defaultsort variations (T236846)
!! wikitext
{{DEFAULTSORT}}
{{DEFAULTSORT:}}
{{DEFAULTSORT:DOGGIE}}
!! html/parsoid
!! end
!! test
Parsoid: Defaultsort with key content being added (T236846)
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
{{DEFAULTSORT:BIRD}}
!! end
# NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
# But, this is a limitation of our representation and is documented in
# TemplateHandler.js in processSpecialMagicWord
!! test
Parsoid: Defaultsort (template-generated)
!! wikitext
{{{{1x|DEFAULTSORT}}:Foo}}
!! html/parsoid
!! end
###
### Inter-language links
###
!! test
Interlanguage links
!! options
ill
!! wikitext
[[es:Alimento]]
[[fr:Nourriture]]
[[zh:食品]]
!! html/php
es:Alimento fr:Nourriture zh:食品
!! html/parsoid
!! end
!! test
Duplicate interlanguage links (T26502)
!! options
ill
!! wikitext
[[es:1]]
[[es:2]]
[[fr:1]]
[[fr:2]]
!! html/php
es:1 fr:1
!! html/parsoid
!! end
###
### Sections
###
!! test
Basic section headings
!! wikitext
==Headline 1==
Some text
==Headline 2==
More
===Smaller headline===
Blah blah
!! html
!! end
!! test
Section headings with TOC
!! wikitext
==Headline 1==
===Subheadline 1===
=====Skipping a level=====
======Skipping a level======
==Headline 2==
Some text
===Another headline===
!! html
!! end
!! test
TOC with wgMaxTocLevel=3 and two level four headings (T8204)
!! options
wgMaxTocLevel=3
!! wikitext
==Section 1==
===Section 1.1===
====Section 1.1.1====
====Section 1.1.1.1====
==Section 2==
!! html
!! end
!! article
Template:sections
!! text
===Section 1===
==Section 2==
!! endarticle
!! test
Template with sections, __NOTOC__
!! wikitext
__NOTOC__
==Section 0==
{{sections}}
==Section 4==
!! html
!!end
# Parsoid doesn't wt2wt this cleanly because it adds s.
!! test
Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
!! options
parsoid=wt2html,html2html
!! wikitext
===
The line above must have a trailing space!
===
But just in case it doesn't...
!! html/php
!! end
!! test
Header with special characters (T27462)
!! wikitext
The tooltips shall not show entities to the user (ie. be double escaped)
==text > text==
section 1
==text < text==
section 2
==text & text==
section 3
==text ' text==
section 4
==text " text==
section 5
!! html/php
The tooltips shall not show entities to the user (ie. be double escaped)
The tooltips shall not show entities to the user (ie. be double escaped)
text > text
section 1
text < text
section 2
text & text
section 3
text ' text
section 4
text " text
section 5
!! end
!! test
Header with space, plus and underscore as entity
!! wikitext
Id should not contain + for spaces
==Space between Text==
section 1
==Space-Entity between Text==
section 2
==Plus+between+Text==
section 3
==Plus-Entity+between+Text==
section 4
==Underscore_between_Text==
section 5
==Underscore-Entity_between_Text==
section 6
[[#Space between Text]]
[[#Space-Entity between Text]]
[[#Plus+between+Text]]
[[#Plus-Entity+between+Text]]
[[#Underscore_between_Text]]
[[#Underscore-Entity_between_Text]]
!! html/php
!!end
!! test
Namespaced link must have a title
!! wikitext
[[Project:]]
!! html
[[Project:]]
!!end
!! test
Namespaced link must have a title (bad fragment version)
!! wikitext
[[Project:#fragment]]
!! html
[[Project:#fragment]]
!!end
###
### HTML tags and HTML attributes
###
!! test
div with no attributes
!! wikitext
HTML rocks
!! html
HTML rocks
!! end
!! test
div with double-quoted attribute
!! wikitext
HTML rocks
!! html
HTML rocks
!! end
!! test
div with single-quoted attribute
!! wikitext
HTML rocks
!! html
HTML rocks
!! end
!! test
div with unquoted attribute
!! wikitext
HTML rocks
!! html
HTML rocks
!! end
!! test
div with illegal double attributes
!! wikitext
HTML rocks
!! html
HTML rocks
!! end
!! test
div with empty attribute value, space before equals
!! options
parsoid=wt2html,html2html
!! wikitext
HTML rocks
!! html/php
HTML rocks
!! html/parsoid
HTML rocks
!! end
!! test
div with multiple empty attribute values
!! config
wgFragmentMode=[ 'html5', 'legacy' ]
!! options
parsoid=wt2html,html2html
!! wikitext
HTML rocks
!! html/php
HTML rocks
!! html/parsoid
HTML rocks
!! end
# FIXME Parsoid doesn't actually match PHP here.
!! test
Extension tag in attribute value
!! options
wgRawHtml=1
!! wikitext
ok
!! html/php+tidy
ok
!! html/parsoid
ok
!! end
!! test
table with multiple empty attribute values
!! options
parsoid=wt2html,html2html
!! wikitext
{| title= id=
|hi
|}
!! html/php
hi
!! html/parsoid
hi
!! end
!! test
div with braces in attribute value
!! wikitext
Foo
!! html/php
Foo
!! html/parsoid
Foo
!! end
!! test
div with empty attribute value, no space before equals
!! options
parsoid=wt2html,html2html
!! wikitext
HTML rocks
!! html/php
HTML rocks
!! html/parsoid
HTML rocks
!! end
!! test
HTML multiple attributes correction
!! wikitext
Awesome!
!! html
Awesome!
!! end
!! test
Table multiple attributes correction
!! wikitext
{|
!+ class="error" class="awesome"|status
|}
!! html
status
!! end
!! test
DIV IN UPPERCASE
!! wikitext
HTML ROCKS
!! html
HTML ROCKS
!! end
!! test
Non-ASCII pseudo-tags are rendered as text
!! wikitext
!! html
<khyô>
!! end
!! test
Pseudo-tag with URL 'name' renders as url link
!! wikitext
!! html
!! end
!! test
text with amp in the middle of nowhere
!! wikitext
Remember AT&T?
!! html
Remember AT&T?
!! end
!! test
text with character entity: eacute
!! wikitext
I always thought é was a cute letter.
!! html+tidy
I always thought é was a cute letter.
!! end
!! test
text with entity-escaped character entity-like string: eacute
!! wikitext
I always thought é was a cute letter.
!! html
I always thought é was a cute letter.
!! end
!! test
text with undefined character entity: xacute
!! wikitext
I always thought &xacute; was a cute letter.
!! html
I always thought &xacute; was a cute letter.
!! end
!! test
Text with HTML5 semicolon-less entity (should not decode)
!! wikitext
&amp;
!! html/php+tidy
&amp;
!! html/parsoid
&amp;
!! end
!! test
HTML5 tags
!! wikitext
five
This highlighted text
!! html
five
This highlighted text
!! end
!! test
HTML tag with leading space is parsed as text
!! wikitext
< div>foo< /div>
!! html
< div>foo< /div>
!! end
## FIXME: The untrimmed attribute in Parsoid is T205737
!! test
Element with broken attribute syntax
!! options
parsoid=wt2html
!! wikitext
hi
ho
!! html/php
hi
ho
!! html/parsoid
hi
ho
!! end
###
### Nesting tests (see T43545, T52604, T53081)
###
# This test case is fixed in Parsoid by domino 1.0.12. (T52604)
# 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.
!! wikitext
XYZ
!! html
XYZ
!! end
# This was T43545 in the PHP parser.
!! test
Nesting of
!! wikitext
XYZ
!! html+tidy
XYZ
!! end
# The following cases were T53081 in the PHP parser.
# Note that there are some other nestable tags (b, i, etc) which are
# not covered; see T53081 for discussion.
!! test
Nesting of
!! wikitext
XYZ
!! html+tidy
XYZ
!! end
!! test
Nesting of
!! wikitext
XYZ
!! html+tidy
XYZ
!! end
!! test
Nesting of
!! wikitext
XYZ
!! html+tidy
XYZ
!! end
!! test
Nesting of
!! wikitext
XYZ
!! html
XYZ
!! end
!! test
Nesting of
!! wikitext
XYZ
!! html
XYZ
!! end
###
### Media links
###
!! test
Media link
!! wikitext
[[Media:Foobar.jpg]]
[[Media:Video.ogv]]
[[:Media:Video.ogv]]
!! html/php
!! end
# FIXME: this is still bad HTML tag nesting
# FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
# Parsoid & Remex fix the p-wrapping since they operate on the DOM.
!! test
Media link with nasty text
!! options
parsoid=wt2html,html2html
!! wikitext
[[Media:Foobar.jpg|Safe Link
!! end
!! test
Media link from missing resource (parsoid-only)
!! options
parsoid=html2wt
!! html/parsoid
Bat!
!! wikitext
[[Media:Foobar.jpg|Bat!]]
!! end
!! test
Media link from missing resource, localized (parsoid-only)
!! options
parsoid=html2wt
language=is
!! html/parsoid
Bat!
!! wikitext
[[Miðill:Foobar.jpg|Bat!]]
!! end
# This is a sanity test to ensure we don't crash or choke when given
# old cached 1.7.0 HTML for media links; we don't require that the
# result be "valid" because wt2wt was completely broken in 1.7.0
!! test
Media link from old 1.7.0 DOM spec (crash test, parsoid-only) T198511
!! options
parsoid=html2wt
!! html/parsoid
This is what Parsoid would emit (and we still handle this HTML fine):
But at least we don't crash when trying to handle the mangled HTML!
!! wikitext
This is what Parsoid would emit (and we still handle this HTML fine):
[[Media:Foobar.jpg|A neat file to look at]]
But VisualEditor would mangle the rel attribute, and give us back this:
[//example.com/images/3/3a/Foobar.jpg A neat file to look at]
But at least we don't crash when trying to handle the mangled HTML!
!! end
!! test
Media link to nonexistent file (T3702)
!! wikitext
[[Media:No such.jpg]]
[[Media:No_such file.jpg]]
!! html/php
!!end
!! article
אַ
!! text
Test for unicode normalization
The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
!! endarticle
!! test
(T21451) Links should refer to the normalized form.
!! wikitext
[[אַ]]
[[אַ]]
[[אַ]]
[[אַ]]
[[אַ]]
!! html
!! end
!! test
Empty attribute crash test (T4067)
!! wikitext
foo
!! html
foo
!! end
!! test
Empty attribute crash test single-quotes (T4067)
!! wikitext
foo
!! html
foo
!! end
!! test
Attribute test: equals, then nothing
!! options
parsoid=wt2html,html2html
!! wikitext
foo
!! html/php
foo
!! html/parsoid
foo
!! end
!! test
Attribute test: unquoted value
!! options
parsoid=wt2html,html2html
!! wikitext
foo
!! html/php
foo
!! html/parsoid
foo
!! end
!! test
Attribute test: unquoted but illegal value (hash)
!! wikitext
foo
!! html
foo
!! end
# Parsoid does not serialize to empty attribute syntax,
# so wt2wt and html2wt cases are skipped
!! test
Attribute test: no value (T54330)
!! options
parsoid=wt2html,html2html
!! wikitext
foo
!! html/php
foo
!! html/parsoid
foo
!! end
!! test
T4095: link with three closing brackets
!! wikitext
[[Main Page]]]
!! html/php
!! end
###
### Safety
###
!! article
Template:Dangerous attribute
!! text
" onmouseover="alert(document.cookie)
!! endarticle
!! article
Template:Dangerous style attribute
!! text
border-size: expression(alert(document.cookie))
!! endarticle
!! article
Template:Div style
!! text
Magic div
!! endarticle
!! test
T4304: HTML attribute safety (safe template; regression T4309)
!! wikitext
!! html/php
!! html/parsoid
!! end
# Parsoid has enough context to handle this case
!! test
T4304: HTML attribute safety (dangerous template; 2309)
!! wikitext
!! html/php
!! html/parsoid
!! end
!! test
T4304: HTML attribute safety (dangerous style template; 2309)
!! wikitext
!! html/php
!! html/parsoid
!! end
!! test
T4304: HTML attribute safety (safe parameter; 2309)
!! wikitext
{{div style|width: 200px}}
!! html/php
Magic div
!! html/parsoid
Magic div
!! end
!! test
T4304: HTML attribute safety (unsafe parameter; 2309)
!! wikitext
{{div style|width: expression(alert(document.cookie))}}
!! html/php
Magic div
!! html/parsoid
Magic div
!! end
## Parsoid output here differs; needs investigation.
!! test
T4304: HTML attribute safety (unsafe breakout parameter; 2309)
!! wikitext
{{div style|">}}
!! html
<script>alert(document.cookie)</script>">Magic div
!! end
## Parsoid output here differs; needs investigation.
!! test
T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
!! wikitext
{{div style|" >}}
!! html
<script>alert(document.cookie)</script>">Magic div
!! end
!! test
T4304: HTML attribute safety (link)
!! wikitext
!! html/php
!! html/parsoid
!! end
!! test
T4304: HTML attribute safety (italics)
!! wikitext
!! html
!! end
!! test
T4304: HTML attribute safety (bold)
!! wikitext
!! html
!! end
!! test
T4304: HTML attribute safety (ISBN)
!! wikitext
!! html
!! end
!! test
T4304: HTML attribute safety (RFC)
!! wikitext
!! html
!! end
!! test
T4304: HTML attribute safety (PMID)
!! wikitext
!! html
!! end
!! test
T4304: HTML attribute safety (web link)
!! wikitext
!! html
!! end
!! test
T4304: HTML attribute safety (named web link)
!! wikitext
!! html/php
!! html/parsoid
!! end
!! test
T5244: HTML attribute safety (extension; safe)
!! wikitext
!! html/php
!! html/parsoid
!! end
!! test
T5244: HTML attribute safety (extension; unsafe)
!! wikitext
!! html/php
!! html/parsoid
!! end
# More MSIE fun discovered by Tom Gilder
!! test
MSIE CSS safety test: spurious slash
!! wikitext
evil
!! html/php
evil
!! html/parsoid
evil
!! end
!! test
MSIE CSS safety test: hex code
!! wikitext
evil
!! html/php
evil
!! html/parsoid
evil
!! end
!! test
MSIE CSS safety test: comment in url
!! wikitext
evil
!! html/php
evil
!! html/parsoid
evil
!! end
!! test
MSIE CSS safety test: comment in expression
!! wikitext
evil4
!! html/php
evil4
!! html/parsoid
evil4
!! end
!! test
CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
!! wikitext
A
!! html/php
A
!! html/parsoid
A
!! end
!! test
Opera -o-link CSS
!! options
parsoid=wt2html,html2html
!! wikitext
X
!! html/php
X
!! html/parsoid
X
!! end
!! test
Table attribute legitimate extension
!! wikitext
{|
!+ style="color:blue"|status
|}
!! html
status
!! end
!! test
Table attribute safety
!! wikitext
{|
!+ style="border-width:expression(0+alert(document.cookie))"|status
|}
!! html
status
!! end
!! test
CSS line continuation 1
!! wikitext
!! html
!! end
!! test
CSS line continuation 2
!! wikitext
!! html
!! end
!! article
Template:Identity
!! text
{{{1}}}
!! endarticle
!! test
Expansion of multi-line templates in attribute values (T8255)
!! wikitext
-
!! html
-
!! end
!! test
Expansion of multi-line templates in attribute values (T8255 sanity check)
!! wikitext
-
!! html/php
-
!! html/parsoid
-
!! end
!! test
Expansion of multi-line templates in attribute values (T8255 sanity check 2)
!! wikitext
-
!! html
-
!! end
!! test
Tags which are hidden from tidiers cannot pass through the Sanitizer
!! wikitext
!! html+tidy
<mw:toc><script>alert();</script></mw:toc>
!! end
###
### Parser hooks (see tests/parser/ParserTestParserHook.php for the extension)
###
!! test
Parser hook: empty input
!! wikitext
!! html/php
''
array (
)
!! html/parsoid
!! end
## Don't expect parsoid to rt this form.
!! test
Parser hook: empty input using terminated empty elements
!! options
parsoid=wt2html,html2html
!! wikitext
!! html/php
NULL
array (
)
!! html/parsoid
!! end
!! test
Parser hook: empty input using terminated empty elements (space before)
!! wikitext
!! html/php
NULL
array (
)
!! html/parsoid
!! end
!! test
Parser hook: basic input
!! wikitext
input
!! html/php
'input'
array (
)
!! html/parsoid
!! end
## Don't expect parsoid to rt this form.
!! test
Parser hook: case insensitive
!! options
parsoid=wt2html,html2html
!! wikitext
input
!! html/php
'input'
array (
)
!! html/parsoid
!! end
## Don't expect parsoid to rt this form.
!! test
Parser hook: case insensitive, redux
!! options
parsoid=wt2html,html2html
!! wikitext
input
!! html/php
'input'
array (
)
!! html/parsoid
!! end
!! test
Parser hook: nested tags
!! options
parsoid=wt2html
!! wikitext
!! html/php+untidy
''
array (
)
</tag>
!! html/php+tidy
''
array (
)
</tag>
!! html/parsoid
</tag>
!! end
!! test
Parser hook: basic arguments
!! wikitext
!! html/php
!! html/parsoid
!! end
!! test
Parser hook: argument containing a forward slash (T7344)
!! wikitext
!! html/php
''
array (
'filename' => '/tmp/bla',
)
!! html/parsoid
!! end
## Don't expect parsoid to rt this form.
!! test
Parser hook: empty input using terminated empty elements (T4374)
!! options
parsoid=wt2html,html2html
!! wikitext
text
!! html/php
NULL
array (
'foo' => 'bar',
)
text
!! html/parsoid
text
!! end
## should be output literally since there is no matching tag that begins it
## Don't expect parsoid to rt this form.
!! test
Parser hook: basic arguments using terminated empty elements (T4374)
!! options
parsoid=wt2html
!! wikitext
other stuff
!! html/php
!! end
## Don't expect parsoid to rt this form.
!! test
Parser hook: Don't allow unclosed extension tags
!! options
parsoid=wt2html
!! wikitext
test 123
this is a '''test'''
!! html/php
test <tag>123
this is a test
!! html/parsoid
test <tag>123
this is a test
!! end
!! test
Parser hook: horizontal rule inside extension tag that outputs
!! wikitext
Hello
Goodbye
!! html/php
'
Hello
Goodbye
'
array (
)
!! end
###
### (see tests/parser/ParserTestParserHook.php for the extension)
###
!! test
Parser hook: static parser hook not inside a comment
!! wikitext
hello, world
!! html/php
hello, world
!! html/parsoid
hello, world
!! end
!! test
Parser hook: static parser hook inside a comment
!! wikitext
!! html/php
!! html/parsoid
!! end
# Nested template calls; this case was broken by Parser.php rev 1.506,
# since reverted.
!! article
Template:One-parameter
!! text
(My parameter is: {{{1}}})
!! endarticle
!! article
Template:Map-one-parameter
!! text
{{{{{1}}}|{{{2}}}}}
!! endarticle
!! test
Nested template calls
!! wikitext
{{Map-one-parameter|One-parameter|param}}
!! html
(My parameter is: param)
!! end
###
### Sanitizer
###
!! test
Sanitizer: Closing of open tags
!! wikitext
!! html/php+tidy
!! html/parsoid
!! end
# Legacy parser adds an extra newline (seen as a space) which Parsoid does not
!! test
Sanitizer: Closing of open but not closed tags
!! wikitext
foo
!! html/php
foo
!! html/parsoid
foo
!! end
!! test
Sanitizer: Closing of closed but not open tags
!! options
parsoid=wt2html
!! wikitext
!! html+tidy
!! end
!! test
Sanitizer: Closing of closed but not open table tags
!! options
parsoid=wt2html
!! wikitext
Table not started
!! html+tidy
Table not started
!! end
!! test
Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
!! options
title=[[Main Page]]
!! config
wgFragmentMode=[ 'html5', 'legacy' ]
!! wikitext
byte[[#æ: v|backlink]]
!! html/php
!! end
# In HTML5, the restrictions are that id must contain at least one character,
# and must not contain any space characters.
!! test
Sanitizer: Validating the contents of the id attribute (T6515)
!! options
disabled
!! wikitext
!! html
Something ...
!! end
# In HTML5, id must be unique amongst all the ids in the element's home subtree.
!! test
Sanitizer: Validating id attribute uniqueness (T6515, T8301)
!! options
disabled
!! wikitext
!! html
Something need to be done. foo-2 ?
!! end
!! test
Sanitizer: Validating that and work, but only for Microdata
!! wikitext
!! end
!! test
Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
!! wikitext
[[meatball:FooBar]]
[[meatball:Foo<bar]]
[[meatball:Foo>bar]]
!! html/php
!! end
!! test
Language converter: output gets cut off unexpectedly (T7757)
!! options
language=zh
!! wikitext
this bit is safe: }-
but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
then we get cut off here: }-
all additional text is vanished
!! html/php
this bit is safe: }-
but if we add a conversion instance: xxx
then we get cut off here: }-
all additional text is vanished
!! html/parsoid
this bit is safe: }-
but if we add a conversion instance:
then we get cut off here: }-
all additional text is vanished
!! end
!! test
Language converter glossary rules inside attributes (T119158)
!! options
language=sr variant=sr-el
!! wikitext
-{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
[[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
!! html/php
!! html/parsoid
!! end
!! test
Self closed html pairs (T7487)
!! wikitext
Centered text
In div text
!! html+tidy
Centered text
In div text
!! end
!! test
Punctuation: nbsp before exclamation
!! wikitext
C'est grave !
!! html
C'est grave !
!! end
!! test
Punctuation: CSS !important (T13874)
!! wikitext
important
!! html
important
!! end
!! test
Punctuation: CSS ! important (T13874; with space after)
!! wikitext
important
!! html
important
!! end
!! test
HTML bullet list, closed tags (T7497)
!! wikitext
One
Two
!! html/php
One
Two
!! html/parsoid
One
Two
!! end
!! test
HTML bullet list, unclosed tags (T7497)
!! wikitext
One
Two
!! html/php+tidy
One
Two
!! html/parsoid
One
Two
!! end
!! test
HTML ordered list, closed tags (T7497)
!! wikitext
One
Two
!! html/php
One
Two
!! html/parsoid
One
Two
!! end
!! test
HTML ordered list, unclosed tags (T7497)
!! options
!! wikitext
One
Two
!! html/php+tidy
One
Two
!! html/parsoid
One
Two
!! end
!! test
HTML nested bullet list, closed tags (T7497)
!! wikitext
One
Two:
Sub-one
Sub-two
!! html/php
One
Two:
Sub-one
Sub-two
!! html/parsoid
One
Two:
Sub-one
Sub-two
!! end
!! test
HTML nested bullet list, open tags (T7497)
!! wikitext
One
Two:
Sub-one
Sub-two
!! html+tidy
One
Two:
Sub-one
Sub-two
!! end
!! test
HTML nested ordered list, closed tags (T7497)
!! wikitext
One
Two:
Sub-one
Sub-two
!! html
One
Two:
Sub-one
Sub-two
!! end
!! test
HTML nested ordered list, open tags (T7497)
!! wikitext
One
Two:
Sub-one
Sub-two
!! html/php
One
Two:
Sub-one
Sub-two
!! html/parsoid
One
Two:
Sub-one
Sub-two
!! end
!! test
HTML ordered list item with parameters oddity
!! wikitext
One
!! html
One
!! end
# parsoid doesn't explicitly mark autonumbered links, see T55505
!!test
T7918: autonumbering
!! wikitext
[http://first/] [http://second] [ftp://ftp]
ftp://inlineftp
[mailto:enclosed@mail.tld With target]
[mailto:enclosed@mail.tld]
mailto:inline@mail.tld
!! html/php
!! end
#
# Security and HTML correctness
# From Nick Jenkins' fuzz testing
#
!! test
Fuzz testing: Parser13
!! wikitext
{|
| http://a|
!! html
!! end
# Note that Parsoid output differs from the PHP parser here: the PHP
# parser breaks the URL for the magic word, while in Parsoid the URL
# production takes precedence.
!! test
Fuzz testing: Parser14
!! wikitext
==onmouseover===
http://__TOC__
!! html/php+untidy
!! end
# The above 'Parser24' fuzz test exposed a tokenizer bug (T221384);
# this is a minimized version of the above test to catch regressions.
!! test
Fuzz testing: Parser24 (minimized)
!! options
parsoid=wt2html
!! wikitext
{{}}
!! html/php+tidy
{{}}
!! html/parsoid
{{}}
!! end
## Remex doesn't account for fostered content.
## Known to produce bad XML for now
!! test
Fuzz testing: Parser24
!! options
parsoid=wt2html
!! wikitext
{|
{{{|
}}}} >
MOVE YOUR MOUSE CURSOR OVER THIS TEXT
|
!! html/php+untidy
{{{|
}}}} >
MOVE YOUR MOUSE CURSOR OVER THIS TEXT
!! html/php+tidy
{{{|
}}}} >
MOVE YOUR MOUSE CURSOR OVER THIS TEXT
!! html/parsoid
{{{|
}}}} >
MOVE YOUR MOUSE CURSOR OVER THIS TEXT
!! end
# Note: the current result listed for this is not what the original one was,
# but the original bug was JavaScript injection, which is fixed in any case.
# It's not clear that the original result listed was any more correct than the
# current one. Original result:
#
{{{|
#
#
# }}}blah" onmouseover="alert('hello world');" align="left"MOVE MOUSE CURSOR OVER HERE
!!test
Fuzz testing: Parser25 (T8055)
!! wikitext
{{{
|
}}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
!! html/php
<LI CLASS=blah" onmouseover="alert('hello world');" align="left"MOVE MOUSE CURSOR OVER HERE
!! html/parsoid
<LI CLASS=blah" onmouseover="alert('hello world');" align="left"MOVE MOUSE CURSOR OVER HERE
!! end
!! test
Fuzz testing: image with bogus manual thumbnail
!! wikitext
[[Image:foobar.jpg|thumbnail= ]]
!! html/php
Error creating thumbnail:
!! html/parsoid
File:Foobar.jpg
!! end
# Parsoid will emit the newline literally in wt2wt; see next test case.
!! test
Fuzz testing: encoded newline in generated HTML replacements (T8577)
!! options
parsoid=wt2html
!! wikitext
!! html/php
!! html/parsoid
!! end
!! test
Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
!! options
parsoid=html2wt
!! html/parsoid
!! wikitext
!! html/php
!! end
!! test
Templates in extension attributes are not expanded
!! wikitext
!! html/php
!! html/parsoid
!! end
!! test
Parsing optional HTML elements (T8171)
!! options
!! wikitext
Some tabular data
More tabular data ...
And yet som tabular data
!! html
Some tabular data
More tabular data ...
And yet som tabular data
!! end
!! test
Correct handling of
,
(T8171)
!! options
!! wikitext
Some tabular data
More tabular data ...
And yet som tabular data
!! html
Some tabular data
More tabular data ...
And yet som tabular data
!! end
!! test
Parsing crashing regression (fr:JavaScript)
!! wikitext