# 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 } !! 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 } !! wikitext ==a==
Some text
More
Blah blah
!! end !! test Section headings with TOC !! wikitext ==Headline 1== ===Subheadline 1=== =====Skipping a level===== ======Skipping a level====== ==Headline 2== Some text ===Another headline=== !! html/phpSome text
Some text
Omesay exttay
Some text
Some text
Some text
Introductionway. Re
Bob Re
Ball Eray
-{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 Do
Bar Re
Introduction.
Foo Do
Bar Re
Quote== !! html/php
[edit]Quote
Quote
Hanc marginis exiguitas non caperet. QED
!! html/parsoidHanc marginis exiguitas non caperet. QED
!! end !! test Multiple tags in TOC !! wikitext __TOC__ ==Foo Bar== ==FooBar== !! html/php
[edit]Bar
Bar
tag in TOC, removed by Sanitizer (T92892) !! wikitext __TOC__ ==x== !! html/php
Lead
The line above must have a trailing space!
But just in case it doesn't...
!! html/parsoidThe line above must have a trailing space!
But just in case it doesn't...
!! 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/phpThe tooltips shall not show entities to the user (ie. be double escaped)
section 1
section 2
section 3
section 4
section 5
!! html/parsoidThe tooltips shall not show entities to the user (ie. be double escaped)
section 1
section 2
section 3
section 4
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/phpId should not contain + for spaces
section 1
section 2
section 3
section 4
section 5
section 6
#Space between Text #Space-Entity between Text #Plus+between+Text #Plus-Entity+between+Text #Underscore_between_Text #Underscore-Entity_between_Text
!! html/parsoidId should not contain + for spaces
section 1
section 2
section 3
section 4
section 5
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 !! wikitext =foo== ==foo= =''italic'' heading== ==''italic'' heading= !! html/php