# This file has tests to verify the following: # - TOC section metadata output for wikitext snippets # - Behavior of various *toc* magic words # - Various edge cases related to heading parsing and TOC behavior # (special chars, language variants, entities, bdi chars, etc.) # # NOTE about data-parsoid in html/parsoid # - html/parsoid sections have data-parsoid="{}" to eliminate unnecessary # html2wt failures because of normalization # - We could strip them eithre by marking those tests wt2html, wt2wt only !! options version=2 parsoid-compatible=wt2html,wt2wt !! end !! article Main Page !! text blah blah !! endarticle !! article Template:1x !! text {{{1}}} !! endarticle !! article Template:Test !! text ==th2== ===th2.1=== !! endarticle !! test Basic test !! options nohtml showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==h1== ===h1.1=== ==h2== ===h2.1=== ====h2.1.1==== ===h2.2=== ====h2.2.1==== ====h2.2.2==== ==h3== !! metadata Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:h1 line:h1 h3 index:2 toclevel:2 number:1.1 title:Parser_test off:7 anchor/linkAnchor:h1.1 line:h1.1 h2 index:3 toclevel:1 number:2 title:Parser_test off:18 anchor/linkAnchor:h2 line:h2 h3 index:4 toclevel:2 number:2.1 title:Parser_test off:25 anchor/linkAnchor:h2.1 line:h2.1 h4 index:5 toclevel:3 number:2.1.1 title:Parser_test off:36 anchor/linkAnchor:h2.1.1 line:h2.1.1 h3 index:6 toclevel:2 number:2.2 title:Parser_test off:51 anchor/linkAnchor:h2.2 line:h2.2 h4 index:7 toclevel:3 number:2.2.1 title:Parser_test off:62 anchor/linkAnchor:h2.2.1 line:h2.2.1 h4 index:8 toclevel:3 number:2.2.2 title:Parser_test off:77 anchor/linkAnchor:h2.2.2 line:h2.2.2 h2 index:9 toclevel:1 number:3 title:Parser_test off:92 anchor/linkAnchor:h3 line:h3 !! end !! test HTML headings should get TOC entries with some empty properties !! options nohtml showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==a==

b

c

===d===

e

!! metadata Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:a line:a h2 index: toclevel:1 number:2 title:NULL off:NULL anchor/linkAnchor:b line:b h3 index: toclevel:2 number:2.1 title:NULL off:NULL anchor/linkAnchor:c line:c h3 index:2 toclevel:2 number:2.2 title:Parser_test off:28 anchor/linkAnchor:d line:d h2 index: toclevel:1 number:3 title:NULL off:NULL anchor/linkAnchor:e line:e !! end !! test Literal html heading from template !! options showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext {{1x|

hi

ho }} !! html/php

hi

ho

!! html/parsoid

hi

ho

