From 708e8e9dee4523997a2dfe73e312db18725e782b Mon Sep 17 00:00:00 2001 From: Subramanya Sastry Date: Tue, 21 Nov 2017 17:07:03 -0500 Subject: [PATCH] Sync up with Parsoid parserTests.txt This now aligns with Parsoid commit 0723e5c47845ff4361b9635b591e7d386c975fdf Change-Id: Ic78ee28a5cdeb9d32147332bf6c06bbe6ab19acd --- tests/parser/parserTests.txt | 408 ++++++++++++++++++++++++++++++++++- 1 file changed, 406 insertions(+), 2 deletions(-) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index c3cea0457c..7af3a3655b 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -15181,7 +15181,7 @@ parsoid=wt2html,wt2wt,html2html
lang=invalid:language:code
!! html/parsoid -
lang=invalid.language.code
+
lang=invalid:language:code
!! end !! test @@ -18549,10 +18549,14 @@ language=sr variant=sr-el -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}- [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]] -!! html +!! html/php

" onload="alert(1)" data-foo="

+!! html/parsoid +

+ +

foAjrjvi

!! end !! test @@ -29740,3 +29744,403 @@ wgFragmentMode=[ 'html5' ]

#[foo]

!! end + +## ------------------------------ +## Parsoid section-wrapping tests +## ------------------------------ +!! test +Section wrapping for well-nested sections (no leading content) +!! options +parsoid={ + "wrapSections": true +} +!! wikitext += 1 = +a + += 2 = +b + +== 2.1 == +c + +== 2.2 == +d + +=== 2.2.1 === +e + += 3 = +f +!! html/parsoid +

1

+

a

+ +

2

+

b

+ +

2.1

+

c

+ +

2.2

+

d

+ +

2.2.1

+

e

+ +

3

+

f

+ +
+!! end + +!! test +Section wrapping for well-nested sections (with leading content) +!! options +parsoid={ + "wrapSections": true +} +!! wikitext +Para 1. + +Para 2 with a
nested in it
+ +Para 3. + += 1 = +a + += 2 = +b + +== 2.1 == +c +!! html/parsoid +

Para 1.

+ +

Para 2 with a

nested in it
+ +

Para 3.

+ +

1

+

a

+ +

2

+

b

+ +

2.1

+

c

+ +
+!! end + +!! test +Section wrapping with template-generated sections (good nesting 1) +!! options +parsoid={ + "wrapSections": true +} +!! wikitext += 1 = +a + +{{echo|1= +== 1.1 == +b +}} + +== 1.2 == +c + += 2 = +d +!! html/parsoid +

1

+

a

+ +

1.1

+

b

+

1.2

+

c

+ +

2

+

d

+!! end + +# In this example, the template scope is mildly expanded to incorporate the +# trailing newline after the transclusion since that is part of section 1.1.1 +!! test +Section wrapping with template-generated sections (good nesting 2) +!! options +parsoid={ + "wrapSections": true, + "modes": ["wt2html", "wt2wt"] +} +!! wikitext += 1 = +a + +{{echo|1= +== 1.1 == +b +=== 1.1.1 === +d +}} += 2 = +e +!! html/parsoid +

1

+

a

+ +

1.1

+

b

+

1.1.1

+

d

+

2

+

e

+!! end + +# In this example, the template scope is mildly expanded to incorporate the +# trailing newline after the transclusion since that is part of section 1.2.1 +!! test +Section wrapping with template-generated sections (good nesting 3) +!! options +parsoid={ + "wrapSections": true, + "modes": ["wt2html", "wt2wt"] +} +!! wikitext += 1 = +a + +{{echo|1= +x +== 1.1 == +b +==1.2== +c +===1.2.1=== +d +}} += 2 = +e +!! html/parsoid +

1

+

a

+ +

x

+

1.1

+

b

+

1.2

+

c

+

1.2.1

+

d

+

2

+

e

+!! end + +# Because of section-wrapping and template-wrapping interactions, +# the scope of the template is expanded so that the template markup +# is valid in the presence of
tags. +!! test +Section wrapping with template-generated sections (bad nesting 1) +!! options +parsoid={ + "wrapSections": true +} +!! wikitext += 1 = +a + +{{echo|1= += 2 = +b +== 2.1 == +c +}} + +d + += 3 = +e +!! html/parsoid +

1

+

a

+ +

2

+

b

+

2.1

+

c

+ +

d

+ +

3

+

e

+!! end + +# Because of section-wrapping and template-wrapping interactions, +# additional template wrappers are added to
tags +# so that template wrapping semantics are valid whether section +# tags are retained or stripped. But, the template scope can expand +# greatly when accounting for section tags. +!! test +Section wrapping with template-generated sections (bad nesting 2) +!! options +parsoid={ + "wrapSections": true, + "modes": ["wt2html", "wt2wt"] +} +!! wikitext += 1 = +a + +{{echo|1= +== 1.2 == +b += 2 = +c +}} + +d + += 3 = +e +!! html/parsoid +

1

+

a

+ +

1.2

+

b

+

2

+

c

+ +

d

+

3

+

e

+!! end + +!! test +Section wrapping with uneditable lead section + div wrapping multiple sections +!! options +parsoid={ + "wrapSections": true +} +!! wikitext +foo + +
+= 1 = +a + +== 1.1 == +b + += 2 = +c +
+ += 3 = +d + +== 3.1 == +e +!! html/parsoid +

foo

+ +
+

1

+

a

+ +

1.1

+

b

+ +

2

+

c

+
+ +

3

+

d

+ +

3.1

+

e

+
+!! end + +!! test +Section wrapping with editable lead section + div overlapping multiple sections +!! options +parsoid={ + "wrapSections": true +} +!! wikitext +foo + += 1 = +a +
+b + +== 1.1 == +c + += 2 = +d +
+e + += 3 = +f + +== 3.1 == +g +!! html/parsoid +

foo

+ +

1

+

a

+
+

b

+ +

1.1

+

c

+ +

2

+

d

+
+

e

+ +

3

+

f

+ +

3.1

+

g

+
+!! end + +!! test +HTML header tags should not be wrapped in section tags +!! options +parsoid={ + "wrapSections": true +} +!! wikitext +foo + +

a

+ += b = + +

c

+ += d = +!! html/parsoid +

foo

+ +

a

+ +

b

+ +

c

+ +

d

+!! end -- 2.20.1