tag in TOC, removed by Sanitizer (T92892)
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
__TOC__
==x==
!! html/php
s.
!! test
Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
!! options
parsoid=wt2html,html2html
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
===
The line above must have a trailing space!
===
But just in case it doesn't...
!! html/php
The line above must have a trailing space!
But just in case it doesn't...
!! html/parsoid
=
The line above must have a trailing space!
=
But just in case it doesn't...
!! end
!! test
Header with special characters (T27462)
!! config
wgParserEnableLegacyHeadingDOM=false
!! 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)
section 1
section 2
section 3
section 4
section 5
!! html/parsoid
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
!! config
wgParserEnableLegacyHeadingDOM=false
!! 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
Id should not contain + for spaces
section 1
Space-Entity between Text
[edit]
section 2
section 3
Plus-Entity+between+Text
[edit]
section 4
Underscore_between_Text
[edit]
section 5
Underscore-Entity_between_Text
[edit]
section 6
#Space between Text
#Space-Entity between Text
#Plus+between+Text
#Plus-Entity+between+Text
#Underscore_between_Text
#Underscore-Entity_between_Text
!! html/parsoid
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
!! end
# Parsoid html2wt disabled because it adds padding spaces around =
!! test
Headers with excess '=' characters
(Are similar tests necessary beyond the 1st level?)
!! options
parsoid=wt2html,wt2wt,html2html
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
=foo==
==foo=
=''italic'' heading==
==''italic'' heading=
!! html/php
!! html/parsoid
foo=
=foo
italic heading=
=italic heading
!! end
!! test
HTML headers vs TOC (T25393)
(__NOEDITSECTION__ for clearer output, doesn't matter here)
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
Header 1
==Header 1.1==
==Header 1.2==
Header 2
==Header 2.1==
==Header 2.2==
__NOEDITSECTION__
!! html/php
!! html/parsoid
!! end
!! test
Out-of-order TOC heading levels
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
==2==
======6======
===3===
=1=
=====5=====
==2==
!! html/php
!! html/parsoid
2
6
3
1
5
2
!! end
# Note that HTML (but not wikitext) allows the trailing semicolon to
# be omitted from an entity, so we need to escape the ampersand in
# situations where HTML would interpret a "semicolonless" entity.
!! test
TOC with HTML entities which are not wikitext entities (T355386)
!! config
wgFragmentMode=[ "html5" ]
wgParserEnableLegacyHeadingDOM=false
!! options
nohtml
showtocdata
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! wikitext
__TOC__
== F> ==
Test
!! metadata
Sections:
h2 index:1 toclevel:1 number:1 title:Parser_test off:8 anchor/linkAnchor:F> line:F>
!! end
# Note that the metadata section below contains non-breaking spaces around
# the french quotes, which also show up in the link anchor
!! test
TOC with french spacing (T324763)
!! config
wgFragmentMode=[ "html5" ]
wgParserEnableLegacyHeadingDOM=false
!! options
nohtml
showtocdata
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! wikitext
__TOC__
== Renommer la page « Informatique durable » en « Numérique responsable » ? ==
Oui.
!! metadata/php
Sections:
h2 index:1 toclevel:1 number:1 title:Parser_test off:8 anchor/linkAnchor:Renommer_la_page_«_Informatique_durable_»_en_«_Numérique_responsable_»_? line:Renommer la page « Informatique durable » en « Numérique responsable » ?
!! metadata/parsoid
Sections:
h2 index:1 toclevel:1 number:1 title:Parser_test off:8 anchor/linkAnchor:Renommer_la_page_«_Informatique_durable_»_en_«_Numérique_responsable_»_? line:Renommer la page « Informatique durable » en « Numérique responsable » ?
!! end
!! test
1. Ensure sections in extensions are ignored + TOC is inserted outside extensions
!! options
showtocdata
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
__FORCETOC__
==spantag h2==
intro
==page h2==
blah
!! html/php
intro
blah
!! html/parsoid
!! metadata
Sections:
h2 index:1 toclevel:1 number:1 title:Parser_test off:55 anchor/linkAnchor:page_h2 line:page h2
!! end
!! test
2. Ensure sections in extensions are ignored + TOC is inserted outside extensions
!! options
showtocdata
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
__FORCETOC__
{{1x|1=foo
==spantag h2==
}}
intro
==page h2==
blah
!! html/php
foo
intro
blah
!! html/parsoid
!! metadata
Sections:
h2 index:1 toclevel:1 number:1 title:Parser_test off:69 anchor/linkAnchor:page_h2 line:page h2
!! end
!! test
3. Ensure sections in extensions are ignored + TOC is inserted outside extensions
!! options
showtocdata
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
__FORCETOC__
{{1x|1=
==spantag h2==
==template h2==
}}
intro
==page h2==
blah
!! html/php
template h2
intro
blah
!! html/parsoid
!! metadata/php
Sections:
h2 index: toclevel:1 number:1 title:NULL off:NULL anchor/linkAnchor:template_h2 line:template h2
h2 index:2 toclevel:1 number:2 title:Parser_test off:81 anchor/linkAnchor:page_h2 line:page h2
!! metadata/parsoid
Sections:
h2 index:T-1 toclevel:1 number:1 title:Template:1x off:NULL anchor/linkAnchor:template_h2 line:template h2
h2 index:2 toclevel:1 number:2 title:Parser_test off:81 anchor/linkAnchor:page_h2 line:page h2
!! end
!! test
TOC data when heading content is equal to an id already set on the page
!! options
showtocdata
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
hiho
=== hiho ===
!! html/php
hiho
!! metadata/php
Sections:
h3 index:1 toclevel:1 number:1 title:Parser_test off:28 anchor/linkAnchor:hiho line:hiho
!! html/parsoid
!! metadata/parsoid
Sections:
h3 index:1 toclevel:1 number:1 title:Parser_test off:28 anchor/linkAnchor:hiho_2 line:hiho
!! end
!! test
TOC data when heading already has an id
!! options
showtocdata
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
odd
!! html/php
odd
!! html/parsoid
!! metadata
Sections:
h3 index: toclevel:1 number:1 title:NULL off:NULL anchor/linkAnchor:asdf line:odd
!! end
!! test
Extra newlines followed by heading
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
a
=b=
[[a]]
=b=
!! html
a
a
!! end
!! article
A
!! text
Dummy article to suppress redlinks in tests
!! end
!! test
Extra newlines between heading and content are swallowed (Parsoid does not)
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
=b=
[[a]]
!! html/php
a
!! html/parsoid
b
a
!! end
!! test
Heading with line break in nowiki
!! options
parsoid=wt2html
!! config
wgFragmentMode=[ "html5", "legacy" ]
wgParserEnableLegacyHeadingDOM=false
!! wikitext
==A B
C==
!! html/php
!! html/parsoid
A B
C
!! end
!! test
Heading with nonbreaking space in prefix/suffix (T235684)
!! options
parsoid=wt2html,html2html
!! config
wgFragmentMode=[ "html5", "legacy" ]
wgParserEnableLegacyHeadingDOM=false
!! wikitext
== A B ==
!! html/php
!! html/parsoid
A B
!! end
!! test
Heading with literal wikitext - the wikitext is not parsed in section edit link tooltip
!! config
wgFragmentMode=[ "html5" ]
wgParserEnableLegacyHeadingDOM=false
!! wikitext
== {{PAGENAME}} ==
== {{PAGENAME}} ==
!! html/php
!! end
!! article
Template:Includeonly section
!! text
==Includeonly section==
==Section T-1==
!!endarticle
!! test
T8563: Edit link generation for section shown by
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
{{includeonly section}}
!! html
Includeonly section
[edit]
!! end
!! test
T8563: Edit link generation for section suppressed by
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
==Includeonly section==
==Section 1==
!! 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
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
==onmouseover===
http://__TOC__
!! html/php
http://
!! html/parsoid
onmouseover=
http://__TOC__
!! end
!! test
Fuzz testing: Parser14-table
!! options
parsoid=wt2html,html2html
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
==a==
{| STYLE=__TOC__
!! html/php
!! html/parsoid
a
!! end
!! article
MediaWiki:Fake
!! text
==header==
!! endarticle
!! test
Inclusion of !userCanEdit() content
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
{{MediaWiki:Fake}}
!! html
!! end
!! test
Morwen/13: Unclosed link followed by heading
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
[[link
==heading==
!! html
[[link
!! end
!! test
HHP2.1: Heuristics for headings in preprocessor parenthetical structures
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
{{foo|
=heading=
!! html
{{foo|
heading
!! end
!! test
HHP2.2: Heuristics for headings in preprocessor parenthetical structures
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
{{foo|
==heading==
!! html
{{foo|
!! end
!!article
Foo
!!text
FOO
!!endarticle
!! test
nowiki inside link inside heading (T20295)
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
==[[foo|xyz]]==
!! html
!! end
!! test
Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
!! config
wgFragmentMode=[ "html5", "legacy" ]
wgParserEnableLegacyHeadingDOM=false
!! options
showtocdata
parsoid={
"wrapSections": true
}
!! wikitext
==A&B&C&D&amp;E==
[[#A&B&C&D&amp;E]]
!! html/php
A&B&C&D&amp;E
[edit]
#A&B&C&D&amp;E
!! html/parsoid
!! metadata
Sections:
h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:A&B&C&D&E line:A&B&C&D&amp;E
!! end
!! test
Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
!! config
wgFragmentMode=[ "legacy" ]
wgParserEnableLegacyHeadingDOM=false
!! wikitext
==A&B&C&D&amp;E==
[[#A&B&C&D&amp;E]]
!! html/php
A&B&C&D&amp;E
[edit]
#A&B&C&D&amp;E
!! end
# This fragment mode is what Parsoid supports.
!! test
HTML5 ids: fallback to legacy
!! config
wgFragmentMode=[ "html5", "legacy" ]
wgParserEnableLegacyHeadingDOM=false
!! wikitext
==Foo bar==
==foo Bar==
==Тест==
==Тест==
==тест==
==Hey < # " > % : '==
[[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
{{anchorencode:💩}}
[[#啤酒]] [[#%E5%95%A4%E9%85%92]]
!! html/php
#Foo bar #foo Bar #Тест #тест #Hey < # " > % : '
💩
#啤酒 #啤酒
!! html/parsoid
Foo bar
foo Bar
Тест
Тест
тест
Hey < # " > % : '
#Foo bar #foo Bar #Тест #тест #Hey < # " > % : '
💩
#啤酒 #啤酒
!! end
# Parsoid doesn't support this mode
!! test
HTML5 ids: legacy with a fallback to modern
!! config
wgFragmentMode=[ "legacy", "html5" ]
wgParserEnableLegacyHeadingDOM=false
!! wikitext
==Foo bar==
==foo Bar==
==Тест==
==Тест==
==тест==
==Hey < # " > % : '==
[[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
{{anchorencode:💩}}
[[#啤酒]] [[#%E5%95%A4%E9%85%92]]
!! html/php
#Foo bar #foo Bar #Тест #тест #Hey < # " > % : '
.F0.9F.92.A9
#啤酒 #啤酒
!! end
# Parsoid doesn't support this mode.
!! test
HTML5 ids: no legacy
!! config
wgFragmentMode=[ "html5" ]
wgParserEnableLegacyHeadingDOM=false
!! wikitext
==Foo bar==
==foo Bar==
==Тест==
==Тест==
==тест==
==Hey < # " > % : '==
[[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
{{anchorencode:💩}}
[[#啤酒]] [[#%E5%95%A4%E9%85%92]]
!! html/php
#Foo bar #foo Bar #Тест #тест #Hey < # " > % : '
💩
#啤酒 #啤酒
!! end
!! test
T90902: Normalize weird characters in section IDs
!! config
wgFragmentMode=[ "html5", "legacy" ]
wgParserEnableLegacyHeadingDOM=false
!! wikitext
==Foo bar==
[[#Foo bar]]
!! html/php
#Foo bar
!! html/parsoid
Foo bar
#Foo bar
!! end
!! test
mw-heading wrapper edge cases
!! options
notoc
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
==Normal heading!==
HTML heading!
HTML heading with attributes!
==Normal heading with existing wrapper!==
!! html/php
HTML heading!
HTML heading with attributes!
Normal heading with existing wrapper!
[edit]
!! html/parsoid
Normal heading!
HTML heading!
HTML heading with attributes!
Normal heading with existing wrapper!
!! end
!! test
T365413: Headings with dollar signs
!! options
wgParserEnableLegacyHeadingDOM=false
!! wikitext
==$text==
==$ text==
==text $text==
==\$text==
==$$text==
!! html/php
text $text[edit]
!! end
!! article
Template:With a section?
!! text
=== test ===
!! endarticle
!! test
T368334: Headings from template titles that would need uri encoding
!! options
showtocdata
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
{{With a section?}}
!! html/php
!! html/parsoid
!! metadata
Sections:
h3 index:T-1 toclevel:1 number:1 title:Template:With_a_section? off:NULL anchor/linkAnchor:test line:test
!! end
!! article
Template:With one
!! text
=== in ===
123
!! endarticle
!! article
Template:With two
!! text
=== in 2 ===
456
=== in 3 ===
789
!! endarticle
!! test
Reset section numbering per template
!! options
nohtml
showtocdata
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
=== out ===
123
{{with one}}
=== out 2 ===
456
{{with two}}
{{with one}}
!! metadata
Sections:
h3 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:out line:out
h3 index:T-1 toclevel:1 number:2 title:Template:With_one off:NULL anchor/linkAnchor:in line:in
h3 index:2 toclevel:1 number:3 title:Parser_test off:31 anchor/linkAnchor:out_2 line:out 2
h3 index:T-1 toclevel:1 number:4 title:Template:With_two off:NULL anchor/linkAnchor:in_2 line:in 2
h3 index:T-2 toclevel:1 number:5 title:Template:With_two off:NULL anchor/linkAnchor:in_3 line:in 3
h3 index:T-1 toclevel:1 number:6 title:Template:With_one off:NULL anchor/linkAnchor:in_4 line:in
!! end
!! article
Template:With heading nesting
!! text
=== in 4 ===
lala
{{with two}}
!! endarticle
## FIXME: Parsoid doesn't have insight into nested templates
!! test
Nested section numbering
!! options
nohtml
showtocdata
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
=== out ===
123
{{with heading nesting}}
!! metadata
Sections:
h3 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:out line:out
h3 index:T-1 toclevel:1 number:2 title:Template:With_heading_nesting off:NULL anchor/linkAnchor:in_4 line:in 4
h3 index:T-1 toclevel:1 number:3 title:Template:With_two off:NULL anchor/linkAnchor:in_2 line:in 2
h3 index:T-2 toclevel:1 number:4 title:Template:With_two off:NULL anchor/linkAnchor:in_3 line:in 3
!! end
!! article
Template:With redirect
!! text
#REDIRECT [[Template:With one]]
!! endarticle
!! test
Sections follow template redirects
!! options
nohtml
showtocdata
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! config
wgParserEnableLegacyHeadingDOM=false
!! wikitext
{{with redirect}}
!! metadata
Sections:
h3 index:T-1 toclevel:1 number:1 title:Template:With_one off:NULL anchor/linkAnchor:in line:in
!! end