!! metadata Sections: h2 index: toclevel:1 number:1 title:NULL off:NULL anchor/linkAnchor:hi line:hi !! end !! test Duplicate headings should get unique anchors !! options nohtml showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==a== ==a== ==b== !! metadata Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:a line:a h2 index:2 toclevel:1 number:2 title:Parser_test off:6 anchor/linkAnchor:a_2 line:a h2 index:3 toclevel:1 number:3 title:Parser_test off:12 anchor/linkAnchor:b line:b !! end !! test Templated sections (heading from template content) !! options nohtml showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==a== {{Test}} !! metadata Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:a line:a h2 index:T-1 toclevel:1 number:2 title:Template:Test off:NULL anchor/linkAnchor:th2 line:th2 h3 index:T-2 toclevel:2 number:2.1 title:Template:Test off:NULL anchor/linkAnchor:th2.1 line:th2.1 !! end !! test Ensure headings with html tags get the right anchors !! options nohtml showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==x== ==y== !! metadata Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:x line:x h2 index:2 toclevel:1 number:2 title:Parser_test off:19 anchor/linkAnchor:y line:y !! end !! test Ensure unallowed tag wrappers in headings get stripped !! options nohtml showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==
b
== ==c== !! metadata Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:b line:b h2 index:2 toclevel:1 number:2 title:Parser_test off:17 anchor/linkAnchor:c line:c !! end !! test Ensure disallowed attributes are stripped, but dir attribute in a span is left behind !! options nohtml showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==a== ==b== ==c== !! metadata Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:a line:a h2 index:2 toclevel:1 number:2 title:Parser_test off:39 anchor/linkAnchor:b line:b h2 index:3 toclevel:1 number:3 title:Parser_test off:78 anchor/linkAnchor:c line:c !! end # Legacy parser behavior is broken. Parsoid's output is correct. !! test Ensure empty tags are stripped !! options nohtml showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==
x== ==y== !! metadata/php Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:x line:x h2 index:2 toclevel:1 number:2 title:Parser_test off:30 anchor/linkAnchor:y line:y !! metadata/parsoid Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:x line:x h2 index:2 toclevel:1 number:2 title:Parser_test off:30 anchor/linkAnchor:y line:y !! end !! test Ensure comments in toc lines are stripped !! config wgRawHtml=1 wgParserEnableLegacyHeadingDOM=false !! options nohtml showtocdata !! wikitext ==hi== !! metadata/php Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:hi line:hi !! end !! test Handle links in heading content !! options nohtml showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==[[Cat]]== ==[[Dog]]s== ==[[Cat|I love my ''cat'']]== !! metadata Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:Cat line:Cat h2 index:2 toclevel:1 number:2 title:Parser_test off:12 anchor/linkAnchor:Dogs line:Dogs h2 index:3 toclevel:1 number:3 title:Parser_test off:25 anchor/linkAnchor:I_love_my_cat line:I love my cat !! end # Parsoid uses HTML5 semantics for anchors as the default. # Legacy parser tests require wgFragmentMode=[ "html5" ] for the same # behavior, which isn't (yet) the default in ParserTestRunner !! test Ensure headings with special chars get the right anchors !! options nohtml showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgFragmentMode=[ "html5", "legacy" ] wgParserEnableLegacyHeadingDOM=false !! wikitext ===a= =''x''= !! metadata Sections: h1 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:==a line:==a h1 index:2 toclevel:1 number:2 title:Parser_test off:6 anchor/linkAnchor:x line:x !! end # For heading that come from template args, core, Parsoid-standalone, and # Parsoid-integrate different in ther "index" output. # # - For templated sections, Parsoid and core differ in some of the metadata. # Parsoid doesn't distinguish between sections that come from template args # and from templated content - it treats them all as template-generated headings. # But core does not consider headings from template-args as "inTemplate", but # 'fromtitle' is set to false even so. # # - Parsoid's behavior is more consistent wrt templates. But, this is potentially # a breaking change for users of TOC data. The index for templated # content is used to generate section edit links for content coming # from a template, and in updating the appropriate article when that # section is saved. So this is potentially a breaking change when # Parsoid starts to generate section edit links, and possible one # which could cause db corruption. # # - Additionally, heading-index is reset in integrated mode because templates are # processed by core preprocessor whereas in native preprocessing mode (used by # parsertests), the heading index is not reset. # - See also T222419. !! test Templated sections (heading from template arg) !! options nohtml showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==a== {{1x|1= ==b== }} !! metadata/php Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:a line:a h2 index: toclevel:1 number:2 title:NULL off:NULL anchor/linkAnchor:b line:b !! metadata/parsoid+integrated Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:a line:a h2 index:T-1 toclevel:1 number:2 title:Template:1x off:NULL anchor/linkAnchor:b line:b !! metadata/parsoid+standalone Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:a line:a h2 index:T-2 toclevel:1 number:2 title:Template:1x off:NULL anchor/linkAnchor:b line:b !! end !! test Handle extension content in section headers properly (non-Cite version) !! config wgFragmentMode=[ "html5", "legacy" ] wgParserEnableLegacyHeadingDOM=false !! options nohtml showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! wikitext ==cd== !! metadata Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:c'd'_array_(_) line:"c'd'\narray (\n)" !! end !! test Offsets in toc metadata should be unicode codepoints, not bytes or UCS-2 !! config wgFragmentMode=[ "html5", "legacy" ] wgParserEnableLegacyHeadingDOM=false !! options parsoid={ "modes": [ "wt2html" ], "wrapSections": true } showtocdata nohtml !! wikitext ==One 💩== ==Two 💩== ==Three 💩== !! metadata Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:One_💩 line:One 💩 h2 index:2 toclevel:1 number:2 title:Parser_test off:10 anchor/linkAnchor:Two_💩 line:Two 💩 h2 index:3 toclevel:1 number:3 title:Parser_test off:20 anchor/linkAnchor:Three_💩 line:Three 💩 !! end !! test Handle multi-part content transclusion blocks !! options nohtml showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext
{{1x|1= ==foo==
}} ==bar== !! metadata Sections: h2 index: toclevel:1 number:1 title:NULL off:NULL anchor/linkAnchor:foo line:foo h2 index:2 toclevel:1 number:2 title:Parser_test off:32 anchor/linkAnchor:bar line:bar !! end # Parsoid's parser function implementation used for standalone testing # is incomplete and only used in parser tests. # So, use HTML h-tags instead of wikitext h-tags in the parser function # to let us run this test in both standalone and integrated modes. !! test Handle parser functions generating sections !! options nohtml showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext {{#if:1|

