From e97dca8cbdd49d5118fcb4a861b9bb043c480e89 Mon Sep 17 00:00:00 2001
From: Subramanya Sastry
Date: Tue, 20 Oct 2015 10:06:04 -0500
Subject: [PATCH] Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 31012bb740fea4fe6ce44464dd940d48576ed4ef
Change-Id: I525622766d702c53009d59c1a2a80a52966774fe
---
tests/parser/parserTests.txt | 193 +++++++++++++++++++++++++++++------
1 file changed, 164 insertions(+), 29 deletions(-)
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index b5d7a113f1..f245826d3d 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -14,7 +14,9 @@
# 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)
# noxml don't check for XML well-formedness
# title=[[XXX]] run test using article title XXX
@@ -3328,14 +3330,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
!! end
!! test
@@ -5076,6 +5113,8 @@ External links: link text with spaces
!! test
External links: wiki links within external link (Bug 3695)
+!! options
+parsoid=wt2html,html2html
!! wikitext
[http://example.com [[wikilink]] embedded in ext link]
!! html/php
@@ -5596,7 +5635,7 @@ Parenthesis in external links, w/ transclusion or comment
!! test
Serialize tags with invalid link targets as plain text
!! options
-parsoid=html2wt
+parsoid={ "modes": ["html2wt"], "suppressErrors": true }
!! html/parsoid
text*text
@@ -10088,6 +10127,23 @@ PMID
1234
!! end
+# nodes shouldn't be inserted during html2wt by Parsoid,
+# since these are ExtLinkText, not MagicLinkText
+!! test
+Magic links: use appropriate serialization for "almost" magic links.
+!! wikitext
+X[[Special:BookSources/0978739256|foo]]
+
+X[//tools.ietf.org/html/rfc1234 foo]
+!! html/php
+
+!! end
+
###
### Templates
####
@@ -10809,8 +10865,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 ==
@@ -10991,10 +11053,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
@@ -12913,13 +12979,14 @@ parsoid={
[[Image:Foobar.jpg||]]
!! end
+# wgExternalLinkTarget not supported by Parsoid
!! test
Image with link parameter, wgExternalLinkTarget
!! wikitext
[[Image:foobar.jpg|link=http://example.com/]]
!! config
wgExternalLinkTarget='foobar'
-!! html
+!! html/php
!! end
@@ -12946,13 +13013,14 @@ wgNoFollowDomainExceptions='example.com'
!! end
+# wgExternalLinkTarget not supported by Parsoid
!! test
Image with link parameter, wgExternalLinkTarget, unnamed parameter
!! wikitext
[[Image:foobar.jpg|link=http://example.com/|Title]]
!! config
wgExternalLinkTarget='foobar'
-!! html
+!! html/php
!! end
@@ -14207,15 +14275,22 @@ pst
[[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
@@ -14251,8 +14326,14 @@ pst
[[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
@@ -14279,7 +14360,7 @@ Bar
[[Category:Baz]]
{{echo|[[Category:Baz]]}}
[[Category:Baz]]
-!! html
+!! html/php
Foo Bar
Foo
Bar
@@ -14289,20 +14370,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
@@ -14400,8 +14493,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
@@ -14452,13 +14551,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
@@ -19158,17 +19264,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
+
!! wikitext
-http://cscott.net'''foo'''
+http://cscott.net'''foo'''
http://cscott.netfoo
-'''http://cscott.net'''
+'''http://cscott.net'''
'''http://cscott.net '''
@@ -25430,7 +25545,7 @@ parsoid=html2wt
!! test
T75121: Infer extension name from typeOf if data-mw is not present
!! options
-parsoid=html2wt
+parsoid={ "modes": ["html2wt"], "suppressErrors": true }
!! html/parsoid
!! wikitext
@@ -25533,7 +25648,7 @@ parsoid={
!! test
Never serialize a-tag as html, regardless of what data-parsoid has to say
!! options
-parsoid=html2wt
+parsoid={ "modes": ["html2wt"], "suppressErrors": true }
!! html/parsoid
Foo
!! wikitext
@@ -25547,7 +25662,7 @@ parsoid=html2wt
!! test
Never serialize a-tag as html, no matter what attributes it has
!! options
-parsoid=html2wt
+parsoid={ "modes": ["html2wt"], "suppressErrors": true }
!! html/parsoid
!! wikitext
@@ -25571,6 +25686,26 @@ parsoid=html2wt
# 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
+
!! test
Lists: Add space after bullets
!! options
--
2.20.1