This now aligns with Parsoid commit 80bc41a395b19221e7f26b36dfbe0ab15a025819 Change-Id: Iec571f78e7a55991aea69ede2519803b84c05936
2896 lines
153 KiB
Text
2896 lines
153 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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
Literal html heading from template
|
||
!! options
|
||
showtocdata
|
||
parsoid={
|
||
"modes": [ "wt2html" ],
|
||
"wrapSections": true
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
{{1x|
|
||
<h2>hi</h2>
|
||
ho
|
||
}}
|
||
!! html/php
|
||
<h2><span class="mw-headline" id="hi">hi</span></h2>
|
||
<p>ho
|
||
</p>
|
||
!! html/parsoid
|
||
<section data-mw-section-id="0"></section><section data-mw-section-id="-1"><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"\n<h2>hi</h2>\nho\n"}},"i":0}}]}'>
|
||
</span><h2 about="#mwt1" id="hi">hi</h2><span about="#mwt1">
|
||
</span><p about="#mwt1">ho</p><span about="#mwt1">
|
||
</span></section>
|
||
!! metadata
|
||
Sections:
|
||
h2 index: toclevel:1 number:1 title:NULL off:NULL anchor/linkAnchor:hi line:hi
|
||
!! end
|
||
|
||
!! test
|
||
Duplicate headings should get unique anchors
|
||
!! options
|
||
nohtml
|
||
showtocdata
|
||
parsoid={
|
||
"modes": [ "wt2html" ],
|
||
"wrapSections": true
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
Ensure comments in toc lines are stripped
|
||
!! config
|
||
wgRawHtml=1
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! options
|
||
nohtml
|
||
showtocdata
|
||
!! wikitext
|
||
==hi<html><!--ho--></html>==
|
||
!! metadata/php
|
||
Sections:
|
||
h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:hi line:hi
|
||
!! end
|
||
|
||
!! test
|
||
Handle links in heading content
|
||
!! options
|
||
nohtml
|
||
showtocdata
|
||
parsoid={
|
||
"modes": [ "wt2html" ],
|
||
"wrapSections": true
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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" ]
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
|
||
!! test
|
||
Handle extension content in section headers properly (non-Cite version)
|
||
!! config
|
||
wgFragmentMode=[ "html5", "legacy" ]
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! options
|
||
nohtml
|
||
showtocdata
|
||
parsoid={
|
||
"modes": [ "wt2html" ],
|
||
"wrapSections": true
|
||
}
|
||
!! wikitext
|
||
==c<tag>d</tag>==
|
||
!! metadata
|
||
Sections:
|
||
h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:c'd'_array_(_) line:"c'd'\narray (\n)"
|
||
!! end
|
||
|
||
!! test
|
||
Offsets in toc metadata should be unicode codepoints, not bytes or UCS-2
|
||
!! config
|
||
wgFragmentMode=[ "html5", "legacy" ]
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! options
|
||
parsoid={
|
||
"modes": [ "wt2html" ],
|
||
"wrapSections": true
|
||
}
|
||
showtocdata
|
||
nohtml
|
||
!! wikitext
|
||
==One 💩==
|
||
==Two 💩==
|
||
==Three 💩==
|
||
!! metadata
|
||
Sections:
|
||
h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:One_💩 line:One 💩
|
||
h2 index:2 toclevel:1 number:2 title:Parser_test off:10 anchor/linkAnchor:Two_💩 line:Two 💩
|
||
h2 index:3 toclevel:1 number:3 title:Parser_test off:20 anchor/linkAnchor:Three_💩 line:Three 💩
|
||
!! end
|
||
|
||
!! test
|
||
Handle multi-part content transclusion blocks
|
||
!! options
|
||
nohtml
|
||
showtocdata
|
||
parsoid={
|
||
"modes": [ "wt2html" ],
|
||
"wrapSections": true
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! options
|
||
language=en htmlVariantLanguage=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
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! options
|
||
language=en htmlVariantLanguage=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
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! options
|
||
language=en htmlVariantLanguage=en-x-piglatin
|
||
showtitle
|
||
showtocdata
|
||
parsoid={
|
||
"modes": [ "wt2html" ],
|
||
"wrapSections": true
|
||
}
|
||
!! wikitext
|
||
<!--
|
||
-->-{H|Foo=>en:Boo;Foo=>en-x-piglatin:Bob;}-<!--
|
||
-->-{H|Bar=>en:Bat;Bar=>en-x-piglatin:Ball;}-<!--
|
||
-->-{T|en:Foo;en-x-piglatin:Bar;}-<!--
|
||
-->
|
||
Introduction.
|
||
-{A|en:Do; en-x-piglatin:Re;}-
|
||
== Foo ==
|
||
Foo Do
|
||
== Bar ==
|
||
Bar Re
|
||
== -{Foo Bar}- ==
|
||
!! metadata
|
||
Bar
|
||
Sections:
|
||
h2 index:1 toclevel:1 number:1 title:Parser_test off:192 anchor/linkAnchor:Foo line:Bob
|
||
h2 index:2 toclevel:1 number:2 title:Parser_test off:209 anchor/linkAnchor:Bar line:Ball
|
||
h2 index:3 toclevel:1 number:3 title:Parser_test off:226 anchor/linkAnchor:-.7BFoo_Bar.7D- line:Foo Bar
|
||
!! html/php
|
||
<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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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)
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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)
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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)
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
T352467: synthetic sections shouldn't count towards "enough" sections
|
||
!! options
|
||
showflags
|
||
parsoid={
|
||
"modes": [ "wt2html" ],
|
||
"wrapSections": true
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
<div>
|
||
==a==
|
||
==b==
|
||
</div>
|
||
==c==
|
||
!! metadata
|
||
flags=
|
||
!! html/php
|
||
<div>
|
||
<h2><span class="mw-headline" id="a">a</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: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span class="mw-headline" id="b">b</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">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
</div>
|
||
<h2><span class="mw-headline" id="c">c</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: c">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
!! html/parsoid
|
||
<section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div>
|
||
<section data-mw-section-id="1"><h2 id="a">a</h2>
|
||
</section><section data-mw-section-id="-1"><h2 id="b">b</h2>
|
||
</section></div>
|
||
</section><section data-mw-section-id="3"><h2 id="c">c</h2></section>
|
||
!! end
|
||
|
||
!! test
|
||
T307691: show-toc flag: not "enough" sections, but __FORCETOC__
|
||
!! options
|
||
showflags
|
||
parsoid={
|
||
"wrapSections": true
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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
|
||
!! options
|
||
showflags
|
||
parsoid={
|
||
"wrapSections": true
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
__NOEDITSECTION__
|
||
==Section 1==
|
||
==Section 2==
|
||
!! html/php
|
||
<h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
|
||
<h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
|
||
!! metadata/php
|
||
flags=
|
||
!! html/parsoid
|
||
<section data-mw-section-id="0"><meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
|
||
</section><section data-mw-section-id="1"><h2 id="Section_1" data-parsoid='{}'>Section 1</h2>
|
||
</section><section data-mw-section-id="2"><h2 id="Section_2" data-parsoid='{}'>Section 2</h2></section>
|
||
!! metadata/parsoid
|
||
flags=no-section-edit-links
|
||
!! end
|
||
|
||
!! test
|
||
Link inside a section heading
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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)
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=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]]
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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]]
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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]]
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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" ]
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
__TOC__
|
||
==<span dir="ltr">C++</span>==
|
||
|
||
==<span dir="rtl">זבנג!</span>==
|
||
|
||
==<span style="font-style: italic" dir="ltr" title="hello">Attributes other than dir</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="#Attributes_other_than_dir"><span class="tocnumber">3</span> <span class="toctext"><span dir="ltr">Attributes other than dir</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="Attributes_other_than_dir"><span style="font-style: italic" dir="ltr" title="hello">Attributes other than dir</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: Attributes other than dir">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="Attributes_other_than_dir"><span style="font-style: italic" dir="ltr" title="hello">Attributes other than dir</span></h2>
|
||
!! end
|
||
|
||
!! test
|
||
T74884: bdi element in ToC
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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)
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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)
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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" class="mw-selflink-fragment" 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" class="mw-selflink-fragment" 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" class="mw-selflink-fragment" 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" class="mw-selflink-fragment" 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" class="mw-selflink-fragment" 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" class="mw-selflink-fragment" 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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)
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! 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
|
||
|
||
# Note that HTML (but not wikitext) allows the trailing semicolon to
|
||
# be omitted from an entity, so we need to escape the ampersand in
|
||
# situations where HTML would interpret a "semicolonless" entity.
|
||
!! test
|
||
TOC with HTML entities which are not wikitext entities (T355386)
|
||
!! config
|
||
wgFragmentMode=[ "html5" ]
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! options
|
||
nohtml
|
||
showtocdata
|
||
parsoid={
|
||
"modes": [ "wt2html" ],
|
||
"wrapSections": true
|
||
}
|
||
!! wikitext
|
||
__TOC__
|
||
== F> ==
|
||
Test
|
||
!! metadata
|
||
Sections:
|
||
h2 index:1 toclevel:1 number:1 title:Parser_test off:8 anchor/linkAnchor:F> line:F&GT
|
||
!! end
|
||
|
||
# Note that the metadata section below contains non-breaking spaces around
|
||
# the french quotes, which also show up in the link anchor
|
||
!! test
|
||
TOC with french spacing (T324763)
|
||
!! config
|
||
wgFragmentMode=[ "html5" ]
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! options
|
||
nohtml
|
||
showtocdata
|
||
parsoid={
|
||
"modes": [ "wt2html" ],
|
||
"wrapSections": true
|
||
}
|
||
!! wikitext
|
||
__TOC__
|
||
== Renommer la page « Informatique durable » en « Numérique responsable » ? ==
|
||
Oui.
|
||
!! metadata/php
|
||
Sections:
|
||
h2 index:1 toclevel:1 number:1 title:Parser_test off:8 anchor/linkAnchor:Renommer_la_page_«_Informatique_durable_»_en_«_Numérique_responsable_»_? line:Renommer la page « Informatique durable » en « Numérique responsable » ?
|
||
!! metadata/parsoid
|
||
Sections:
|
||
h2 index:1 toclevel:1 number:1 title:Parser_test off:8 anchor/linkAnchor:Renommer_la_page_«_Informatique_durable_»_en_«_Numérique_responsable_»_? line:Renommer la page «<span> </span>Informatique durable<span> </span>» en «<span> </span>Numérique responsable<span> </span>»<span> </span>?
|
||
!! end
|
||
|
||
!! test
|
||
1. Ensure sections in extensions are ignored + TOC is inserted outside extensions
|
||
!! options
|
||
showtocdata
|
||
parsoid={
|
||
"modes": [ "wt2html" ],
|
||
"wrapSections": true
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
__FORCETOC__
|
||
<spantag>
|
||
==spantag h2==
|
||
</spantag>
|
||
intro
|
||
==page h2==
|
||
blah
|
||
!! html/php
|
||
<p><span>
|
||
</span></p>
|
||
<h2><span class="mw-headline" id="spantag_h2">spantag h2</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: spantag h2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<p>intro
|
||
</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="#page_h2"><span class="tocnumber">1</span> <span class="toctext">page h2</span></a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<h2><span class="mw-headline" id="page_h2">page h2</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: page h2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<p>blah
|
||
</p>
|
||
!! html/parsoid
|
||
<section data-mw-section-id="-1"><meta property="mw:PageProp/forcetoc"/> </section><section data-mw-section-id="-2"><span typeof="mw:Extension/spantag" data-mw='{"name":"spantag","attrs":{},"body":{"extsrc":"\n==spantag h2==\n"}}'>
|
||
<section data-mw-section-id="-1"><h2 id="spantag_h2">spantag h2</h2></section></span>
|
||
<p>intro</p>
|
||
<meta property="mw:PageProp/toc" data-mw='{"autoGenerated":true}'/></section><section data-mw-section-id="1"><h2 id="page_h2">page h2</h2>
|
||
<p>blah</p></section>
|
||
!! metadata
|
||
Sections:
|
||
h2 index:1 toclevel:1 number:1 title:Parser_test off:55 anchor/linkAnchor:page_h2 line:page h2
|
||
!! end
|
||
|
||
!! test
|
||
2. Ensure sections in extensions are ignored + TOC is inserted outside extensions
|
||
!! options
|
||
showtocdata
|
||
parsoid={
|
||
"modes": [ "wt2html" ],
|
||
"wrapSections": true
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
__FORCETOC__
|
||
{{1x|1=foo
|
||
<spantag>
|
||
==spantag h2==
|
||
</spantag>
|
||
}}
|
||
intro
|
||
==page h2==
|
||
blah
|
||
!! html/php
|
||
<p>foo
|
||
<span>
|
||
</span></p>
|
||
<h2><span class="mw-headline" id="spantag_h2">spantag h2</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: spantag h2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<p>intro
|
||
</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="#page_h2"><span class="tocnumber">1</span> <span class="toctext">page h2</span></a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<h2><span class="mw-headline" id="page_h2">page h2</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: page h2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<p>blah
|
||
</p>
|
||
!! html/parsoid
|
||
<section data-mw-section-id="-1" about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":["__FORCETOC__\n",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo\n<spantag>\n==spantag h2==\n</spantag>"}},"i":0}},"\nintro\n"]}'><meta property="mw:PageProp/forcetoc" />
|
||
<p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo\n<spantag>\n==spantag h2==\n</spantag>"}},"i":0}}]}'>foo</p><span about="#mwt2">
|
||
</span></section><section data-mw-section-id="-2" about="#mwt4"><span typeof="mw:Extension/spantag" about="#mwt2" data-mw='{"name":"spantag","attrs":{},"body":{"extsrc":"\n==spantag h2==\n"}}'>
|
||
<section data-mw-section-id="-1"><h2 id="spantag_h2">spantag h2</h2></section></span>
|
||
<p>intro</p>
|
||
<meta property="mw:PageProp/toc" data-mw='{"autoGenerated":true}'/></section><section data-mw-section-id="1"><h2 id="page_h2">page h2</h2>
|
||
<p>blah</p></section>
|
||
!! metadata
|
||
Sections:
|
||
h2 index:1 toclevel:1 number:1 title:Parser_test off:69 anchor/linkAnchor:page_h2 line:page h2
|
||
!! end
|
||
|
||
!! test
|
||
3. Ensure sections in extensions are ignored + TOC is inserted outside extensions
|
||
!! options
|
||
showtocdata
|
||
parsoid={
|
||
"modes": [ "wt2html" ],
|
||
"wrapSections": true
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
__FORCETOC__
|
||
{{1x|1=<spantag>
|
||
==spantag h2==
|
||
</spantag>
|
||
==template h2==
|
||
}}
|
||
intro
|
||
==page h2==
|
||
blah
|
||
!! html/php
|
||
<p><span>
|
||
</span></p>
|
||
<h2><span class="mw-headline" id="spantag_h2">spantag h2</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: spantag h2">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"><a href="#template_h2"><span class="tocnumber">1</span> <span class="toctext">template h2</span></a></li>
|
||
<li class="toclevel-1 tocsection-2"><a href="#page_h2"><span class="tocnumber">2</span> <span class="toctext">page h2</span></a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<h2><span class="mw-headline" id="template_h2">template h2</span></h2>
|
||
<p>intro
|
||
</p>
|
||
<h2><span class="mw-headline" id="page_h2">page h2</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: page h2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<p>blah
|
||
</p>
|
||
!! html/parsoid
|
||
<section data-mw-section-id="-1"><meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__FORCETOC__","magicSrc":"__FORCETOC__"}'/>
|
||
</section><section data-mw-section-id="-2" about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<spantag>\n==spantag h2==\n</spantag>\n==template h2=="}},"i":0}},"\nintro\n"]}'><span typeof="mw:Extension/spantag mw:Transclusion" about="#mwt2" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["","","","\n"]}]],"dsr":[13,74,null,null]}' data-mw='{"name":"spantag","attrs":{},"body":{"extsrc":"\n==spantag h2==\n"},"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<spantag>\n==spantag h2==\n</spantag>\n==template h2=="}},"i":0}}]}'>
|
||
<section data-mw-section-id="-1"><h2 id="spantag_h2">spantag h2</h2>
|
||
</section></span><span about="#mwt2">
|
||
</span><meta property="mw:PageProp/toc" data-mw='{"autoGenerated":true}'/></section><section data-mw-section-id="-1" about="#mwt4"><h2 about="#mwt2" id="template_h2">template h2</h2>
|
||
<p>intro</p>
|
||
</section><section data-mw-section-id="2"><h2 id="page_h2">page h2</h2>
|
||
<p>blah</p></section>
|
||
!! metadata/php
|
||
Sections:
|
||
h2 index: toclevel:1 number:1 title:NULL off:NULL anchor/linkAnchor:template_h2 line:template h2
|
||
h2 index:2 toclevel:1 number:2 title:Parser_test off:81 anchor/linkAnchor:page_h2 line:page h2
|
||
!! metadata/parsoid
|
||
Sections:
|
||
h2 index:T-1 toclevel:1 number:1 title:Template:1x off:NULL anchor/linkAnchor:template_h2 line:template h2
|
||
h2 index:2 toclevel:1 number:2 title:Parser_test off:81 anchor/linkAnchor:page_h2 line:page h2
|
||
!! end
|
||
|
||
!! test
|
||
TOC data when heading content is equal to an id already set on the page
|
||
!! options
|
||
showtocdata
|
||
parsoid={
|
||
"modes": [ "wt2html" ],
|
||
"wrapSections": true
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
<span id="hiho">hiho</span>
|
||
=== hiho ===
|
||
!! html/php
|
||
<p><span id="hiho">hiho</span>
|
||
</p>
|
||
<h3><span class="mw-headline" id="hiho">hiho</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: hiho">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
|
||
!! metadata/php
|
||
Sections:
|
||
h3 index:1 toclevel:1 number:1 title:Parser_test off:28 anchor/linkAnchor:hiho line:hiho
|
||
!! html/parsoid
|
||
<section data-mw-section-id="0"><p><span id="hiho">hiho</span></p>
|
||
</section><section data-mw-section-id="1"><h3 id="hiho_2">hiho</h3></section>
|
||
!! metadata/parsoid
|
||
Sections:
|
||
h3 index:1 toclevel:1 number:1 title:Parser_test off:28 anchor/linkAnchor:hiho_2 line:hiho
|
||
!! end
|
||
|
||
!! test
|
||
TOC data when heading already has an id
|
||
!! options
|
||
showtocdata
|
||
parsoid={
|
||
"modes": [ "wt2html" ],
|
||
"wrapSections": true
|
||
}
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
<h3 id="asdf">odd</h3>
|
||
!! html/php
|
||
<h3 id="asdf"><span class="mw-headline" id="odd">odd</span></h3>
|
||
!! metadata/php
|
||
Sections:
|
||
h3 index: toclevel:1 number:1 title:NULL off:NULL anchor/linkAnchor:odd line:odd
|
||
!! html/parsoid
|
||
<section data-mw-section-id="0"></section><section data-mw-section-id="-1"><h3 id="asdf" data-parsoid='{"stx":"html","reusedId":true}'>odd</h3></section>
|
||
!! metadata/parsoid
|
||
Sections:
|
||
h3 index: toclevel:1 number:1 title:NULL off:NULL anchor/linkAnchor:asdf line:odd
|
||
!! end
|
||
|
||
!! test
|
||
Extra newlines followed by heading
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
a
|
||
|
||
|
||
=b=
|
||
[[a]]
|
||
|
||
|
||
=b=
|
||
!! html
|
||
<p>a
|
||
</p><p><br />
|
||
</p>
|
||
<h1><span class="mw-headline" id="b">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: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
|
||
<p><a href="/wiki/A" title="A">a</a>
|
||
</p><p><br />
|
||
</p>
|
||
<h1><span class="mw-headline" id="b_2">b</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">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
|
||
!! end
|
||
|
||
!! article
|
||
A
|
||
!! text
|
||
Dummy article to suppress redlinks in tests
|
||
!! end
|
||
|
||
!! test
|
||
Extra newlines between heading and content are swallowed (Parsoid does not)
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
=b=
|
||
|
||
|
||
|
||
[[a]]
|
||
!! html/php
|
||
<h1><span class="mw-headline" id="b">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: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
|
||
<p><a href="/wiki/A" title="A">a</a>
|
||
</p>
|
||
!! html/parsoid
|
||
<h1 id="b">b</h1>
|
||
<p>
|
||
<br/></p>
|
||
|
||
<p><a rel="mw:WikiLink" href="./A" title="A" data-parsoid='{"stx":"simple","a":{"href":"./A"},"sa":{"href":"a"}}'>a</a></p>
|
||
!! end
|
||
|
||
!! test
|
||
Heading with line break in nowiki
|
||
!! options
|
||
parsoid=wt2html
|
||
!! config
|
||
wgFragmentMode=[ "html5", "legacy" ]
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
==A <nowiki>B
|
||
C</nowiki>==
|
||
!! html/php
|
||
<h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B_C">A B
|
||
C</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: A B C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
!! html/parsoid
|
||
<h2 id="A_B_C"><span id="A_B.0AC" typeof="mw:FallbackId"></span>A <span typeof="mw:Nowiki">B
|
||
C</span></h2>
|
||
!! end
|
||
|
||
!! test
|
||
Heading with nonbreaking space in prefix/suffix (T235684)
|
||
!! options
|
||
parsoid=wt2html,html2html
|
||
!! config
|
||
wgFragmentMode=[ "html5", "legacy" ]
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
== A B ==
|
||
!! html/php
|
||
<h2><span class="mw-headline" id="_A_B">  A   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: A B ">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
!! html/parsoid
|
||
<h2 id="_A_B"><span typeof="mw:Entity"> </span> A <span typeof="mw:Entity"> </span> B <span typeof="mw:Entity"> </span></h2>
|
||
!! end
|
||
|
||
!! test
|
||
Heading with literal wikitext - the wikitext is not parsed in section edit link tooltip
|
||
!! config
|
||
wgFragmentMode=[ "html5" ]
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
== <nowiki>{{PAGENAME}}</nowiki> ==
|
||
== {{PAGENAME}} ==
|
||
!! html/php
|
||
<h2><span class="mw-headline" id="{{PAGENAME}}">{{PAGENAME}}</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: {{PAGENAME}}">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span class="mw-headline" id="{{PAGENAME}}_2">{{PAGENAME}}</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: {{PAGENAME}}">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
!! end
|
||
|
||
!! article
|
||
Template:Includeonly section
|
||
!! text
|
||
<includeonly>
|
||
==Includeonly section==
|
||
</includeonly>
|
||
==Section T-1==
|
||
!!endarticle
|
||
|
||
!! test
|
||
T8563: Edit link generation for section shown by <includeonly>
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
{{includeonly section}}
|
||
!! html
|
||
<h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&action=edit&section=T-1" title="Edit section: Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&action=edit&section=T-2" title="Edit section: Section T-1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
!! end
|
||
|
||
!! test
|
||
T8563: Edit link generation for section suppressed by <includeonly>
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
<includeonly>
|
||
==Includeonly section==
|
||
</includeonly>
|
||
==Section 1==
|
||
!! html
|
||
<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>
|
||
!! end
|
||
|
||
# Note that Parsoid output differs from the PHP parser here: the PHP
|
||
# parser breaks the URL for the magic word, while in Parsoid the URL
|
||
# production takes precedence.
|
||
!! test
|
||
Fuzz testing: Parser14
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
==onmouseover===
|
||
http://__TOC__
|
||
!! html/php
|
||
<h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</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: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2><p>
|
||
http://</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="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
|
||
</ul>
|
||
</div>
|
||
!! html/parsoid
|
||
<h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
|
||
<p><a rel="mw:ExtLink" href="http://__TOC__" class="external free" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
|
||
!! end
|
||
|
||
!! test
|
||
Fuzz testing: Parser14-table
|
||
!! options
|
||
parsoid=wt2html,html2html
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
==a==
|
||
{| STYLE=__TOC__
|
||
!! html/php
|
||
<h2><span class="mw-headline" id="a">a</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: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<table style="__TOC__">
|
||
<tbody><tr><td></td></tr>
|
||
</tbody></table>
|
||
!! html/parsoid
|
||
<h2 id="a">a</h2>
|
||
<table style="__TOC__"></table>
|
||
!! end
|
||
|
||
|
||
!! article
|
||
MediaWiki:Fake
|
||
!! text
|
||
==header==
|
||
!! endarticle
|
||
|
||
!! test
|
||
Inclusion of !userCanEdit() content
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
{{MediaWiki:Fake}}
|
||
!! html
|
||
<h2><span class="mw-headline" id="header">header</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=MediaWiki:Fake&action=edit&section=T-1" title="Edit section: header">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
!! end
|
||
|
||
!! test
|
||
Morwen/13: Unclosed link followed by heading
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
[[link
|
||
==heading==
|
||
!! html
|
||
<p>[[link
|
||
</p>
|
||
<h2><span class="mw-headline" id="heading">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: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
!! end
|
||
|
||
!! test
|
||
HHP2.1: Heuristics for headings in preprocessor parenthetical structures
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
{{foo|
|
||
=heading=
|
||
!! html
|
||
<p>{{foo|
|
||
</p>
|
||
<h1><span class="mw-headline" id="heading">heading</span></h1>
|
||
!! end
|
||
|
||
!! test
|
||
HHP2.2: Heuristics for headings in preprocessor parenthetical structures
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
{{foo|
|
||
==heading==
|
||
!! html
|
||
<p>{{foo|
|
||
</p>
|
||
<h2><span class="mw-headline" id="heading">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: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
!! end
|
||
|
||
!!article
|
||
Foo
|
||
!!text
|
||
FOO
|
||
!!endarticle
|
||
|
||
!! test
|
||
nowiki inside link inside heading (T20295)
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
==[[foo|x<nowiki>y</nowiki>z]]==
|
||
!! html
|
||
<h2><span class="mw-headline" id="xyz"><a href="/wiki/Foo" title="Foo">xyz</a></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: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
!! end
|
||
|
||
!! test
|
||
Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
|
||
!! config
|
||
wgFragmentMode=[ "html5", "legacy" ]
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! options
|
||
showtocdata
|
||
parsoid={
|
||
"wrapSections": true
|
||
}
|
||
!! wikitext
|
||
==A&B&C&amp;D&amp;amp;E==
|
||
[[#A&B&C&amp;D&amp;amp;E]]
|
||
!! html/php
|
||
<h2><span id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE"></span><span class="mw-headline" id="A&B&C&amp;D&amp;amp;E">A&B&C&amp;D&amp;amp;E</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: A&B&C&amp;D&amp;amp;E">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<p><a href="#A&B&C&amp;D&amp;amp;E">#A&B&C&amp;D&amp;amp;E</a>
|
||
</p>
|
||
!! html/parsoid
|
||
<section data-mw-section-id="0"></section><section data-mw-section-id="1"><h2 id="A&B&C&amp;D&amp;amp;E"><span id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE" typeof="mw:FallbackId"></span>A&B<span typeof="mw:Entity" data-parsoid='{"src":"&amp;","srcContent":"&"}'>&</span>C<span typeof="mw:Entity" data-parsoid='{"src":"&amp;","srcContent":"&"}'>&</span>amp;D<span typeof="mw:Entity" data-parsoid='{"src":"&amp;","srcContent":"&"}'>&</span>amp;amp;E</h2>
|
||
<p><a rel="mw:WikiLink" href="./Parser_test#A&B&C&amp;D&amp;amp;E" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#A&B&C&amp;D&amp;amp;E"},"sa":{"href":"#A&B&amp;C&amp;amp;D&amp;amp;amp;E"}}'>#A&B&C&amp;D&amp;amp;E</a></p></section>
|
||
!! metadata
|
||
Sections:
|
||
h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:A&B&C&D&amp;E line:A&B&C&amp;D&amp;amp;E
|
||
!! end
|
||
|
||
!! test
|
||
Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
|
||
!! config
|
||
wgFragmentMode=[ "legacy" ]
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
==A&B&C&amp;D&amp;amp;E==
|
||
[[#A&B&C&amp;D&amp;amp;E]]
|
||
!! html/php
|
||
<h2><span class="mw-headline" id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">A&B&C&amp;D&amp;amp;E</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: A&B&C&amp;D&amp;amp;E">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&B&C&amp;D&amp;amp;E</a>
|
||
</p>
|
||
!! end
|
||
|
||
# This fragment mode is what Parsoid supports.
|
||
!! test
|
||
HTML5 ids: fallback to legacy
|
||
!! config
|
||
wgFragmentMode=[ "html5", "legacy" ]
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
==Foo bar==
|
||
|
||
==foo Bar==
|
||
|
||
==Тест==
|
||
|
||
==Тест==
|
||
|
||
==тест==
|
||
|
||
==Hey < # " > % : '==
|
||
[[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
|
||
|
||
{{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
|
||
|
||
<!-- These two links should produce identical HTML -->
|
||
[[#啤酒]] [[#%E5%95%A4%E9%85%92]]
|
||
|
||
!! 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">Foo bar</span></a></li>
|
||
<li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
|
||
<li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
|
||
<li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
|
||
<li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
|
||
<li class="toclevel-1 tocsection-6"><a href="#Hey_<_#_"_>_%_:_'"><span class="tocnumber">6</span> <span class="toctext">Hey < # " > % : '</span></a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<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>
|
||
<h2><span id=".D0.A2.D0.B5.D1.81.D1.82"></span><span class="mw-headline" id="Тест">Тест</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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span id=".D0.A2.D0.B5.D1.81.D1.82_2"></span><span class="mw-headline" id="Тест_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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span id=".D1.82.D0.B5.D1.81.D1.82"></span><span class="mw-headline" id="тест">тест</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: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span id="Hey_.3C_.23_.22_.3E_.25_:_.27"></span><span class="mw-headline" id="Hey_<_#_"_>_%_:_'">Hey < # " > % : '</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: Hey < # " > % : '">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_<_#_"_>_%_:_'">#Hey < # " > % : '</a>
|
||
</p><p>💩 <span id="💩"></span>
|
||
</p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
|
||
</p>
|
||
!! html/parsoid
|
||
<h2 id="Foo_bar">Foo bar</h2>
|
||
|
||
<h2 id="foo_Bar_2">foo Bar</h2>
|
||
|
||
<h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
|
||
|
||
<h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
|
||
|
||
<h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
|
||
|
||
<h2 id="Hey_<_#_"_>_%_:_'"><span id="Hey_.3C_.23_.22_.3E_.25_:_.27" typeof="mw:FallbackId"></span>Hey < # " ><span typeof="mw:DisplaySpace"> </span>%<span typeof="mw:DisplaySpace"> </span>: '</h2>
|
||
<p><a rel="mw:WikiLink" href="./Parser_test#Foo_bar" class="mw-selflink-fragment">#Foo bar</a> <a rel="mw:WikiLink" href="./Parser_test#foo_Bar" class="mw-selflink-fragment">#foo Bar</a> <a rel="mw:WikiLink" href="./Parser_test#Тест" class="mw-selflink-fragment">#Тест</a> <a rel="mw:WikiLink" href="./Parser_test#тест" class="mw-selflink-fragment">#тест</a> <a rel="mw:WikiLink" href="./Parser_test#Hey_<_#_"_>_%_:_'" class="mw-selflink-fragment">#Hey < # " ><span typeof="mw:DisplaySpace"> </span>%<span typeof="mw:DisplaySpace"> </span>: '</a></p>
|
||
|
||
<p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:💩","function":"anchorencode"},"params":{},"i":0}}]}'>💩</span> <span id="💩" about="#mwt3" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"id"},{"html":"<span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[]],\"dsr\":[178,197,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:💩\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}'>💩</span>"}]]}'></span></p>
|
||
|
||
<!-- These two links should produce identical HTML -->
|
||
<p><a rel="mw:WikiLink" href="./Parser_test#啤酒" class="mw-selflink-fragment">#啤酒</a> <a rel="mw:WikiLink" href="./Parser_test#啤酒" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#啤酒"},"sa":{"href":"#%E5%95%A4%E9%85%92"}}'>#啤酒</a></p>
|
||
!! end
|
||
|
||
# Parsoid doesn't support this mode
|
||
!! test
|
||
HTML5 ids: legacy with a fallback to modern
|
||
!! config
|
||
wgFragmentMode=[ "legacy", "html5" ]
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
==Foo bar==
|
||
|
||
==foo Bar==
|
||
|
||
==Тест==
|
||
|
||
==Тест==
|
||
|
||
==тест==
|
||
|
||
==Hey < # " > % : '==
|
||
[[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
|
||
|
||
{{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
|
||
|
||
<!-- These two links should produce identical HTML -->
|
||
[[#啤酒]] [[#%E5%95%A4%E9%85%92]]
|
||
|
||
!! 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">Foo bar</span></a></li>
|
||
<li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
|
||
<li class="toclevel-1 tocsection-3"><a href="#.D0.A2.D0.B5.D1.81.D1.82"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
|
||
<li class="toclevel-1 tocsection-4"><a href="#.D0.A2.D0.B5.D1.81.D1.82_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
|
||
<li class="toclevel-1 tocsection-5"><a href="#.D1.82.D0.B5.D1.81.D1.82"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
|
||
<li class="toclevel-1 tocsection-6"><a href="#Hey_.3C_.23_.22_.3E_.25_:_.27"><span class="tocnumber">6</span> <span class="toctext">Hey < # " > % : '</span></a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<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>
|
||
<h2><span id="Тест"></span><span class="mw-headline" id=".D0.A2.D0.B5.D1.81.D1.82">Тест</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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span id="Тест_2"></span><span class="mw-headline" id=".D0.A2.D0.B5.D1.81.D1.82_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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span id="тест"></span><span class="mw-headline" id=".D1.82.D0.B5.D1.81.D1.82">тест</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: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span id="Hey_<_#_"_>_%_:_'"></span><span class="mw-headline" id="Hey_.3C_.23_.22_.3E_.25_:_.27">Hey < # " > % : '</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: Hey < # " > % : '">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#.D0.A2.D0.B5.D1.81.D1.82">#Тест</a> <a href="#.D1.82.D0.B5.D1.81.D1.82">#тест</a> <a href="#Hey_.3C_.23_.22_.3E_.25_:_.27">#Hey < # " > % : '</a>
|
||
</p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
|
||
</p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
|
||
</p>
|
||
!! end
|
||
|
||
# Parsoid doesn't support this mode.
|
||
!! test
|
||
HTML5 ids: no legacy
|
||
!! config
|
||
wgFragmentMode=[ "html5" ]
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
==Foo bar==
|
||
|
||
==foo Bar==
|
||
|
||
==Тест==
|
||
|
||
==Тест==
|
||
|
||
==тест==
|
||
|
||
==Hey < # " > % : '==
|
||
[[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
|
||
|
||
{{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
|
||
|
||
<!-- These two links should produce identical HTML -->
|
||
[[#啤酒]] [[#%E5%95%A4%E9%85%92]]
|
||
|
||
!! 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">Foo bar</span></a></li>
|
||
<li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
|
||
<li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
|
||
<li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
|
||
<li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
|
||
<li class="toclevel-1 tocsection-6"><a href="#Hey_<_#_"_>_%_:_'"><span class="tocnumber">6</span> <span class="toctext">Hey < # " > % : '</span></a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<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>
|
||
<h2><span class="mw-headline" id="Тест">Тест</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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span class="mw-headline" id="Тест_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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span class="mw-headline" id="тест">тест</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: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span class="mw-headline" id="Hey_<_#_"_>_%_:_'">Hey < # " > % : '</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: Hey < # " > % : '">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_<_#_"_>_%_:_'">#Hey < # " > % : '</a>
|
||
</p><p>💩 <span id="💩"></span>
|
||
</p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
|
||
</p>
|
||
!! end
|
||
|
||
!! test
|
||
T90902: Normalize weird characters in section IDs
|
||
!! config
|
||
wgFragmentMode=[ "html5", "legacy" ]
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
==Foo bar==
|
||
[[#Foo bar]]
|
||
|
||
!! html/php
|
||
<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>
|
||
<p><a href="#Foo_bar">#Foo bar</a>
|
||
</p>
|
||
!! html/parsoid
|
||
<h2 id="Foo_bar">Foo<span typeof="mw:Entity" data-parsoid='{"src":"&nbsp;","srcContent":" "}'> </span>bar</h2>
|
||
<p><a rel="mw:WikiLink" href="./Parser_test#Foo_bar" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Foo_bar"},"sa":{"href":"#Foo&nbsp;bar"}}'>#Foo bar</a></p>
|
||
!! end
|
||
|
||
!! test
|
||
mw-heading wrapper edge cases
|
||
!! options
|
||
notoc
|
||
!! config
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
==Normal heading!==
|
||
|
||
<h2>HTML heading!</h2>
|
||
|
||
<h2 style="border: 1px solid green; background: lightgreen; padding: 5px; font-size: 1.5em;">HTML heading with attributes!</h2>
|
||
|
||
<div class="mw-heading mw-heading2">
|
||
==Normal heading with existing wrapper!==
|
||
</div>
|
||
!! html/php
|
||
|
||
<h2><span class="mw-headline" id="Normal_heading.21">Normal 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: Normal heading!">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span class="mw-headline" id="HTML_heading.21">HTML heading!</span></h2>
|
||
<h2 style="border: 1px solid green; background: lightgreen; padding: 5px; font-size: 1.5em;"><span class="mw-headline" id="HTML_heading_with_attributes.21">HTML heading with attributes!</span></h2>
|
||
<div class="mw-heading mw-heading2">
|
||
<h2><span class="mw-headline" id="Normal_heading_with_existing_wrapper.21">Normal heading with existing wrapper!</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: Normal heading with existing wrapper!">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
</div>
|
||
!! html/parsoid
|
||
<h2 id="Normal_heading!" data-parsoid='{"dsr":[0,19,2,2]}'><span id="Normal_heading.21" typeof="mw:FallbackId" data-parsoid='{"dsr":[2,2,null,null]}'></span>Normal heading!</h2>
|
||
|
||
<h2 id="HTML_heading!" data-parsoid='{"stx":"html","dsr":[21,43,4,5]}'><span id="HTML_heading.21" typeof="mw:FallbackId" data-parsoid='{"dsr":[25,25,null,null]}'></span>HTML heading!</h2>
|
||
|
||
<h2 style="border: 1px solid green; background: lightgreen; padding: 5px; font-size: 1.5em;" id="HTML_heading_with_attributes!" data-parsoid='{"stx":"html","dsr":[45,172,93,5]}'><span id="HTML_heading_with_attributes.21" typeof="mw:FallbackId" data-parsoid='{"dsr":[138,138,null,null]}'></span>HTML heading with attributes!</h2>
|
||
|
||
<div class="mw-heading mw-heading2" data-parsoid='{"stx":"html","dsr":[174,259,36,6]}'>
|
||
<h2 id="Normal_heading_with_existing_wrapper!" data-parsoid='{"dsr":[211,252,2,2]}'><span id="Normal_heading_with_existing_wrapper.21" typeof="mw:FallbackId" data-parsoid='{"dsr":[213,213,null,null]}'></span>Normal heading with existing wrapper!</h2>
|
||
</div>
|
||
!! end
|
||
|
||
!! test
|
||
T365413: Headings with dollar signs
|
||
!! options
|
||
wgParserEnableLegacyHeadingDOM=true
|
||
!! wikitext
|
||
==$text==
|
||
|
||
==$ text==
|
||
|
||
==text $text==
|
||
|
||
==\$text==
|
||
|
||
==$$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="#.24text"><span class="tocnumber">1</span> <span class="toctext">$text</span></a></li>
|
||
<li class="toclevel-1 tocsection-2"><a href="#.24_text"><span class="tocnumber">2</span> <span class="toctext">$ text</span></a></li>
|
||
<li class="toclevel-1 tocsection-3"><a href="#text_.24text"><span class="tocnumber">3</span> <span class="toctext">text $text</span></a></li>
|
||
<li class="toclevel-1 tocsection-4"><a href="#.5C.24text"><span class="tocnumber">4</span> <span class="toctext">\$text</span></a></li>
|
||
<li class="toclevel-1 tocsection-5"><a href="#.24.24text"><span class="tocnumber">5</span> <span class="toctext">$$text</span></a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<h2><span class="mw-headline" id=".24text">$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">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span class="mw-headline" id=".24_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">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span class="mw-headline" id="text_.24text">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>
|
||
<h2><span class="mw-headline" id=".5C.24text">\$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">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
<h2><span class="mw-headline" id=".24.24text">$$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">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
|
||
!! end
|