foo

|unused}} ==bar== !! metadata Sections: h2 index: toclevel:1 number:1 title:NULL off:NULL anchor/linkAnchor:foo line:foo h2 index:1 toclevel:1 number:2 title:Parser_test off:30 anchor/linkAnchor:bar line:bar !! end !! test Handle top-level template args generating sections !! options nohtml showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext {{{foo| ==tplarg== |abcd}}} !! metadata Sections: h2 index: toclevel:1 number:1 title:NULL off:NULL anchor/linkAnchor:tplarg line:tplarg !! end ### ### Sections ### !! test Basic section headings !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==Headline 1== Some text ==Headline 2== More ===Smaller headline=== Blah blah !! html

Headline 1

[edit]

Some text

Headline 2

[edit]

More

Smaller headline

[edit]

Blah blah

!! end !! test Section headings with TOC !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==Headline 1== ===Subheadline 1=== =====Skipping a level===== ======Skipping a level====== ==Headline 2== Some text ===Another headline=== !! html/php

Headline 1

[edit]

Subheadline 1

[edit]
Skipping a level
[edit]
Skipping a level
[edit]

Headline 2

[edit]

Some text

Another headline

[edit]
!! html/parsoid

Headline 1

Subheadline 1

Skipping a level
Skipping a level

Headline 2

Some text

Another headline

!! end !! test Section headings with TOC and language conversion (T295187, T306862) !! config wgUsePigLatinVariant=true wgParserEnableLegacyHeadingDOM=false !! options language=en htmlVariantLanguage=en-x-piglatin !! wikitext ==Headline 1== ===Subheadline 1=== ==Headline 2== Some text ===Another headline=== !! html/php

Eadlinehay 1

[edit]

Ubheadlinesay 1

[edit]

Eadlinehay 2

[edit]

Omesay exttay

Anotherway eadlinehay

[edit]
!! html/parsoid

Headline 1

Subheadline 1

Headline 2

Some text

Another headline

!! end # Note that even though conversion of the *content* is disabled, the # user interface messages (aka the TOC title) are still in the user's # preferred UX variant (that is, pig latin). !! test Section headings with TOC and language conversion disabled (T295187) !! config wgUsePigLatinVariant=true wgParserEnableLegacyHeadingDOM=false !! options language=en htmlVariantLanguage=en-x-piglatin !! wikitext ==Headline 1== ===Subheadline 1=== ==Headline 2== Some text ===Another headline=== __NOCONTENTCONVERT__ !! html/php

Headline 1

[edit]

Subheadline 1

[edit]

Headline 2

[edit]

Some text

Another headline

[edit]
!! html/parsoid

Headline 1

Subheadline 1

Headline 2

Some text

Another headline

!! end # The -{T}- below checks for regressions in T26072: the contents of # the displaytitle should not be double-converted. That is, we want # the title to end up as 'Bar' not 'Ball' (aka converted by the -{H}- # rule immediately preceding it). !! test Section headings with TOC, language conversion rules, and displaytitle (T306862, T331316, T26072) !! config wgUsePigLatinVariant=true wgRestrictDisplayTitle=false wgParserEnableLegacyHeadingDOM=false !! options language=en htmlVariantLanguage=en-x-piglatin showtitle showtocdata parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! wikitext -{H|Foo=>en:Boo;Foo=>en-x-piglatin:Bob;}--{H|Bar=>en:Bat;Bar=>en-x-piglatin:Ball;}--{T|en:Foo;en-x-piglatin:Bar;}- Introduction. -{A|en:Do; en-x-piglatin:Re;}- == Foo == Foo Do == Bar == Bar Re == -{Foo Bar}- == !! metadata Bar Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:192 anchor/linkAnchor:Foo line:Bob h2 index:2 toclevel:1 number:2 title:Parser_test off:209 anchor/linkAnchor:Bar line:Ball h2 index:3 toclevel:1 number:3 title:Parser_test off:226 anchor/linkAnchor:-.7BFoo_Bar.7D- line:Foo Bar !! html/php

