This now aligns with Parsoid commit db0772cd77d89ea166bf6ea162f9d223264a6f50 Change-Id: I988d8e3bd4953fdf8e71ca0ed72f2f0755e4948c
1947 lines
108 KiB
Text
1947 lines
108 KiB
Text
# 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==
|
|
<h2>b</h2>
|
|
<h3>c</h3>
|
|
===d===
|
|
<h2>e</h2>
|
|
!! 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
|
|
Duplicate headings should get unique anchors
|
|
!! options
|
|
nohtml
|
|
showtocdata
|
|
parsoid={
|
|
"modes": [ "wt2html" ],
|
|
"wrapSections": true
|
|
}
|
|
!! 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
|
|
}
|
|
!! 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
|
|
}
|
|
!! wikitext
|
|
==<span>x</span>==
|
|
==<strike>y</strike>==
|
|
!! metadata
|
|
Sections:
|
|
h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:x line:<span>x</span>
|
|
h2 index:2 toclevel:1 number:2 title:Parser_test off:19 anchor/linkAnchor:y line:<strike>y</strike>
|
|
!! end
|
|
|
|
!! test
|
|
Ensure unallowed tag wrappers in headings get stripped
|
|
!! options
|
|
nohtml
|
|
showtocdata
|
|
parsoid={
|
|
"modes": [ "wt2html" ],
|
|
"wrapSections": true
|
|
}
|
|
!! wikitext
|
|
==<div>b</div>==
|
|
==<font>c</font>==
|
|
!! 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
|
|
}
|
|
!! wikitext
|
|
==<span dir='ltr' title='x'>a</span>==
|
|
==<span dir='rtl' title='x'>b</span>==
|
|
==<i dir='rtl' title='ha'>c</i>==
|
|
!! metadata
|
|
Sections:
|
|
h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:a line:<span dir="ltr">a</span>
|
|
h2 index:2 toclevel:1 number:2 title:Parser_test off:39 anchor/linkAnchor:b line:<span dir="rtl">b</span>
|
|
h2 index:3 toclevel:1 number:3 title:Parser_test off:78 anchor/linkAnchor:c line:<i>c</i>
|
|
!! 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
|
|
}
|
|
!! wikitext
|
|
==<span><div></div></span>x==
|
|
==<span dir='ltr'><i dir='ltr'></i></span>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:<span dir="ltr"><i></i></span>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
|
|
Handle links in heading content
|
|
!! options
|
|
nohtml
|
|
showtocdata
|
|
parsoid={
|
|
"modes": [ "wt2html" ],
|
|
"wrapSections": true
|
|
}
|
|
!! 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 <i>cat</i>
|
|
!! 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" ]
|
|
!! 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:<i>x</i>
|
|
!! 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
|
|
}
|
|
!! 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
|
|
|
|
# FIXME:
|
|
# 1. This potentially exposes a subtle issue in the interaction between TOC, Cite, and
|
|
# localization. Parsoid doesn't localize numbers in Cite (at all!) since it relies on CSS.
|
|
# But, with the legacy parser, a wiki with localized numbers will have an anchor
|
|
# based off a localized number if a <ref> is used in a heading. Parsoid won't!.
|
|
# 2. We probably should be a bit smarter about what to strip for tags when that output
|
|
# comes from extensions. Below, we have stripped all extension typeofs and info.
|
|
# But, depends on who uses this 'line' property and how.
|
|
|
|
# FIXME: test disabled because CI doesn't have the Cite extension installed
|
|
!! test
|
|
Handle extension content in section headers properly
|
|
!! config
|
|
wgFragmentMode=[ "html5", "legacy" ]
|
|
!! options
|
|
nohtml
|
|
showtocdata
|
|
parsoid={
|
|
"modes": [ "wt2html" ],
|
|
"wrapSections": true
|
|
}
|
|
!! wikitext
|
|
==c<ref>d</ref>==
|
|
!! metadata/php+disabled
|
|
Sections:
|
|
h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:c[1] line:c<sup>[1]</sup>
|
|
!! metadata/parsoid
|
|
Sections:
|
|
h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:c[1] line:c<sup><span>[1]</span></sup>
|
|
!! end
|
|
|
|
# FIXME: This test shows a similar difference between legacy and
|
|
# Parsoid output, but it may be due to a subtle difference in the
|
|
# whitespace emitted by the parser test runner's <tag> implementation
|
|
!! test
|
|
Handle extension content in section headers properly (non-Cite version)
|
|
!! config
|
|
wgFragmentMode=[ "html5", "legacy" ]
|
|
!! options
|
|
nohtml
|
|
showtocdata
|
|
parsoid={
|
|
"modes": [ "wt2html" ],
|
|
"wrapSections": true
|
|
}
|
|
!! wikitext
|
|
==c<tag>d</tag>==
|
|
!! metadata/php
|
|
Sections:
|
|
h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:c_'d'_array_(_) line:"c\n'd'\narray (\n)"
|
|
!! metadata/parsoid
|
|
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" ]
|
|
!! 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
|
|
}
|
|
!! wikitext
|
|
<div>
|
|
{{1x|1=
|
|
==foo==
|
|
</div>
|
|
}}
|
|
==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
|
|
}
|
|
!! wikitext
|
|
{{#if:1|<h2>foo</h2>|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
|
|
}
|
|
!! 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
|
|
!! wikitext
|
|
==Headline 1==
|
|
Some text
|
|
|
|
==Headline 2==
|
|
More
|
|
===Smaller headline===
|
|
Blah blah
|
|
!! html
|
|
<h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>Some text
|
|
</p>
|
|
<h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>More
|
|
</p>
|
|
<h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Smaller headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<p>Blah blah
|
|
</p>
|
|
!! end
|
|
|
|
!! test
|
|
Section headings with TOC
|
|
!! wikitext
|
|
==Headline 1==
|
|
===Subheadline 1===
|
|
=====Skipping a level=====
|
|
======Skipping a level======
|
|
|
|
==Headline 2==
|
|
Some text
|
|
===Another headline===
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
|
|
<ul>
|
|
<li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
|
|
<ul>
|
|
<li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
|
|
<h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
|
|
<h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>Some text
|
|
</p>
|
|
<h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=6" title="Edit section: Another headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
!! html/parsoid
|
|
<h2 id="Headline_1" data-parsoid="{}">Headline 1</h2>
|
|
<h3 id="Subheadline_1" data-parsoid="{}">Subheadline 1</h3>
|
|
<h5 id="Skipping_a_level" data-parsoid="{}">Skipping a level</h5>
|
|
<h6 id="Skipping_a_level_2" data-parsoid="{}">Skipping a level</h6>
|
|
|
|
<h2 id="Headline_2" data-parsoid="{}">Headline 2</h2>
|
|
<p data-parsoid="{}">Some text</p>
|
|
<h3 id="Another_headline" data-parsoid="{}">Another headline</h3>
|
|
!! end
|
|
|
|
!! test
|
|
Section headings with TOC and language conversion (T295187, T306862)
|
|
!! config
|
|
wgUsePigLatinVariant=true
|
|
!! options
|
|
language=en variant=en-x-piglatin
|
|
!! wikitext
|
|
==Headline 1==
|
|
===Subheadline 1===
|
|
==Headline 2==
|
|
Some text
|
|
===Another headline===
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en-x-piglatin" dir="ltr"><h2 id="mw-toc-heading">Ontentscay</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Eadlinehay 1</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Ubheadlinesay 1</span></a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toclevel-1 tocsection-3"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Eadlinehay 2</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-4"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Anotherway eadlinehay</span></a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="Headline_1">Eadlinehay 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Eadlinehay 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="Subheadline_1">Ubheadlinesay 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Ubheadlinesay 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<h2><span class="mw-headline" id="Headline_2">Eadlinehay 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Eadlinehay 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>Omesay exttay
|
|
</p>
|
|
<h3><span class="mw-headline" id="Another_headline">Anotherway eadlinehay</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Anotherway eadlinehay">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
!! html/parsoid
|
|
<h2 id="Headline_1" data-parsoid="{}">Headline 1</h2>
|
|
<h3 id="Subheadline_1" data-parsoid="{}">Subheadline 1</h3>
|
|
<h2 id="Headline_2" data-parsoid="{}">Headline 2</h2>
|
|
<p data-parsoid="{}">Some text</p>
|
|
<h3 id="Another_headline" data-parsoid="{}">Another headline</h3>
|
|
!! 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
|
|
!! options
|
|
language=en variant=en-x-piglatin
|
|
!! wikitext
|
|
==Headline 1==
|
|
===Subheadline 1===
|
|
==Headline 2==
|
|
Some text
|
|
===Another headline===
|
|
__NOCONTENTCONVERT__
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en-x-piglatin" dir="ltr"><h2 id="mw-toc-heading">Ontentscay</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toclevel-1 tocsection-3"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-4"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>Some text
|
|
</p>
|
|
<h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Another headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
!! html/parsoid
|
|
<h2 id="Headline_1" data-parsoid="{}">Headline 1</h2>
|
|
<h3 id="Subheadline_1" data-parsoid="{}">Subheadline 1</h3>
|
|
<h2 id="Headline_2" data-parsoid="{}">Headline 2</h2>
|
|
<p data-parsoid="{}">Some text</p>
|
|
<h3 id="Another_headline" data-parsoid="{}">Another headline</h3>
|
|
<meta property="mw:PageProp/nocontentconvert" data-parsoid="{}" />
|
|
!! 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
|
|
!! options
|
|
language=en variant=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
|
|
<p>
|
|
Introductionway.
|
|
Re
|
|
</p>
|
|
<h2><span class="mw-headline" id="Foo">Bob</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Bob">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>Bob Re
|
|
</p>
|
|
<h2><span class="mw-headline" id="Bar">Ball</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Ball">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>Ball Eray
|
|
</p>
|
|
<h2><span class="mw-headline" id="-.7BFoo_Bar.7D-">Foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid+standalone
|
|
<section data-mw-section-id="0"><!--
|
|
--><p>-{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;}-</p>
|
|
</section><section data-mw-section-id="1"><h2 id="Foo">Foo</h2>
|
|
<p>Foo Do</p>
|
|
</section><section data-mw-section-id="2"><h2 id="Bar">Bar</h2>
|
|
<p>Bar Re</p>
|
|
</section><section data-mw-section-id="3"><h2 id="-{Foo_Bar}-"><span id="-.7BFoo_Bar.7D-" typeof="mw:FallbackId"></span>-{Foo Bar}-</h2></section>
|
|
!! html/parsoid+integrated
|
|
<section data-mw-section-id="0"><!--
|
|
--><p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"Foo","l":"en","t":"Boo"},{"f":"Foo","l":"en-x-piglatin","t":"Bob"}]}'/><!--
|
|
--><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"Bar","l":"en","t":"Bat"},{"f":"Bar","l":"en-x-piglatin","t":"Ball"}]}'/><!--
|
|
--><meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"en","t":"Foo"},{"l":"en-x-piglatin","t":"Bar"}]}'/><!--
|
|
--> Introduction. <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"en","t":"Do"},{"l":"en-x-piglatin","t":"Re"}]}'></span></p>
|
|
</section><section data-mw-section-id="1"><h2 id="Foo">Foo</h2>
|
|
<p>Foo Do</p>
|
|
</section><section data-mw-section-id="2"><h2 id="Bar">Bar</h2>
|
|
<p>Bar Re</p>
|
|
</section><section data-mw-section-id="3"><h2 id="-{Foo_Bar}-"><span id="-.7BFoo_Bar.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Foo Bar"}}'></span></h2>
|
|
</section>
|
|
|
|
!! end
|
|
|
|
!! test
|
|
TOC anchors don't collide
|
|
!! wikitext
|
|
__FORCETOC__
|
|
==Headline 2==
|
|
==Headline==
|
|
==Headline 2==
|
|
==Headline==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
|
|
<li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
|
|
<li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
|
|
<li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id="Headline">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id="Headline_2_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id="Headline_3">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! end
|
|
|
|
# perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
|
|
# Parsoid html2wt direction adds <nowiki> for level 7 and up.
|
|
!! test
|
|
Handling of sections up to level 6 and beyond
|
|
!! options
|
|
parsoid=wt2html
|
|
!! 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
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
|
|
<ul>
|
|
<li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
|
|
<ul>
|
|
<li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
|
|
<ul>
|
|
<li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
|
|
<ul>
|
|
<li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
|
|
<li class="toclevel-6 tocsection-7"><a href="#.3DLevel_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">=Level 7 Heading=</span></a></li>
|
|
<li class="toclevel-6 tocsection-8"><a href="#.3D.3DLevel_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">==Level 8 Heading==</span></a></li>
|
|
<li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3DLevel_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">===Level 9 Heading===</span></a></li>
|
|
<li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3DLevel_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">====Level 10 Heading====</span></a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
|
|
<h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Level 4 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
|
|
<h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=5" title="Edit section: Level 5 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
|
|
<h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=6" title="Edit section: Level 6 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
|
|
<h6><span class="mw-headline" id=".3DLevel_7_Heading.3D">=Level 7 Heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=7" title="Edit section: =Level 7 Heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
|
|
<h6><span class="mw-headline" id=".3D.3DLevel_8_Heading.3D.3D">==Level 8 Heading==</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=8" title="Edit section: ==Level 8 Heading==">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
|
|
<h6><span class="mw-headline" id=".3D.3D.3DLevel_9_Heading.3D.3D.3D">===Level 9 Heading===</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=9" title="Edit section: ===Level 9 Heading===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
|
|
<h6><span class="mw-headline" id=".3D.3D.3D.3DLevel_10_Heading.3D.3D.3D.3D">====Level 10 Heading====</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=10" title="Edit section: ====Level 10 Heading====">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
|
|
!! html/parsoid
|
|
<h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
|
|
<h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
|
|
<h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
|
|
<h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
|
|
<h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
|
|
<h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
|
|
<h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
|
|
<h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
|
|
<h6 id="===Level_9_Heading===" data-parsoid='{}'><span id=".3D.3D.3DLevel_9_Heading.3D.3D.3D" typeof="mw:FallbackId"></span>===Level 9 Heading===</h6>
|
|
<h6 id="====Level_10_Heading====" data-parsoid='{}'><span id=".3D.3D.3D.3DLevel_10_Heading.3D.3D.3D.3D" typeof="mw:FallbackId"></span>====Level 10 Heading====</h6>
|
|
!! end
|
|
|
|
!! test
|
|
TOC regression (T11764)
|
|
!! wikitext
|
|
==title 1==
|
|
===title 1.1===
|
|
====title 1.1.1====
|
|
===title 1.2===
|
|
==title 2==
|
|
===title 2.1===
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
|
|
<ul>
|
|
<li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
|
|
<h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
!! html/parsoid
|
|
<h2 id="title_1" data-parsoid="{}">title 1</h2>
|
|
<h3 id="title_1.1" data-parsoid="{}">title 1.1</h3>
|
|
<h4 id="title_1.1.1" data-parsoid="{}">title 1.1.1</h4>
|
|
<h3 id="title_1.2" data-parsoid="{}">title 1.2</h3>
|
|
<h2 id="title_2" data-parsoid="{}">title 2</h2>
|
|
<h3 id="title_2.1" data-parsoid="{}">title 2.1</h3>
|
|
!! end
|
|
|
|
!! test
|
|
TOC for heading containing <span id="..."></span> (T96153)
|
|
!! wikitext
|
|
__FORCETOC__
|
|
==<span id="old-anchor"></span>New title==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="New_title"><span id="old-anchor"></span>New title</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: New title">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! end
|
|
|
|
!! test
|
|
TOC with wgMaxTocLevel=3 (T8204)
|
|
!! options
|
|
wgMaxTocLevel=3
|
|
!! wikitext
|
|
==title 1==
|
|
===title 1.1===
|
|
====title 1.1.1====
|
|
===title 1.2===
|
|
==title 2==
|
|
===title 2.1===
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
|
|
<li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
|
|
<h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
!! html/parsoid
|
|
<h2 id="title_1" data-parsoid="{}">title 1</h2>
|
|
<h3 id="title_1.1" data-parsoid="{}">title 1.1</h3>
|
|
<h4 id="title_1.1.1" data-parsoid="{}">title 1.1.1</h4>
|
|
<h3 id="title_1.2" data-parsoid="{}">title 1.2</h3>
|
|
<h2 id="title_2" data-parsoid="{}">title 2</h2>
|
|
<h3 id="title_2.1" data-parsoid="{}">title 2.1</h3>
|
|
!! 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/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
|
|
<h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Section 1.1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
|
|
<h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=5" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<h2 id="Section_1" data-parsoid="{}">Section 1</h2>
|
|
<h3 id="Section_1.1" data-parsoid="{}">Section 1.1</h3>
|
|
<h4 id="Section_1.1.1" data-parsoid="{}">Section 1.1.1</h4>
|
|
<h4 id="Section_1.1.1.1" data-parsoid="{}">Section 1.1.1.1</h4>
|
|
<h2 id="Section_2" data-parsoid="{}">Section 2</h2>
|
|
!! end
|
|
|
|
!! test
|
|
Resolving duplicate section names
|
|
!! wikitext
|
|
==Foo bar==
|
|
==Foo bar==
|
|
!! html
|
|
<h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! end
|
|
|
|
!! test
|
|
Resolving duplicate section names with differing case (T12721)
|
|
!! wikitext
|
|
==Foo bar==
|
|
==Foo Bar==
|
|
!! html
|
|
<h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! end
|
|
|
|
!! article
|
|
Template:sections
|
|
!! text
|
|
===Section 1===
|
|
==Section 2==
|
|
!! endarticle
|
|
|
|
!! test
|
|
Template with sections, __NOTOC__
|
|
!! options
|
|
showflags
|
|
parsoid={
|
|
"wrapSections": true
|
|
}
|
|
!! wikitext
|
|
__NOTOC__
|
|
==Section 0==
|
|
{{sections}}
|
|
==Section 4==
|
|
!! metadata
|
|
flags=no-toc
|
|
!! html/php
|
|
<h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Section 0">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&action=edit&section=T-1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&action=edit&section=T-2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<section data-mw-section-id="0"><meta property="mw:PageProp/notoc" data-parsoid="{}" />
|
|
</section><section data-mw-section-id="1" about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["==Section 0==\n",{"template":{"target":{"wt":"sections","href":"./Template:Sections"},"params":{},"i":0}},"\n"]}'><h2 id="Section_0" data-parsoid="{}">Section 0</h2>
|
|
<section data-mw-section-id="-1"><h3 about="#mwt1" typeof="mw:Transclusion" id="Section_1" data-parsoid="{}" data-mw='{"parts":[{"template":{"target":{"wt":"sections","href":"./Template:Sections"},"params":{},"i":0}}]}'>Section 1</h3><span about="#mwt1">
|
|
</span></section></section><section data-mw-section-id="-1" about="#mwt2"><h2 about="#mwt1" id="Section_2">Section 2</h2>
|
|
</section><section data-mw-section-id="2"><h2 id="Section_4" data-parsoid="{}">Section 4</h2></section>
|
|
!! end
|
|
|
|
!! test
|
|
T307691: show-toc flag: no sections
|
|
!! options
|
|
showflags
|
|
parsoid={
|
|
"wrapSections": true
|
|
}
|
|
!! wikitext
|
|
!! metadata
|
|
flags=
|
|
!! html
|
|
!! html/parsoid
|
|
<section data-mw-section-id="0"></section>
|
|
!! 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
|
|
}
|
|
!! wikitext
|
|
__FORCETOC__
|
|
!! metadata
|
|
flags=
|
|
!! html/php
|
|
!! html/parsoid
|
|
<section data-mw-section-id="0"><meta property="mw:PageProp/forcetoc"/></section>
|
|
!! 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
|
|
}
|
|
!! wikitext
|
|
__TOC__
|
|
!! metadata
|
|
flags=
|
|
!! html/php
|
|
!! html/parsoid
|
|
<section data-mw-section-id="0"><meta property="mw:PageProp/toc"/></section>
|
|
!! end
|
|
|
|
!! test
|
|
T307691: show-toc flag: no sections, and __NOTOC__
|
|
!! options
|
|
showflags
|
|
parsoid={
|
|
"wrapSections": true
|
|
}
|
|
!! wikitext
|
|
__NOTOC__
|
|
!! metadata
|
|
flags=no-toc
|
|
!! html/php
|
|
!! html/parsoid
|
|
<section data-mw-section-id="0"><meta property="mw:PageProp/notoc"/></section>
|
|
!! end
|
|
|
|
!! test
|
|
T307691: show-toc flag: not "enough" sections
|
|
!! options
|
|
showflags
|
|
parsoid={
|
|
"wrapSections": true
|
|
}
|
|
!! wikitext
|
|
== One ==
|
|
!! metadata
|
|
flags=
|
|
!! html/php
|
|
<h2><span class="mw-headline" id="One">One</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: One">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<section data-mw-section-id="0"></section><section data-mw-section-id="1"><h2 id="One">One</h2>
|
|
</section>
|
|
!! end
|
|
|
|
!! test
|
|
T307691: show-toc flag: not "enough" sections, but __FORCETOC__
|
|
!! options
|
|
showflags
|
|
parsoid={
|
|
"wrapSections": true
|
|
}
|
|
!! wikitext
|
|
__FORCETOC__
|
|
== One ==
|
|
!! metadata
|
|
flags=show-toc
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#One"><span class="tocnumber">1</span> <span class="toctext">One</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="One">One</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: One">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<section data-mw-section-id="0"><meta property="mw:PageProp/forcetoc"/>
|
|
<meta property="mw:PageProp/toc" data-mw='{"autoGenerated":true}'/></section><section data-mw-section-id="1">
|
|
<h2 id="One">One</h2></section>
|
|
!! end
|
|
|
|
!! test
|
|
T307691: show-toc flag: not "enough" sections, but __TOC__
|
|
!! options
|
|
showflags
|
|
parsoid={
|
|
"wrapSections": true
|
|
}
|
|
!! wikitext
|
|
== One ==
|
|
__TOC__
|
|
!! metadata
|
|
flags=show-toc
|
|
!! html/php
|
|
<h2><span class="mw-headline" id="One">One</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: One">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#One"><span class="tocnumber">1</span> <span class="toctext">One</span></a></li>
|
|
</ul>
|
|
</div>
|
|
!! html/parsoid
|
|
<section data-mw-section-id="0"></section><section data-mw-section-id="1"><h2 id="One">One</h2>
|
|
<meta property="mw:PageProp/toc"/></section>
|
|
!! end
|
|
|
|
!! test
|
|
T307691: show-toc flag: not "enough" sections, and __NOTOC__
|
|
!! options
|
|
showflags
|
|
parsoid={
|
|
"wrapSections": true
|
|
}
|
|
!! wikitext
|
|
__NOTOC__
|
|
== One ==
|
|
!! metadata
|
|
flags=no-toc
|
|
!! html/php
|
|
<h2><span class="mw-headline" id="One">One</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: One">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<section data-mw-section-id="0"><meta property="mw:PageProp/notoc"/>
|
|
</section><section data-mw-section-id="1">
|
|
<h2 id="One">One</h2></section>
|
|
!! end
|
|
|
|
!! test
|
|
T307691: show-toc flag: "enough" sections
|
|
!! options
|
|
showflags
|
|
parsoid={
|
|
"wrapSections": true
|
|
}
|
|
!! wikitext
|
|
== One ==
|
|
=== Two ===
|
|
== Three ==
|
|
=== Four ===
|
|
!! metadata
|
|
flags=show-toc
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#One"><span class="tocnumber">1</span> <span class="toctext">One</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-2"><a href="#Two"><span class="tocnumber">1.1</span> <span class="toctext">Two</span></a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toclevel-1 tocsection-3"><a href="#Three"><span class="tocnumber">2</span> <span class="toctext">Three</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-4"><a href="#Four"><span class="tocnumber">2.1</span> <span class="toctext">Four</span></a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="One">One</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: One">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="Two">Two</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Two">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<h2><span class="mw-headline" id="Three">Three</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Three">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="Four">Four</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Four">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
!! html/parsoid
|
|
<section data-mw-section-id="0"><meta property="mw:PageProp/toc" data-mw='{"autoGenerated":true}'/></section><section data-mw-section-id="1"><h2 id="One">One</h2>
|
|
<section data-mw-section-id="2"><h3 id="Two">Two</h3>
|
|
</section></section><section data-mw-section-id="3"><h2 id="Three">Three</h2>
|
|
<section data-mw-section-id="4"><h3 id="Four">Four</h3></section></section>
|
|
!! end
|
|
|
|
!! test
|
|
T307691: show-toc flag: "enough" sections and __FORCETOC__
|
|
!! options
|
|
showflags
|
|
parsoid={
|
|
"wrapSections": true
|
|
}
|
|
!! wikitext
|
|
__FORCETOC__
|
|
== One ==
|
|
=== Two ===
|
|
== Three ==
|
|
=== Four ===
|
|
!! metadata
|
|
flags=show-toc
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#One"><span class="tocnumber">1</span> <span class="toctext">One</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-2"><a href="#Two"><span class="tocnumber">1.1</span> <span class="toctext">Two</span></a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toclevel-1 tocsection-3"><a href="#Three"><span class="tocnumber">2</span> <span class="toctext">Three</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-4"><a href="#Four"><span class="tocnumber">2.1</span> <span class="toctext">Four</span></a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="One">One</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: One">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="Two">Two</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Two">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<h2><span class="mw-headline" id="Three">Three</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Three">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="Four">Four</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Four">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
!! html/parsoid
|
|
<section data-mw-section-id="0"><meta property="mw:PageProp/forcetoc"/>
|
|
<meta property="mw:PageProp/toc" data-mw='{"autoGenerated":true}'/></section><section data-mw-section-id="1"><h2 id="One">One</h2>
|
|
<section data-mw-section-id="2"><h3 id="Two">Two</h3>
|
|
</section></section><section data-mw-section-id="3"><h2 id="Three">Three</h2>
|
|
<section data-mw-section-id="4"><h3 id="Four">Four</h3></section></section>
|
|
!! end
|
|
|
|
!! test
|
|
T307691: show-toc flag: "enough" sections and __NOTOC__
|
|
!! options
|
|
showflags
|
|
parsoid={
|
|
"wrapSections": true
|
|
}
|
|
!! wikitext
|
|
__NOTOC__
|
|
== One ==
|
|
=== Two ===
|
|
== Three ==
|
|
=== Four ===
|
|
!! metadata
|
|
flags=no-toc
|
|
!! html/php
|
|
<h2><span class="mw-headline" id="One">One</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: One">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="Two">Two</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Two">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<h2><span class="mw-headline" id="Three">Three</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Three">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="Four">Four</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Four">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
!! html/parsoid
|
|
<section data-mw-section-id="0"><meta property="mw:PageProp/notoc"/>
|
|
</section><section data-mw-section-id="1"><h2 id="One">One</h2>
|
|
<section data-mw-section-id="2"><h3 id="Two">Two</h3>
|
|
</section></section><section data-mw-section-id="3"><h2 id="Three">Three</h2>
|
|
<section data-mw-section-id="4"><h3 id="Four">Four</h3></section></section>
|
|
!! end
|
|
|
|
!! test
|
|
__NOEDITSECTION__ keyword
|
|
!! wikitext
|
|
__NOEDITSECTION__
|
|
==Section 1==
|
|
==Section 2==
|
|
!! html
|
|
<h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
|
|
<h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
|
|
!! end
|
|
|
|
!! test
|
|
Link inside a section heading
|
|
!! wikitext
|
|
==Section with a [[Main Page|link]] in it==
|
|
!! html
|
|
<h2><span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Section with a link in it">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! end
|
|
|
|
!! test
|
|
TOC regression (T14077)
|
|
!! wikitext
|
|
__TOC__
|
|
==title 1==
|
|
===title 1.1===
|
|
==title 2==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<meta property="mw:PageProp/toc" data-parsoid="{}"/>
|
|
<h2 id="title_1" data-parsoid="{}">title 1</h2>
|
|
<h3 id="title_1.1" data-parsoid="{}">title 1.1</h3>
|
|
<h2 id="title_2" data-parsoid="{}">title 2</h2>
|
|
!! 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
|
|
}
|
|
!! wikitext
|
|
__NEWSECTIONLINK__
|
|
__FORCETOC__
|
|
!! metadata
|
|
flags=mw-NewSection
|
|
!! html/php
|
|
<p><br />
|
|
</p>
|
|
!! html/parsoid
|
|
<section data-mw-section-id="0"><meta property="mw:PageProp/newsectionlink" />
|
|
<meta property="mw:PageProp/forcetoc" /></section>
|
|
!! 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 <meta> and the <h2> have a data-parsoid attribute set (even if
|
|
# it's "{}").
|
|
|
|
!! test
|
|
T28375: TOC with italics
|
|
!! options
|
|
title=[[Main Page]]
|
|
!! wikitext
|
|
__TOC__
|
|
==''Lost'' episodes==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&action=edit&section=1" title="Edit section: Lost episodes">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<meta property="mw:PageProp/toc" data-parsoid='{}'/>
|
|
<h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
|
|
!! end
|
|
|
|
!! test
|
|
T28375: TOC with bold
|
|
!! options
|
|
title=[[Main Page]]
|
|
!! wikitext
|
|
__TOC__
|
|
=='''should be bold''' then normal text==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&action=edit&section=1" title="Edit section: should be bold then normal text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<meta property="mw:PageProp/toc" data-parsoid='{}'/>
|
|
<h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
|
|
!! end
|
|
|
|
!! test
|
|
T35845: Headings become cursive in TOC when they contain an image
|
|
!! options
|
|
title=[[Main Page]]
|
|
!! config
|
|
wgParserEnableLegacyMediaDOM=false
|
|
!! wikitext
|
|
__TOC__
|
|
==Image [[Image:foobar.jpg]]==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="Image">Image <span class="mw-default-size" typeof="mw:File"><a href="/wiki/File:Foobar.jpg" class="mw-file-description"><img src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" class="mw-file-element" /></a></span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&action=edit&section=1" title="Edit section: Image">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<meta property="mw:PageProp/toc" data-parsoid='{}'/>
|
|
<h2 id="Image" data-parsoid='{}'>Image <span class="mw-default-size" typeof="mw:File"><a href="./File:Foobar.jpg" class="mw-file-description"><img resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}' class="mw-file-element"/></a></span></h2>
|
|
!! end
|
|
|
|
!! test
|
|
T35845 (2): Headings become bold in TOC when they contain a blockquote
|
|
!! options
|
|
title=[[Main Page]]
|
|
!! wikitext
|
|
__TOC__
|
|
==<blockquote>Quote</blockquote>==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="Quote"><blockquote><p>Quote</p></blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&action=edit&section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<meta property="mw:PageProp/toc" data-parsoid='{}'/>
|
|
<h2 id="Quote" data-parsoid='{}'><blockquote><p>Quote</p></blockquote></h2>
|
|
!! end
|
|
|
|
!! test
|
|
Unclosed tags in TOC
|
|
!! config
|
|
wgFragmentMode=[ "html5", "legacy" ]
|
|
!! options
|
|
title=[[Main Page]]
|
|
!! wikitext
|
|
__TOC__
|
|
==Proof: 2 < 3==
|
|
<small>Hanc marginis exiguitas non caperet.</small>
|
|
QED
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Proof:_2_<_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 < 3</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span id="Proof:_2_.3C_3"></span><span class="mw-headline" id="Proof:_2_<_3">Proof: 2 < 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&action=edit&section=1" title="Edit section: Proof: 2 < 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p><small>Hanc marginis exiguitas non caperet.</small>
|
|
QED
|
|
</p>
|
|
!! html/parsoid
|
|
<meta property="mw:PageProp/toc" data-parsoid='{}'/>
|
|
<h2 id="Proof:_2_<_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 < 3</h2>
|
|
<p><small>Hanc marginis exiguitas non caperet.</small>
|
|
QED</p>
|
|
!! end
|
|
|
|
!! test
|
|
Multiple tags in TOC
|
|
!! wikitext
|
|
__TOC__
|
|
==<i>Foo</i> <b>Bar</b>==
|
|
|
|
==<i>Foo</i> <blockquote>Bar</blockquote>==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
|
|
<li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote><p>Bar</p></blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<meta property="mw:PageProp/toc" data-parsoid='{}'/>
|
|
<h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
|
|
|
|
<h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote><p>Bar</p></blockquote></h2>
|
|
!! 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
|
|
!! wikitext
|
|
__TOC__
|
|
==<sup class="in-h2">Hello</sup>==
|
|
|
|
==<sup class="a > b">Evilbye</sup>==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
|
|
<li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b">Evilbye</sup></span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Hello">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id="b.22.3EEvilbye"><sup class="a"> b">Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: b">Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<meta property="mw:PageProp/toc" />
|
|
<h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
|
|
|
|
<h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
|
|
!! end
|
|
|
|
!! test
|
|
span tags with directionality in TOC
|
|
!! wikitext
|
|
__TOC__
|
|
==<span dir="ltr">C++</span>==
|
|
|
|
==<span dir="rtl">זבנג!</span>==
|
|
|
|
==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
|
|
|
|
==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
|
|
|
|
==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
|
|
<li class="toclevel-1 tocsection-2"><a href="#.D7.96.D7.91.D7.A0.D7.92.21"><span class="tocnumber">2</span> <span class="toctext"><span dir="rtl">זבנג!</span></span></a></li>
|
|
<li class="toclevel-1 tocsection-3"><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">3</span> <span class="toctext"><span>The attributes on these span tags must be deleted from the TOC</span></span></a></li>
|
|
<li class="toclevel-1 tocsection-4"><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">4</span> <span class="toctext"><span>All attributes on these span tags must be deleted from the TOC</span></span></a></li>
|
|
<li class="toclevel-1 tocsection-5"><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">5</span> <span class="toctext"><span dir="ltr">Attributes after dir on these span tags must be deleted from the TOC</span></span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: C++">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: זבנג!">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: All attributes on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=5" title="Edit section: Attributes after dir on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<meta property="mw:PageProp/toc" data-parsoid='{}'/>
|
|
<h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
|
|
<h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
|
|
<h2 id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></h2>
|
|
<h2 id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></h2>
|
|
<h2 id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></h2>
|
|
!! end
|
|
|
|
!! test
|
|
T74884: bdi element in ToC
|
|
!! wikitext
|
|
__TOC__
|
|
==<bdi>test</bdi>==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="test"><bdi>test</bdi></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<meta property="mw:PageProp/toc" data-parsoid='{}'/>
|
|
<h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
|
|
!! end
|
|
|
|
!! test
|
|
T35715: s/strike element in ToC
|
|
!! wikitext
|
|
__TOC__
|
|
==<s>test</s> test <strike>test</strike>==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#test_test_test"><span class="tocnumber">1</span> <span class="toctext"><s>test</s> test <strike>test</strike></span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="test_test_test"><s>test</s> test <strike>test</strike></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: test test test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<meta property="mw:PageProp/toc" data-parsoid='{}'/>
|
|
<h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
|
|
!! end
|
|
|
|
!! test
|
|
T198618: style element in ToC
|
|
!! options
|
|
styletag=1
|
|
!! wikitext
|
|
__TOC__
|
|
==<style>.foo {}</style>Style<style>.bar {}</style>==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Style"><span class="tocnumber">1</span> <span class="toctext">Style</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="Style"><style>.foo {}</style>Style<style>.bar {}</style></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Style">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<meta property="mw:PageProp/toc" data-parsoid="{}"/>
|
|
<h2 id="Style" data-parsoid="{}"><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo {}"}}'>.foo {}</style>Style<style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".bar {}"}}'>.bar {}</style></h2>
|
|
!! end
|
|
|
|
!! test
|
|
T198618: script element in ToC
|
|
!! options
|
|
wgRawHtml=1
|
|
!! wikitext
|
|
__TOC__
|
|
==<html><script>alert(1);</script></html>Script<html><script>alert(1);</script></html>==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Script"><span class="tocnumber">1</span> <span class="toctext">Script</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="Script"><script>alert(1);</script>Script<script>alert(1);</script></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Script">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<meta property="mw:PageProp/toc" data-parsoid='{}'/>
|
|
<h2 id="Script" data-parsoid='{}'><script typeof="mw:Extension/html" about="#mwt4" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"<script>alert(1);</script>"}}'>alert(1);</script>Script<script typeof="mw:Extension/html" about="#mwt6" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"<script>alert(1);</script>"}}'>alert(1);</script></h2>
|
|
!! end
|
|
|
|
!! test
|
|
Empty <p> tag in TOC, removed by Sanitizer (T92892)
|
|
!! wikitext
|
|
__TOC__
|
|
==x==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="x">x</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<meta property="mw:PageProp/toc" data-parsoid='{}'/>
|
|
<h2 id="x" data-parsoid='{}'>x</h2>
|
|
!! end
|
|
|
|
!!test
|
|
Disable TOC
|
|
!! options
|
|
notoc
|
|
!! wikitext
|
|
Lead
|
|
==Section 1==
|
|
==Section 2==
|
|
==Section 3==
|
|
==Section 4==
|
|
==Section 5==
|
|
!! html
|
|
<p>Lead
|
|
</p>
|
|
|
|
<h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h2><span class="mw-headline" id="Section_5">Section 5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=5" title="Edit section: Section 5">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! end
|
|
|
|
###
|
|
### Headings
|
|
###
|
|
|
|
# Parsoid doesn't wt2wt this cleanly because it adds <nowiki>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
|
|
<h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
|
|
<p>The line above must have a trailing space!
|
|
</p>
|
|
<h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
|
|
<p>But just in case it doesn't...
|
|
</p>
|
|
!! html/parsoid
|
|
<h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
|
|
<p>The line above must have a trailing space!</p>
|
|
<h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
|
|
--> <!-- -->
|
|
<p>But just in case it doesn't...</p>
|
|
!! 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
|
|
<p>The tooltips shall not show entities to the user (ie. be double escaped)
|
|
</p>
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text > text</span></a></li>
|
|
<li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text < text</span></a></li>
|
|
<li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text & text</span></a></li>
|
|
<li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
|
|
<li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="text_.3E_text">text > text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: text > text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>section 1
|
|
</p>
|
|
<h2><span class="mw-headline" id="text_.3C_text">text < text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: text < text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>section 2
|
|
</p>
|
|
<h2><span class="mw-headline" id="text_.26_text">text & text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: text & text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>section 3
|
|
</p>
|
|
<h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: text ' text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>section 4
|
|
</p>
|
|
<h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=5" title="Edit section: text " text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>section 5
|
|
</p>
|
|
!! html/parsoid
|
|
<p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
|
|
|
|
<h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
|
|
<p>section 1</p>
|
|
|
|
<h2 id="text_<_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text < text</h2>
|
|
<p>section 2</p>
|
|
|
|
<h2 id="text_&_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text & text</h2>
|
|
<p>section 3</p>
|
|
|
|
<h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
|
|
<p>section 4</p>
|
|
|
|
<h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
|
|
<p>section 5</p>
|
|
!! 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
|
|
<p>Id should not contain + for spaces
|
|
</p>
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
|
|
<li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity between Text</span></a></li>
|
|
<li class="toclevel-1 tocsection-3"><a href="#Plus.2Bbetween.2BText"><span class="tocnumber">3</span> <span class="toctext">Plus+between+Text</span></a></li>
|
|
<li class="toclevel-1 tocsection-4"><a href="#Plus-Entity.2Bbetween.2BText"><span class="tocnumber">4</span> <span class="toctext">Plus-Entity+between+Text</span></a></li>
|
|
<li class="toclevel-1 tocsection-5"><a href="#Underscore_between_Text"><span class="tocnumber">5</span> <span class="toctext">Underscore_between_Text</span></a></li>
|
|
<li class="toclevel-1 tocsection-6"><a href="#Underscore-Entity_between_Text"><span class="tocnumber">6</span> <span class="toctext">Underscore-Entity_between_Text</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="Space_between_Text">Space between Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Space between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>section 1
|
|
</p>
|
|
<h2><span class="mw-headline" id="Space-Entity_between_Text">Space-Entity between Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Space-Entity between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>section 2
|
|
</p>
|
|
<h2><span class="mw-headline" id="Plus.2Bbetween.2BText">Plus+between+Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Plus+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>section 3
|
|
</p>
|
|
<h2><span class="mw-headline" id="Plus-Entity.2Bbetween.2BText">Plus-Entity+between+Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Plus-Entity+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>section 4
|
|
</p>
|
|
<h2><span class="mw-headline" id="Underscore_between_Text">Underscore_between_Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=5" title="Edit section: Underscore between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>section 5
|
|
</p>
|
|
<h2><span class="mw-headline" id="Underscore-Entity_between_Text">Underscore-Entity_between_Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=6" title="Edit section: Underscore-Entity_between_Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<p>section 6
|
|
</p><p><a href="#Space_between_Text">#Space between Text</a>
|
|
<a href="#Space-Entity_between_Text">#Space-Entity between Text</a>
|
|
<a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
|
|
<a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity+between+Text</a>
|
|
<a href="#Underscore_between_Text">#Underscore_between_Text</a>
|
|
<a href="#Underscore-Entity_between_Text">#Underscore-Entity_between_Text</a>
|
|
</p>
|
|
!! html/parsoid
|
|
<p>Id should not contain + for spaces</p>
|
|
|
|
<h2 id="Space_between_Text">Space between Text</h2>
|
|
<p>section 1</p>
|
|
|
|
<h2 id="Space-Entity_between_Text">Space-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&#32;","srcContent":" "}'> </span>between<span typeof="mw:Entity" data-parsoid='{"src":"&#32;","srcContent":" "}'> </span>Text</h2>
|
|
<p>section 2</p>
|
|
|
|
<h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
|
|
<p>section 3</p>
|
|
|
|
<h2 id="Plus-Entity+between+Text"><span id="Plus-Entity.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&#43;","srcContent":"+"}'>+</span>between<span typeof="mw:Entity" data-parsoid='{"src":"&#43;","srcContent":"+"}'>+</span>Text</h2>
|
|
<p>section 4</p>
|
|
|
|
<h2 id="Underscore_between_Text">Underscore_between_Text</h2>
|
|
<p>section 5</p>
|
|
|
|
<h2 id="Underscore-Entity_between_Text">Underscore-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&#95;","srcContent":"_"}'>_</span>between<span typeof="mw:Entity" data-parsoid='{"src":"&#95;","srcContent":"_"}'>_</span>Text</h2>
|
|
<p>section 6</p>
|
|
|
|
<p><a rel="mw:WikiLink" href="./Parser_test#Space_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Space_between_Text"},"sa":{"href":"#Space between Text"}}'>#Space between Text</a>
|
|
<a rel="mw:WikiLink" href="./Parser_test#Space-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Space-Entity_between_Text"},"sa":{"href":"#Space-Entity&#32;between&#32;Text"}}'>#Space-Entity between Text</a>
|
|
<a rel="mw:WikiLink" href="./Parser_test#Plus+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Plus+between+Text"},"sa":{"href":"#Plus+between+Text"}}'>#Plus+between+Text</a>
|
|
<a rel="mw:WikiLink" href="./Parser_test#Plus-Entity+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Plus-Entity+between+Text"},"sa":{"href":"#Plus-Entity&#43;between&#43;Text"}}'>#Plus-Entity+between+Text</a>
|
|
<a rel="mw:WikiLink" href="./Parser_test#Underscore_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Underscore_between_Text"},"sa":{"href":"#Underscore_between_Text"}}'>#Underscore_between_Text</a>
|
|
<a rel="mw:WikiLink" href="./Parser_test#Underscore-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Underscore-Entity_between_Text"},"sa":{"href":"#Underscore-Entity&#95;between&#95;Text"}}'>#Underscore-Entity_between_Text</a></p>
|
|
!! 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
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
|
|
<li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
|
|
<li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
|
|
<li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
|
|
<h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
|
|
<h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
|
|
<h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: =italic heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
|
|
!! html/parsoid
|
|
<h1 id="foo=" data-parsoid="{}"><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
|
|
<h1 id="=foo" data-parsoid="{}"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
|
|
<h1 id="italic_heading=" data-parsoid="{}"><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
|
|
<h1 id="=italic_heading" data-parsoid="{}"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
|
|
!! end
|
|
|
|
!! test
|
|
HTML headers vs TOC (T25393)
|
|
(__NOEDITSECTION__ for clearer output, doesn't matter here)
|
|
!! wikitext
|
|
<h1>Header 1</h1>
|
|
==Header 1.1==
|
|
==Header 1.2==
|
|
|
|
<h1>Header 2
|
|
</h1>
|
|
==Header 2.1==
|
|
==Header 2.2==
|
|
__NOEDITSECTION__
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
|
|
<li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
|
|
<li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
|
|
<h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
|
|
<h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
|
|
<h1><span class="mw-headline" id="Header_2">Header 2
|
|
</span></h1>
|
|
<h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
|
|
<h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
|
|
!! html/parsoid
|
|
<h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
|
|
<h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
|
|
<h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
|
|
|
|
<h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
|
|
</h1>
|
|
<h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
|
|
<h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
|
|
<meta property="mw:PageProp/noeditsection"/>
|
|
!! end
|
|
|
|
!! test
|
|
Out-of-order TOC heading levels
|
|
!! wikitext
|
|
==2==
|
|
======6======
|
|
===3===
|
|
=1=
|
|
=====5=====
|
|
==2==
|
|
!! html/php
|
|
<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2 id="mw-toc-heading">Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
|
|
<ul>
|
|
<li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
|
|
<li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
|
|
<ul>
|
|
<li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
|
|
<li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<h2><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
<h6><span class="mw-headline" id="6">6</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: 6">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
|
|
<h3><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
|
<h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
|
|
<h5><span class="mw-headline" id="5">5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=5" title="Edit section: 5">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
|
|
<h2><span class="mw-headline" id="2_2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=6" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
|
!! html/parsoid
|
|
<h2 id="2" data-parsoid="{}">2</h2>
|
|
<h6 id="6" data-parsoid="{}">6</h6>
|
|
<h3 id="3" data-parsoid="{}">3</h3>
|
|
<h1 id="1" data-parsoid="{}">1</h1>
|
|
<h5 id="5" data-parsoid="{}">5</h5>
|
|
<h2 id="2_2" data-parsoid="{}">2</h2>
|
|
!! end
|