From: Arlo Breault
Date: Wed, 30 Dec 2015 00:30:43 +0000 (-0800)
Subject: Sync up with Parsoid parserTests.
X-Git-Tag: 1.31.0-rc.0~8519
X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/voir.php?a=commitdiff_plain;h=edf52ea0767467f205e91aeae1664f718f9b0860;p=lhc%2Fweb%2Fwiklou.git
Sync up with Parsoid parserTests.
This now aligns with Parsoid commit cc0dfb3271495d764e471d18927b0b3ee8ce1cdb
Change-Id: I3fd6f8cc31a5536471a04d2f6a52de92893f9911
---
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index 0ed8270e50..d0a3d08b62 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -14,6 +14,7 @@
# Plus any combination of these:
#
# cat add category links
+# (ignored by Parsoid, since it emits s)
# ill add inter-language links
# (ignored by Parsoid, since it emits s)
# subpage enable subpages (disabled by default)
@@ -1335,6 +1336,8 @@ array (
)
+!! html/parsoid
+
!! end
!! test
@@ -3329,14 +3332,18 @@ parsoid=wt2html,wt2wt
!! end
+## We used to, but no longer wt2wt this test since the default serializer
+## will normalize all categories to serialize on their own line.
+## This wikitext usage is going to be fairly uncommon in production and
+## selser will take care of preserving formatting in those scenarios.
!! test
7b. Indent-pre and category links
!! options
-parsoid=wt2html,wt2wt
+parsoid=wt2html
!! wikitext
[[Category:foo]] a
[[Category:foo]] {{echo|b}}
-!! html
+!! html/parsoid
a
b
!! end
@@ -7119,6 +7126,17 @@ Piped link with multiple pipe characters in link text
!! end
+!! test
+Piped link with no link text
+!! wikitext
+[[Thomas Bek (bishop of St David's)|]]
+!! html/php
+
[[Thomas Bek (bishop of St David's)|]]
+
+!! html/parsoid
+
[[Thomas Bek (bishop of St David's)|]]
+!! end
+
!! test
Broken link
!! wikitext
@@ -10860,8 +10878,14 @@ Un-closed
!! html
!! end
+## We used to, but no longer wt2wt this test since the default serializer
+## will normalize the include directives to serialize on their own line.
+## Selser will take care of preserving formatting in scenarios where they
+## intermingled with other wikitext.
!! test
Includes and comments at SOL
+!! options
+parsoid=wt2html,html2html
!! wikitext
== hu ==
@@ -11042,10 +11066,14 @@ parsoid=wt2html,wt2wt
!!end
+## We used to, but no longer wt2wt this test since the default serializer
+## will normalize the include directives to serialize on their own line.
+## Selser will take care of preserving formatting in scenarios where they
+## intermingled with other wikitext.
!!test
2. Table tag in SOL posn. should get reparsed correctly with valid TSR
!!options
-parsoid=wt2html,wt2wt
+parsoid=wt2html
!!wikitext
a{| {{{b}}}
|c
@@ -14245,7 +14273,7 @@ cat
pst
!! wikitext
[[Category:MediaWiki User's Guide|]]
-!! html
+!! html/php
[[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
!! end
@@ -14256,19 +14284,26 @@ cat
pst
!! wikitext
[[Category:Foo (bar)|]]
-!! html
+!! html/php
[[Category:Foo (bar)|Foo]]
!! end
+## We used to, but no longer wt2wt this test since the default serializer
+## will normalize all categories to serialize on their own line.
+## This wikitext usage is going to be fairly uncommon in production and
+## selser will take care of preserving formatting in those scenarios.
!! test
Category with link tail
!! options
cat
pst
+parsoid=wt2html
!! wikitext
123[[Category:Foo]]456
-!! html
+!! html/php
123[[Category:Foo]]456
+!! html/parsoid
+
123456
!! end
!! test
@@ -14278,7 +14313,7 @@ cat
pst
!! wikitext
[[Category:{{echo|Foo}}]]
-!! html
+!! html/php
[[Category:{{echo|Foo}}]]
!! end
@@ -14289,7 +14324,7 @@ cat
pst
!! wikitext
[[Category:Foo|{{echo|Bar}}]]
-!! html
+!! html/php
[[Category:Foo|{{echo|Bar}}]]
!! end
@@ -14300,12 +14335,18 @@ cat
pst
!! wikitext
[[Category:{{echo|Foo}}|{{echo|Bar}}]]
-!! html
+!! html/php
[[Category:{{echo|Foo}}|{{echo|Bar}}]]
!! end
+## We used to, but no longer wt2wt this test since the default serializer
+## will normalize all categories to serialize on their own line.
+## This wikitext usage is going to be fairly uncommon in production and
+## selser will take care of preserving formatting in those scenarios.
!! test
Category / paragraph interactions
+!! options
+parsoid=wt2html
!! wikitext
Foo [[Category:Baz]] Bar
@@ -14332,7 +14373,7 @@ Bar
[[Category:Baz]]
{{echo|[[Category:Baz]]}}
[[Category:Baz]]
-!! html
+!! html/php
Foo Bar
Foo
Bar
@@ -14342,20 +14383,32 @@ Bar
Foo
Bar
+!! html/parsoid
+
Foo Bar
+
Foo Bar
+
Foo Bar
+
Foo Bar
+
Foo Bar
+
!! end
+## We used to, but no longer wt2wt this test since the default serializer
+## will normalize all categories to serialize on their own line.
+## This wikitext usage is going to be fairly uncommon in production and
+## selser will take care of preserving formatting in those scenarios.
+##
## The whitespace on the empty line is part of the test. Please do not delete
!! test
1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
!! options
-parsoid=wt2html,wt2wt
+parsoid=wt2html
!! wikitext
This
[[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
{{echo|[[Category:Foo]] and so should this!}}
-!! html
+!! html/php
This and this should be part of same paragraph (not an indent-pre) and so should this!
!! html/parsoid
@@ -14453,8 +14506,14 @@ parsoid=wt2html
!! end
+## We used to, but no longer wt2wt this test since the default serializer
+## will normalize all categories to serialize on their own line.
+## This wikitext usage is going to be fairly uncommon in production and
+## selser will take care of preserving formatting in those scenarios.
!! test
6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
+!! options
+parsoid=wt2html
!! wikitext
* a [[Category:Foo]]
!! html/parsoid
@@ -14505,13 +14564,20 @@ parsoid
!! end
-# html2wt localizes the "Category" namespace.
-# XXX the element needs an empty data-parsoid attribute, or
-# else the html2html test fails because spaces are inserted.
+# We used to, but no longer wt2wt this test since the default serializer
+# will normalize all categories to serialize on their own line.
+# This wikitext usage is going to be fairly uncommon in production and
+# selser will take care of preventing whitespace insertion if this
+# occurs in an article.
+#
+# html2html disabled for the same reason (whitespace insertion between
+# x and y).
+#
+# html2wt disabled because it localizes the "Category" namespace.
!! test
Link prefix/suffixes aren't applied to category links
!! options
-parsoid=wt2html,wt2wt,html2html
+parsoid=wt2html
language=is
!! wikitext
x[[Category:Foo]]y
@@ -16152,10 +16218,15 @@ array (
)
+!! html/parsoid
+
!! end
+## Don't expect parsoid to rt this form.
!! test
Parser hook: empty input using terminated empty elements
+!! options
+parsoid=wt2html,html2html
!! wikitext
!! html/php
@@ -16165,6 +16236,8 @@ array (
)
+!! html/parsoid
+
!! end
!! test
@@ -16178,6 +16251,8 @@ array (
)
+!! html/parsoid
+
!! end
!! test
@@ -16191,11 +16266,15 @@ array (
)
+!! html/parsoid
+
!! end
-
+## Don't expect parsoid to rt this form.
!! test
Parser hook: case insensitive
+!! options
+parsoid=wt2html,html2html
!! wikitext
input
!! html/php
@@ -16205,11 +16284,15 @@ array (
)
+!! html/parsoid
+
!! end
-
+## Don't expect parsoid to rt this form.
!! test
Parser hook: case insensitive, redux
+!! options
+parsoid=wt2html,html2html
!! wikitext
input
!! html/php
@@ -16219,6 +16302,8 @@ array (
)
+!! html/parsoid
+
!! end
!! test
@@ -16234,11 +16319,35 @@ array (
)
</tag>
+!! html/parsoid
+</tag>
!! end
!! test
Parser hook: basic arguments
!! wikitext
+
+!! html/php
+
+
+!! html/parsoid
+
+!! end
+
+## Don't expect parsoid to rt this form.
+!! test
+Parser hook: basic arguments, variations
+!! options
+parsoid=wt2html,html2html
+!! wikitext
!! html/php
@@ -16251,12 +16360,14 @@ array (
)
+!! html/parsoid
+
!! end
!! test
Parser hook: argument containing a forward slash (bug 5344)
!! wikitext
-
+
!! html/php
''
@@ -16265,10 +16376,15 @@ array (
)
+!! html/parsoid
+
!! end
+## Don't expect parsoid to rt this form.
!! test
Parser hook: empty input using terminated empty elements (bug 2374)
+!! options
+parsoid=wt2html,html2html
!! wikitext
text
!! html/php
@@ -16279,6 +16395,8 @@ array (
)
text
+!! html/parsoid
+text
!! end
# should be output literally since there is no matching tag that begins it
@@ -16311,21 +16429,28 @@ array (
Parser hook: static parser hook not inside a comment
!! wikitext
hello, world
-
+
+
!! html/php
-
hello, world
+
+hello, world
+!! html/parsoid
+
+
hello, world
!! end
-
!! test
Parser hook: static parser hook inside a comment
!! wikitext
-
+
!! html/php
+!! html/parsoid
+
+
!! end
# Nested template calls; this case was broken by Parser.php rev 1.506,
@@ -19211,17 +19336,25 @@ Category:åé¡
blah
!! endarticle
+## We used to, but no longer wt2wt this test since the default serializer
+## will normalize all categories to serialize on their own line.
+## This wikitext usage is going to be fairly uncommon in production and
+## selser will take care of preserving formatting in those scenarios.
!! test
Don't convert blue categorylinks to another variant (bug 33210)
!! options
-language=zh cat
+cat
+language=zh
+parsoid=wt2html
!! wikitext
[[A]][[Category:åç±»]]
-!! html
+!! html/php
åç±»
+!! html/parsoid
+
+
!! end
-
!! test
Stripping -{}- tags (language variants)
!! options
@@ -19756,7 +19889,7 @@ Tildes in comments
pst
!! wikitext
-!! html
+!! html/php
!! end
@@ -20078,7 +20211,7 @@ Edit comment with link
comment
!! wikitext
I like the [[Main Page]] a lot
-!! html
+!! html/php
I like the Main Page a lot
!!end
@@ -20088,7 +20221,7 @@ Edit comment with link and link text
comment
!! wikitext
I like the [[Main Page|best pages]] a lot
-!! html
+!! html/php
I like the best pages a lot
!!end
@@ -20098,7 +20231,7 @@ Edit comment with link and link text with suffix
comment
!! wikitext
I like the [[Main Page|best page]]s a lot
-!! html
+!! html/php
I like the best pages a lot
!!end
@@ -20108,7 +20241,7 @@ Edit comment with section link (non-local, eg in history list)
comment title=[[Main Page]]
!! wikitext
/* External links */ removed bogus entries
-!! html
+!! html/php
ââExternal links: removed bogus entries
!!end
@@ -20118,7 +20251,7 @@ Edit comment with section link and text before it (non-local, eg in history list
comment title=[[Main Page]]
!! wikitext
pre-comment text /* External links */ removed bogus entries
-!! html
+!! html/php
pre-comment text ââExternal links: removed bogus entries
!!end
@@ -20128,7 +20261,7 @@ Edit comment with section link (local, eg in diff view)
comment local title=[[Main Page]]
!! wikitext
/* External links */ removed bogus entries
-!! html
+!! html/php
ââExternal links: removed bogus entries
!!end
@@ -20140,7 +20273,7 @@ subpage
title=[[Subpage test]]
!! wikitext
Poked at a [[/subpage]] here...
-!! html
+!! html/php
Poked at a /subpage here...
!!end
@@ -20152,7 +20285,7 @@ subpage
title=[[Subpage test]]
!! wikitext
Poked at a [[/subpage|neat little page]] here...
-!! html
+!! html/php
Poked at a neat little page here...
!!end
@@ -20163,7 +20296,7 @@ comment
title=[[Subpage test]]
!! wikitext
Poked at a [[/subpage]] here...
-!! html
+!! html/php
Poked at a /subpage here...
!!end
@@ -20175,7 +20308,7 @@ local
title=[[Main Page]]
!! wikitext
[[#section]]
-!! html
+!! html/php
#section
!! end
@@ -20186,24 +20319,28 @@ comment
title=[[Main Page]]
!! wikitext
[[#section]]
-!! html
+!! html/php
#section
!! end
!! test
Anchor starting with underscore
+!! options
+title=[[Foo]]
!! wikitext
[[#_ref|One]]
-!! html
+!! html/php
!! end
!! test
Id starting with underscore
!! wikitext
-!! html
+!! html/*
!! end
@@ -20215,7 +20352,7 @@ comment
title=[[Main Page]]
!! wikitext
/* __hello__world__ */
-!! html
+!! html/php
ââ__hello__world__
!! end
@@ -20534,11 +20671,14 @@ HTML5 data attributes
!! wikitext
Baz
Quuz
-!! html
+!! html/php
Baz
Quuz
+!! html/parsoid
+
Baz
+
Quuz
!! end
!! test
@@ -21386,14 +21526,12 @@ parsoid=wt2html,wt2wt
!!test
Ref: 1. ref-location should be replaced with an index span
-!!options
-parsoid
!! wikitext
A foo
B foo
C
-!! html
+!! html/parsoid
@@ -21455,15 +21587,13 @@ A foo
!!test
Ref: 5. body should accept generic wikitext
-!!options
-parsoid
!! wikitext
A
This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
-!! html
+!! html/parsoid
@@ -21474,8 +21604,6 @@ A
!!test
Ref: 6. indent-pres should not be output in ref-body
-!!options
-parsoid
!! wikitext
A
foo
@@ -21484,7 +21612,7 @@ A
-!! html
+!! html/parsoid
!!end
!!test
Ref: 9. unclosed comments should not leak out of ref-body
-!!options
-parsoid
!! wikitext
A foo
@@ -21563,13 +21685,11 @@ A foo [[Category:A3]] how goes it ==
+== [[Category:A3]] how goes it ==
-== it goes well [[Category:A4]] ==
+== it goes well [[Category:A4]] ==
-==howdy [[Category:A5]] ==
+==howdy [[Category:A5]]==
== __TOC__ ok ==
!! end
@@ -25620,7 +25754,7 @@ parsoid={ "modes": ["html2wt"], "suppressErrors": true }
# shown to sneak through on occasion. See T101768.
# The original wikitext here is: [http://test.com [[one]] two three]
!! test
-Strip span tags added to mark as misnested
+Strip span tags added to mark misnested links
!! options
parsoid=html2wt
!! html/parsoid
@@ -25629,10 +25763,112 @@ parsoid=html2wt
[http://test.com][[one]] two three
!! end
+!! test
+Use data-parsoid.firstWikitextNode to compute newline constraints for template content
+!! options
+parsoid=html2wt
+!! html/parsoid
+a
+
d
+
+
+!! wikitext
+{{echo|a}}
+{|{{echo|c
+{{!}}d
+}}
+|}
+!! end
+
+## This test verifies the presence and computation of this attribute indirectly
+## by making an edit and ensuring that the serialization is correct (which it would be
+## only if firstWikitextNode is properly set).
+!! test
+data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
+!! options
+parsoid= {
+ "modes": ["wt2wt"],
+ "changes": [
+ [ "div#x", "remove" ],
+ [ "div", "before", "
new
" ]
+ ]
+}
+!! wikitext
+
foo
+{|
+{{echo|
boo
+{{!}}b}}
+|c
+|}
+!! wikitext/edited
+
+
new
+{|
+{{echo|
boo
+{{!}}b}}
+|c
+|}
+!! end
+
# --------------------------------------------
# Tests spec'ing wikitext serialization norms |
# --------------------------------------------
+!! test
+1. Categories should always be serialized on their own line
+!! options
+parsoid=html2wt
+!! html/parsoid
+foobar
+!! wikitext
+foo
+[[Category:Foo]]
+bar
+!! end
+
+!! test
+2. Categories that are part of templates should not introduce a line break
+!! wikitext
+foo {{echo|bar [[Category:baz]]}} bar
+!! html/parsoid
+
foo bar bar
+!! end
+
+# Careful while editing these next 2 tests. There are \u200f characters
+# before and after the tags in the HTML and following some
+# of the categories in wikitext
+# Do not remove these characters in edits.
+#
+# As part of the serialization, these bidi characters will get stripped.
+!! test
+RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
+!! options
+parsoid={
+ "modes": ["html2wt"],
+ "scrubWikitext": true
+}
+!! html/parsoid
+
+!! wikitext
+[[ק×××ר××:×קס××]]
+ây
+!! end
+
!! test
Lists: Add space after bullets
!! options
@@ -25720,6 +25956,35 @@ parsoid={
!! wikitext/edited
!! end
+!! test
+Headings: Replace with a single whitespace char (when scrubWikitext = true)
+!! options
+parsoid={
+ "modes": ["html2wt"],
+ "scrubWikitext": true
+}
+!! html/parsoid
+
foo bar
+
foo bar baz
+!! wikitext
+== foo bar ==
+
+== foo bar baz ==
+!! end
+
+!! test
+Headings: Replace with a single whitespace char (when scrubWikitext = false)
+!! options
+parsoid={
+ "modes": ["html2wt"],
+ "scrubWikitext": false
+}
+!! html/parsoid
+
foo bar
+!! wikitext
+== foo bar ==
+!! end
+
!! test
1. WT Quote Tags: suppress newly created empty style tags
!! options
@@ -26225,10 +26490,61 @@ parsoid=html2wt
<nowiki>''foo''</nowiki>
!! end
+# This is meant to be an interim fix while we go about figuring out
+# how to not introduce these trailing s in the first place.
+!! test
+T115717: Strip trailing s (without affecting valid uses)
+!! options
+parsoid=html2wt
+!! html/parsoid
+
x
+y
+
+
+!! wikitext
+x
+y
+
+{{echo|
+1 = }}
+
+{{echo|
+1 =
+}}
+!! end
+
# ---------------------------------------------------
# End of tests spec'ing wikitext serialization norms |
# ---------------------------------------------------
+# T104032
+!! test
+Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
+!! options
+parsoid=html2wt
+!! html/parsoid
+a
b
+c
d
+
+
a
b
+
c
d
+
+!! wikitext
+a
+
+b
+
+'''c'''
+
+d
+{|
+|a
+b
+|'''c'''
+d
+|}
+!! end
+
# -----------------------------------------------------------------
# End of section for Parsoid-only html2wt tests for serialization
# of new content