Introductionway. Re

Bob

[edit]

Bob Re

Ball

[edit]

Ball Eray

Foo Bar

[edit]
!! html/parsoid+standalone

-{H|Foo=>en:Boo;Foo=>en-x-piglatin:Bob;}--{H|Bar=>en:Bat;Bar=>en-x-piglatin:Ball;}--{T|en:Foo;en-x-piglatin:Bar;}- Introduction. -{A|en:Do; en-x-piglatin:Re;}-

Foo

Foo Do

Bar

Bar Re

-{Foo Bar}-

!! html/parsoid+integrated

Introduction.

Foo

Foo Do

Bar

Bar Re

!! end !! test TOC anchors don't collide !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __FORCETOC__ ==Headline 2== ==Headline== ==Headline 2== ==Headline== !! html/php

Headline 2

[edit]

Headline

[edit]

Headline 2

[edit]

Headline

[edit]
!! end # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10' # Parsoid html2wt direction adds for level 7 and up. !! test Handling of sections up to level 6 and beyond !! options parsoid=wt2html !! config wgParserEnableLegacyHeadingDOM=false !! wikitext =Level 1 Heading= ==Level 2 Heading== ===Level 3 Heading=== ====Level 4 Heading==== =====Level 5 Heading===== ======Level 6 Heading====== =======Level 7 Heading======= ========Level 8 Heading======== =========Level 9 Heading========= ==========Level 10 Heading========== !! html/php

Level 1 Heading

[edit]

Level 2 Heading

[edit]

Level 3 Heading

[edit]

Level 4 Heading

[edit]
Level 5 Heading
[edit]
Level 6 Heading
[edit]
=Level 7 Heading=
[edit]
==Level 8 Heading==
[edit]
===Level 9 Heading===
[edit]
====Level 10 Heading====
[edit]
!! html/parsoid

Level 1 Heading

Level 2 Heading

Level 3 Heading

Level 4 Heading

Level 5 Heading
Level 6 Heading
=Level 7 Heading=
==Level 8 Heading==
===Level 9 Heading===
====Level 10 Heading====
!! end !! test TOC regression (T11764) !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==title 1== ===title 1.1=== ====title 1.1.1==== ===title 1.2=== ==title 2== ===title 2.1=== !! html/php

title 1

[edit]

title 1.1

[edit]

title 1.1.1

[edit]

title 1.2

[edit]

title 2

[edit]

title 2.1

[edit]
!! html/parsoid

title 1

title 1.1

title 1.1.1

title 1.2

title 2

title 2.1

!! end !! test TOC for heading containing (T96153) !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __FORCETOC__ ==New title== !! html/php

New title

[edit]
!! end !! test TOC with wgMaxTocLevel=3 (T8204) !! options wgMaxTocLevel=3 !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==title 1== ===title 1.1=== ====title 1.1.1==== ===title 1.2=== ==title 2== ===title 2.1=== !! html/php

title 1

[edit]

title 1.1

[edit]

title 1.1.1

[edit]

title 1.2

[edit]

title 2

[edit]

title 2.1

[edit]
!! html/parsoid

title 1

title 1.1

title 1.1.1

title 1.2

title 2

title 2.1

!! end !! test TOC with wgMaxTocLevel=3 and two level four headings (T8204) !! options wgMaxTocLevel=3 !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==Section 1== ===Section 1.1=== ====Section 1.1.1==== ====Section 1.1.1.1==== ==Section 2== !! html/php

Section 1

[edit]

Section 1.1

[edit]

Section 1.1.1

[edit]

Section 1.1.1.1

[edit]

Section 2

[edit]
!! html/parsoid

Section 1

Section 1.1

Section 1.1.1

Section 1.1.1.1

Section 2

!! end !! test Resolving duplicate section names !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==Foo bar== ==Foo bar== !! html

Foo bar

[edit]

Foo bar

[edit]
!! end !! test Resolving duplicate section names with differing case (T12721) !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==Foo bar== ==Foo Bar== !! html

Foo bar

[edit]

Foo Bar

[edit]
!! end !! article Template:sections !! text ===Section 1=== ==Section 2== !! endarticle !! test Template with sections, __NOTOC__ !! options showflags parsoid={ "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __NOTOC__ ==Section 0== {{sections}} ==Section 4== !! metadata flags=no-toc !! html/php

Section 0

[edit]

Section 1

[edit]

Section 2

[edit]

Section 4

[edit]
!! html/parsoid

Section 0

Section 1

Section 2

Section 4

!! end !! test T307691: show-toc flag: no sections !! options showflags parsoid={ "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext !! metadata flags= !! html !! html/parsoid
!! end # You can't force a TOC if there aren't any sections !! test T307691: show-toc flag: no sections, but __FORCETOC__ !! options showflags parsoid={ "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __FORCETOC__ !! metadata flags= !! html/php !! html/parsoid
!! end # Placing a manual __TOC__ doesn't do anything if there aren't any sections !! test T307691: show-toc flag: no sections, but __TOC__ !! options showflags parsoid={ "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __TOC__ !! metadata flags= !! html/php !! html/parsoid
!! end !! test T307691: show-toc flag: no sections, and __NOTOC__ !! options showflags parsoid={ "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __NOTOC__ !! metadata flags= !! html/php !! html/parsoid
!! end !! test T307691: show-toc flag: not "enough" sections !! options showflags parsoid={ "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext == One == !! metadata flags= !! html/php

One

[edit]
!! html/parsoid

One

!! end !! test T352467: synthetic sections shouldn't count towards "enough" sections !! options showflags parsoid={ "modes": [ "wt2html" ], "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext
==a== ==b==
==c== !! metadata flags= !! html/php

a

[edit]

b

[edit]

c

[edit]
!! html/parsoid

a

b

c

!! end !! test T307691: show-toc flag: not "enough" sections, but __FORCETOC__ !! options showflags parsoid={ "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __FORCETOC__ == One == !! metadata flags=show-toc !! html/php

One

[edit]
!! html/parsoid

One

!! end !! test T307691: show-toc flag: not "enough" sections, but __TOC__ !! options showflags parsoid={ "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext == One == __TOC__ !! metadata flags=show-toc !! html/php

One

[edit]
!! html/parsoid

One

!! end !! test T307691: show-toc flag: not "enough" sections, and __NOTOC__ !! options showflags parsoid={ "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __NOTOC__ == One == !! metadata flags=no-toc !! html/php

One

[edit]
!! html/parsoid

One

!! end !! test T307691: show-toc flag: "enough" sections !! options showflags parsoid={ "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext == One == === Two === == Three == === Four === !! metadata flags=show-toc !! html/php

One

[edit]

Two

[edit]

Three

[edit]

Four

[edit]
!! html/parsoid

One

Two

Three

Four

!! end !! test T307691: show-toc flag: "enough" sections and __FORCETOC__ !! options showflags parsoid={ "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __FORCETOC__ == One == === Two === == Three == === Four === !! metadata flags=show-toc !! html/php

One

[edit]

Two

[edit]

Three

[edit]

Four

[edit]
!! html/parsoid

One

Two

Three

Four

!! end !! test T307691: show-toc flag: "enough" sections and __NOTOC__ !! options showflags parsoid={ "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __NOTOC__ == One == === Two === == Three == === Four === !! metadata flags=no-toc !! html/php

One

[edit]

Two

[edit]

Three

[edit]

Four

[edit]
!! html/parsoid

One

Two

Three

Four

!! end ## Note that the legacy parser doesn't set the flag. It instead uses the presence ## of the behavior switch to inhibit the creation of the placeholders that would ## get replaced with the section edit links. !! test __NOEDITSECTION__ keyword !! options showflags parsoid={ "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __NOEDITSECTION__ ==Section 1== ==Section 2== !! html/php

Section 1

Section 2

!! metadata/php flags= !! html/parsoid

Section 1

Section 2

!! metadata/parsoid flags=no-section-edit-links !! end !! test Link inside a section heading !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==Section with a [[Main Page|link]] in it== !! html
[edit]
!! end !! test TOC regression (T14077) !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __TOC__ ==title 1== ===title 1.1=== ==title 2== !! html/php

title 1

[edit]

title 1.1

[edit]

title 2

[edit]
!! html/parsoid

title 1

title 1.1

title 2

!! end # test added in 4e717c01589378893c98e333884315c166c217b3 # __FORCETOC__ won't set show-toc if there are no sections # present to show; also test that __NEWSECTIONLINK__ results in the # proper ParserOutputFlag being set. !! test __FORCETOC__ override !! options showflags parsoid={ "wrapSections": true } !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __NEWSECTIONLINK__ __FORCETOC__ !! metadata flags=mw-NewSection !! html/php


!! html/parsoid
!! end # Note that Parsoid doesn't emit an explicit TOC. # Note also that the html2wt direction tends to emit an extra newline # between the __TOC__ magicword and the first heading unless *both* # the and the

have a data-parsoid attribute set (even if # it's "{}"). !! test T28375: TOC with italics !! options title=[[Main Page]] !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __TOC__ ==''Lost'' episodes== !! html/php

Lost episodes

[edit]
!! html/parsoid

Lost episodes

!! end !! test T28375: TOC with bold !! options title=[[Main Page]] !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __TOC__ =='''should be bold''' then normal text== !! html/php

should be bold then normal text

[edit]
!! html/parsoid

should be bold then normal text

!! end !! test T35845: Headings become cursive in TOC when they contain an image !! options title=[[Main Page]] !! config wgParserEnableLegacyMediaDOM=false wgParserEnableLegacyHeadingDOM=false !! wikitext __TOC__ ==Image [[Image:foobar.jpg]]== !! html/php

Image

[edit]
!! html/parsoid

Image

!! end !! test T35845 (2): Headings become bold in TOC when they contain a blockquote !! options title=[[Main Page]] !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __TOC__ ==
Quote
== !! html/php

Quote

[edit]
!! html/parsoid

Quote

!! end !! test Unclosed tags in TOC !! config wgFragmentMode=[ "html5", "legacy" ] wgParserEnableLegacyHeadingDOM=false !! options title=[[Main Page]] !! wikitext __TOC__ ==Proof: 2 < 3== Hanc marginis exiguitas non caperet. QED !! html/php

Proof: 2 < 3

[edit]

Hanc marginis exiguitas non caperet. QED

!! html/parsoid

Proof: 2 < 3

Hanc marginis exiguitas non caperet. QED

!! end !! test Multiple tags in TOC !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __TOC__ ==Foo Bar== ==Foo
Bar
== !! html/php

Foo Bar

[edit]

Foo

Bar

[edit]
!! html/parsoid

Foo Bar

Foo

Bar

!! end # Don't expect Parsoid to roundtrip this until the php parser comes closer to # html5 tag parsing. !! test Tags with parameters in TOC !! options parsoid=wt2html !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __TOC__ ==Hello== ==Evilbye== !! html/php

Hello

[edit]

b">Evilbye

[edit]
!! html/parsoid

Hello

b">Evilbye

!! end !! test span tags with directionality in TOC !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __TOC__ ==C++== ==זבנג!== ==Attributes other than dir== !! html/php

C++

[edit]

זבנג!

[edit]

Attributes other than dir

[edit]
!! html/parsoid

C++

זבנג!

Attributes other than dir

!! end !! test T74884: bdi element in ToC !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __TOC__ ==test== !! html/php

test

[edit]
!! html/parsoid

test

!! end !! test T35715: s/strike element in ToC !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __TOC__ ==test test test== !! html/php

test test test

[edit]
!! html/parsoid

test test test

!! end !! test T198618: style element in ToC !! options styletag=1 !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __TOC__ ==Style== !! html/php

Style

[edit]
!! html/parsoid

Style

!! end !! test T198618: script element in ToC !! options wgRawHtml=1 !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __TOC__ ==Script== !! html/php

Script

[edit]
!! html/parsoid

Script

!! end !! test Empty

tag in TOC, removed by Sanitizer (T92892) !! config wgParserEnableLegacyHeadingDOM=false !! wikitext __TOC__ ==x== !! html/php

x

[edit]
!! html/parsoid

x

!! end !! test Disable TOC !! options notoc !! config wgParserEnableLegacyHeadingDOM=false !! wikitext Lead ==Section 1== ==Section 2== ==Section 3== ==Section 4== ==Section 5== !! html

Lead

Section 1

[edit]

Section 2

[edit]

Section 3

[edit]

Section 4

[edit]

Section 5

[edit]
!! end ### ### Headings ### # 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 !! config wgParserEnableLegacyHeadingDOM=false !! wikitext === The line above must have a trailing space! === But just in case it doesn't... !! html/php

=

[edit]

The line above must have a trailing space!

=

[edit]

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)

text > text

[edit]

section 1

text < text

[edit]

section 2

text & text

[edit]

section 3

text ' text

[edit]

section 4

text " text

[edit]

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

Space between Text

[edit]

section 1

Space-Entity between Text

[edit]

section 2

Plus+between+Text

[edit]

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

foo=

[edit]

=foo

[edit]

italic heading=

[edit]

=italic heading

[edit]
!! 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

Header 1

Header 1.1

Header 1.2

Header 2

Header 2.1

Header 2.2

!! html/parsoid

Header 1

Header 1.1

Header 1.2

Header 2

Header 2.1

Header 2.2

!! end !! test Out-of-order TOC heading levels !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==2== ======6====== ===3=== =1= =====5===== ==2== !! html/php

2

[edit]
6
[edit]

3

[edit]

1

[edit]
5
[edit]

2

[edit]
!! 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&GT !! 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

spantag h2

[edit]

intro

page h2

[edit]

blah

!! html/parsoid

spantag h2

intro

page h2

blah

!! 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

spantag h2

[edit]

intro

page h2

[edit]

blah

!! html/parsoid

foo

spantag h2

intro

page h2

blah

!! 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

spantag h2

[edit]

template h2

intro

page h2

[edit]

blah

!! html/parsoid

spantag h2

template h2

intro

page h2

blah

!! 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

hiho

[edit]
!! metadata/php Sections: h3 index:1 toclevel:1 number:1 title:Parser_test off:28 anchor/linkAnchor:hiho line:hiho !! html/parsoid

hiho

hiho

!! 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

odd

!! 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


b

[edit]

a


b

[edit]
!! 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

b

[edit]

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

A B C

[edit]
!! 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

  A   B  

[edit]
!! 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

{{PAGENAME}}

[edit]

{{PAGENAME}}

[edit]
!! 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]

Section T-1

[edit]
!! end !! test T8563: Edit link generation for section suppressed by !! config wgParserEnableLegacyHeadingDOM=false !! wikitext ==Includeonly section== ==Section 1== !! html

Section 1

[edit]
!! 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

onmouseover=

[edit]

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

a

[edit]
!! html/parsoid

a

!! end !! article MediaWiki:Fake !! text ==header== !! endarticle !! test Inclusion of !userCanEdit() content !! config wgParserEnableLegacyHeadingDOM=false !! wikitext {{MediaWiki:Fake}} !! html
[edit]
!! end !! test Morwen/13: Unclosed link followed by heading !! config wgParserEnableLegacyHeadingDOM=false !! wikitext [[link ==heading== !! html

[[link

heading

[edit]
!! 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|

heading

[edit]
!! 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&amp;D&amp;amp;E== [[#A&B&C&amp;D&amp;amp;E]] !! html/php

A&B&C&amp;D&amp;amp;E

[edit]

#A&B&C&amp;D&amp;amp;E

!! html/parsoid

A&B&C&amp;D&amp;amp;E

#A&B&C&amp;D&amp;amp;E

!! metadata Sections: h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:A&B&C&D&amp;E line:A&B&C&amp;D&amp;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&amp;D&amp;amp;E== [[#A&B&C&amp;D&amp;amp;E]] !! html/php

A&B&C&amp;D&amp;amp;E

[edit]

#A&B&C&amp;D&amp;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

[edit]

foo Bar

[edit]

Тест

[edit]

Тест

[edit]

тест

[edit]

Hey < # " > % : '

[edit]

#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

[edit]

foo Bar

[edit]

Тест

[edit]

Тест

[edit]

тест

[edit]

Hey < # " > % : '

[edit]

#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

[edit]

foo Bar

[edit]

Тест

[edit]

Тест

[edit]

тест

[edit]

Hey < # " > % : '

[edit]

#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

[edit]

#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

Normal heading!

[edit]

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[edit]

$ text[edit]

text $text[edit]

\$text[edit]

$$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

test

[edit]
!! html/parsoid

test

!! 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