X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=tests%2Fparser%2FparserTests.txt;h=4c6c9a5b31ceb2ff077a7f8a858f77e70241cd09;hb=a05971dfc7fdd78be02edae4855ca808dc599cda;hp=ffa435c08b55313e3ce23d1c27546b54e8a6ee5f;hpb=b73b2456896c949cfe319ff310521679566ecbcf;p=lhc%2Fweb%2Fwiklou.git
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index ffa435c08b..4c6c9a5b31 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -2057,13 +2057,28 @@ Tabs don't trigger preformatted text
preformatted text.
This is preformatted text.
So is this.
-!! html
+!! html/php
This is not
preformatted text.
This is preformatted text.
So is this.
+!! html/parsoid
+
This is not
+ preformatted text.
+
This is preformatted text.
+ So is this.
+!! end
+
+!! test
+Space before tab needs nowiki pre protection
+!! options
+parsoid=html2wt
+!! html/parsoid
+
!! end
-
-!! test
-External link containing a period in the anchor. (bug 63947)
-!! wikitext
-[//foo.org/bar#baz. bang]
-
-[//foo.org/bar. bang]
-!! html/php
-
-!! end
-
-
!! test
External link containing double-single-quotes in text '' (bug 4598 sanity check)
!! wikitext
@@ -5301,9 +5290,22 @@ External link containing double-single-quotes with no space separating the url f
External link with comments in link text
!! wikitext
[http://www.google.com Google ]
-!! html
+!! html/php
!! end
!! test
@@ -5366,7 +5483,8 @@ Non-extlinks in brackets
[{{echo|foo}}l's errand]
[url={{echo|foo}}]
[url=http://example.com]
-!! html
+[http:// bare protocols don't count]
+!! html/php
!! end
!! test
@@ -6113,7 +6246,7 @@ Table cell attributes: Pipes protected by nowikis should be treated as a plain c
| title="foo|" |bar
| title="foo|" bar
|}
-!! html
+!! html/php
bar
@@ -6123,12 +6256,19 @@ Table cell attributes: Pipes protected by nowikis should be treated as a plain c
title="foo|" bar
+!! html/parsoid
+
+
bar
+
bar
+
title="foo|" bar
+
!! end
-# The "|}" to close the table is missing from the input, so parsoid's
-# *2wt modes will fail.
+# See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
+# N.B. The "|}" to close the table is missing from the input, so parsoid's
+# *2wt modes will fail.
!! test
-Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
+Table security: embedded pipes
!! options
parsoid=wt2html,html2html
!! wikitext
@@ -6146,12 +6286,14 @@ parsoid=wt2html,html2html
!! html/parsoid
-
" onmouseover="alert(document.cookie)">test
+
" onmouseover="alert(document.cookie)">test
!! end
-# FIXME: The php output is broken.
+# FIXME: The output seems broken. Filed as T110268.
!! test
! and || in td attributes should not be parsed as
/
+!! options
+parsoid=wt2html
!! wikitext
{|
| style="color: red !important;" data-contrived="put this here ||" | foo
@@ -6165,7 +6307,7 @@ parsoid=wt2html,html2html
!! html/parsoid
-
foo
+
style="color: red !important;" data-contrived="put this here
foo
!! end
@@ -6782,9 +6924,6 @@ parsoid=wt2html,wt2wt
!! end
-
-# PHP throws away the (semi-broken) "foo" class here; Parsoid
-# preserves it.
!!test
Parsoid: Recover better from broken table attributes
!!options
@@ -6795,7 +6934,7 @@ parsoid=wt2html
foo
|}
!!html/php+tidy
-
+
foo
@@ -6810,6 +6949,23 @@ foo
!!end
+!! test
+Tables: Digest broken attributes on table and tr tag
+!! options
+parsoid=wt2html
+!! wikitext
+{| || |} ++
+|- || || ++ --
+|- > [
+|}
+!! html
+
+
+
+
+
+!! end
+
!! test
Strip unsupported table tags
!! options
@@ -7020,8 +7176,10 @@ Link with HTML entity in suffix / tail
Link with 3 brackets
!! wikitext
[[[Main Page]]]
+Foo [[[Main Page]]]
!! html
[[[Main Page]]]
+Foo [[[Main Page]]]
!! end
@@ -9800,27 +9958,33 @@ __proto__
Magic links: internal link to RFC (bug 479)
!! wikitext
[[RFC 123]]
-!! html
+!! html/php
!! html/parsoid
-ISBN 1235467890
+ISBN 1235467890
!! end
!! test
@@ -13256,7 +13449,7 @@ T107474: Frameless image caption with
!! wikitext
[[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
!! html/parsoid
-
+
!! end
!! test
@@ -13679,6 +13872,42 @@ bar
bar
!! end
+## Edge case bugs in Parsoid from T93580
+!! test
+T93580: 1. Templated inside block images
+!! wikitext
+[[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|foo}}]]
+
+
+!! html/parsoid
+Caption with templated ref: [1]
+
+
+!! end
###
### Subpages
@@ -15680,6 +15909,7 @@ MSIE 6 CSS safety test: sup/sub script (bug 55332)
!! end
+# FIXME: Parsoid fails to sanitize this! See T58846.
!! test
Opera -o-link CSS
!! wikitext
@@ -15754,7 +15984,7 @@ CSS line continuation 2
!! wikitext
!! html
-
+
!! end
@@ -18087,6 +18317,38 @@ parsoid=wt2html,wt2wt,html2html
îî
!! end
+# See: http://www.w3.org/TR/html5/syntax.html#character-references
+# Note that U+000C (form feed) is not a valid XML character, so
+# it is banned even though allowed in HTML5.
+!! test
+Illegal character references (T106578)
+!! wikitext
+; Null:
+; FF:
+; CR:
+; Control (low):
+; Control (high):
+; Surrogate:
+; This is an okay astral character: 💩
+!! html+tidy
+
!! end
+# Don't expect Parsoid to roundtrip this until the php parser comes closer to
+# html5 tag parsing.
!! test
Tags with parameters in TOC
+!! options
+parsoid=wt2html
!! wikitext
__TOC__
== Hello ==
== Evilbye ==
-!! html
+!! html/php
!! end
!! test
@@ -21686,23 +21957,23 @@ Empty TR nodes should not be stripped if they have any attributes set
!! test
Headings: 0. Unnested
!! options
-parsoid
+parsoid=html2wt
+!! html/parsoid
+
!!end
# New headings and existing headings are handled differently
@@ -21759,15 +22030,26 @@ parsoid=html2wt
!! test
Headings: 3. Nested inside html with wikitext split by html tags
!! options
-parsoid=html2wt,wt2wt
-!! wikitext
-= ='''bold'''foo= =
+parsoid=html2wt
!! html/parsoid
=boldfoo=
+!! wikitext
+= ='''bold'''foo= =
!!end
!! test
Headings: 4a. No escaping needed (testing just h1 and h2)
+!! options
+parsoid=html2wt
+!! html/parsoid
+
=foo
+
foo=
+
=foo=
+
=foo= bar
+
=foo
+
foo=
+
=
+
=foo=
!! wikitext
= =foo =
@@ -21784,15 +22066,6 @@ Headings: 4a. No escaping needed (testing just h1 and h2)
= = =
= ''=''foo= =
-!! html/parsoid
-
+!! wikitext
+*foo*bar
+
+*''foo''*bar
+
+*[[Foo]]: bar
+
+*[[Foo]]*bar
!!end
!! test
Lists: 5. No unnecessary escapes
+!! options
+parsoid=html2wt
+!! html/parsoid
+
bar [[foo]]
+
=bar [[foo]]
+
[[bar [[foo]]
+
]]bar [[foo]]
+
=bar foo]]=
+
: a
+
* foo
+
!! wikitext
* bar [[foo]]
@@ -22101,15 +22364,6 @@ Lists: 5. No unnecessary escapes
* : a
* ''* foo''
-!! html
-
bar [[foo]]
-
=bar [[foo]]
-
[[bar [[foo]]
-
]]bar [[foo]]
-
=bar foo]]=
-
: a
-
* foo
-
!!end
!! test
@@ -22124,13 +22378,15 @@ parsoid=html2wt
!! test
Lists: 7. Escape bullets in a multi-line context
-!! wikitext
-a
-*b
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
a
*b
+!! wikitext
+a
+*b
!!end
!! test
@@ -22149,17 +22405,16 @@ parsoid=html2wt
!! test
HRs: 1. Single line
+!! options
+parsoid=html2wt
+!! html/parsoid
+----
+=foo=
+*foo
!! wikitext
--------
----=foo=
----*foo
-!! html+tidy
-
-
----
-
-
=foo=
-
-
*foo
!! end
#### --------------- Tables ---------------
@@ -22183,40 +22438,48 @@ HRs: 1. Single line
!! test
Tables: 1a. Simple example
-!! wikitext
-{|
-|}
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
{|
|}
+!! wikitext
+{|
+|}
!! end
!! test
Tables: 1b. No escaping needed
-!! wikitext
-!foo
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
!foo
+!! wikitext
+!foo
!! end
!! test
Tables: 1c. No escaping needed
-!! wikitext
-|foo
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
|foo
+!! wikitext
+|foo
!! end
!! test
Tables: 1d. No escaping needed
-!! wikitext
-|}foo
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
|}foo
+!! wikitext
+|}foo
!! end
!! test
@@ -22277,11 +22540,8 @@ parsoid=html2wt
!! test
Tables: 2c. Nested in td -- no escaping needed
-!! wikitext
-{|
-
-|foo!!bar
-|}
+!! options
+parsoid=html2wt
!! html/*
@@ -22289,15 +22549,17 @@ Tables: 2c. Nested in td -- no escaping needed
foo!!bar
-!! end
-
-!! test
-Tables: 3a. Nested in th
!! wikitext
{|
-!foo!bar
+|foo!!bar
|}
+!! end
+
+!! test
+Tables: 3a. Nested in th
+!! options
+parsoid=html2wt
!! html/*
@@ -22305,6 +22567,11 @@ Tables: 3a. Nested in th
foo!bar
+!! wikitext
+{|
+
+!foo!bar
+|}
!! end
!! test
@@ -22413,6 +22680,19 @@ parsoid=html2wt
!! test
Tables: 4c. No escaping needed
+!! options
+parsoid=html2wt
+!! html/parsoid
+
-!! end
-
-!! test
-Tables: Digest broken attributes on table and tr tag
-!! options
-parsoid=wt2html
-!! wikitext
-{| || |} ++
-|- || || ++ --
-|- > [
-|}
-!! html
-
-
-
-
-
!! end
!! test
@@ -22518,11 +22772,18 @@ parsoid=html2wt
|** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
!! wikitext
*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
-|** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
+|** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
!! end
!! test
Unclosed xmlish element in table line shouldn't eat end delimiters
+!! options
+parsoid=html2wt
+!! html/parsoid
+
+
<foo
+
bar>
+
!! wikitext
{|
| bar>
-!! html/parsoid
-
-
<foo
-
bar>
-
!! end
#### --------------- Links ----------------
@@ -22552,6 +22808,12 @@ Unclosed xmlish element in table line shouldn't eat end delimiters
#### --------------------------------------
!! test
Links 1. WikiLinks: No escapes needed
+!! options
+parsoid=html2wt
+!! html/parsoid
+
!! end
!! test
Links 6. Add s between text-nodes and url-links when required (bug 64300)
+!! options
+parsoid=html2wt
!! html/parsoid
xhttp://example.comy
http://example.com?x
@@ -22692,6 +22956,8 @@ http://example.com(x)
!! test
Links 7a. Don't add spurious s between text-nodes and url-links (bug 64300)
+!! options
+parsoid=html2wt
!! html/parsoid
x
http://example.com
@@ -22725,6 +22991,8 @@ y
!! test
Links 7b. Don't add spurious s between text-nodes and url-links (bug 64300)
+!! options
+parsoid=html2wt
!! html/parsoid
@@ -22739,6 +23007,8 @@ http://example.com.,;:!?\
!! test
Links 8. Add s between text-nodes and RFC-links when required (bug 64300)
+!! options
+parsoid=html2wt
!! html/parsoid
RFC 1234
RFC 123y
@@ -22751,6 +23021,8 @@ XRFC 123y
!! test
Links 9. Don't add spurious s between text-nodes and RFC-links (bug 64300)
+!! options
+parsoid=html2wt
!! html/parsoid
RFC 123?foo
RFC 123&foo
@@ -22769,6 +23041,8 @@ RFC 123&foo
!! test
Links 10. Add s between text-nodes and PMID-links when required (bug 64300)
+!! options
+parsoid=html2wt
!! html/parsoid
PMID 1234
PMID 123y
@@ -22781,6 +23055,8 @@ XPMID 123y
!! test
Links 11. Don't add spurious s between text-nodes and PMID-links (bug 64300)
+!! options
+parsoid=html2wt
!! html/parsoid
PMID 123?foo
PMID 123&foo
@@ -22799,10 +23075,12 @@ PMID 123&foo
!! test
Links 12. Add s between text-nodes and ISBN-links when required (bug 64300)
+!! options
+parsoid=html2wt
!! html/parsoid
-
+'''foo'' and bar
+
!! end
!! test
2. Link fragments separated by and tags
+!! options
+parsoid=html2wt
+!! html/parsoid
+
[[foohello]]
+
[[foohello]]
!! wikitext
[[''foo''hello]]
[['''foo'''hello]]
-!! html
-
[[foohello]]
-
[[foohello]]
-
!! end
# FIXME: Escaping one or both of [[ and ]] is also acceptable --
# this is one of the shortcomings of this format
!! test
3. Link fragments inside and
+!! options
+parsoid=html2wt
+!! html/parsoid
+
[[foo]]
+
[[foo]]
!! wikitext
''[[foo'']]
'''[[foo''']]
-!! html
-
[[foo]]
-
[[foo]]
-
!! end
!! test
4. No escaping needed
-!! wikitext
-'''bar'''
-''''bar''''
-'a:b'foo
-!! html
+!! options
+options=html2wt
+!! html/parsoid
'bar'
'bar'
'a:b'foo
+!! wikitext
+'''bar'''
+''''bar''''
+'a:b'foo
!! end
#### ----------- Paragraphs ---------------
@@ -22971,6 +23256,15 @@ parsoid=html2wt,wt2wt
!! test
1. No unnecessary escapes
+!! options
+parsoid=html2wt
+!! html/parsoid
+
bar [[foo]]
+
=bar [[foo]]
+
[[bar [[foo]]
+
]]bar [[foo]]
+
=bar foo]]=
+
!! wikitext
bar [[foo]]
@@ -22981,13 +23275,6 @@ bar [[foo]]
]]bar [[foo]]
=bar foo]]=
-!! html
-
bar [[foo]]
-
=bar [[foo]]
-
[[bar [[foo]]
-
]]bar [[foo]]
-
=bar foo]]=
-
!!end
#### ----------------------- PRE --------------------------
@@ -22996,83 +23283,103 @@ bar [[foo]]
!! test
1. Leading whitespace in SOL context should be escaped
!! options
-parsoid
+parsoid=html2wt
+!! html/parsoid
+
a
+
+
a
+
+
a(tab)
+
+
a
+
+ a
+
+
a
+ b
+
+
a
+ b
+
+
a
+ b
!! wikitext
a
a
-a(tab)
+ a(tab)
a
- a
+a
a
b
a
-b
+ b
a
- b
-!! html
-
a
-
a
-
a(tab)
-
a
-
a
-
a
- b
-
a
- b
-
a
- b
+ b
+!! html/php
+
a
+
a
+
a(tab)
+
a
+ a
+
a
+ b
+
a
+ b
+
a
+ b
+
!! end
!! test
2. Leading whitespace in non-indent-pre contexts should not be escaped
!! options
-parsoid
-!! wikitext
-foo ''a''
- b
-
-!! html
+parsoid=htm2wt
+!! html/parsoid
+!! wikitext
+foo ''a''
+ b
+
!! end
!! test
3. Leading whitespace in indent-pre suppressing contexts should not be escaped
!! options
-parsoid
-!! wikitext
+parsoid=html2wt
+!! html/parsoid
+
a
b
- c
+ c
-!! html
+!! wikitext
-
a
b
- c
+ c
!! end
!! test
4. Leading whitespace in indent-pre suppressing contexts should not be escaped
!! options
-parsoid
-!! wikitext
- [[File:Foobar.jpg|thumb|caption]]
+options=html2wt
!! html/parsoid
caption
+!! wikitext
+ [[File:Foobar.jpg|thumb|caption]]
!! end
!! test
@@ -23088,15 +23395,15 @@ parsoid=html2wt
!!test
T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
!! options
-parsoid
-!! wikitext
- * foo
- * bar
-!! html
+parsoid=html2wt
+!! html/parsoid
* foo
* bar
+!! wikitext
+ * foo
+ * bar
!! end
#### --------------- Behavior Switches --------------------
@@ -23128,15 +23435,8 @@ __|__
# We use indent-pre as an indirect way to test for sol-transparent behavior.
!! test
Behavior switches should be SOL-transparent
-!! wikitext
- __TOC__
-
-
- __TOO__
-
- __TOC__ foo
-
-__TOC__ bar
+!! options
+parsoid=html2wt
!! html/parsoid
@@ -23146,6 +23446,15 @@ __TOC__ bar
foo
bar
+!! wikitext
+ __TOC__
+
+
+ __TOO__
+
+ __TOC__ foo
+
+__TOC__ bar
!! end
#### --------------- HTML tags ---------------
@@ -23157,75 +23466,85 @@ __TOC__ bar
!! test
1. a tags
!! options
-parsoid
+parsoid=html2wt
+!! html/parsoid
+<a href="http://google.com">google</a>
!! wikitext
google
-!! html
-<a href="http://google.com">google</a>
!! end
!! test
2. other tags
-!! wikitext
-*
foo
-*
foo
-*
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
<div>foo</div>
<div style="color:red">foo</div>
<td>
+!! wikitext
+*
foo
+*
foo
+*
!! end
!! test
3. multi-line html tag
-!! wikitext
-
foo
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
<div
>foo</div
>
+!! wikitext
+
foo
!! end
!! test
4. extension tags
+!! options
+parsoid=html2wt
+!! html/parsoid
+
<ref>foo</ref>
+
<ref>bar
+
baz</ref>
+
!! wikitext
foobar
baz
-!! html
-
<ref>foo</ref>
-
<ref>bar
-
baz</ref>
-
!! end
#### --------------- Others ---------------
!! test
Escaping nowikis
-!! wikitext
-<nowiki>foo</nowiki>
-!! html
+!! options
+parsoid=html2wt
+!! html/parsoid
<nowiki>foo</nowiki>
+!! wikitext
+<nowiki>foo</nowiki>
!! end
## The quote-char in the input is necessary for triggering the bug
!! test
(Bug 52035) Nowiki-escaping should not get tripped by " :" in text
!! options
-parsoid=wt2wt,html2wt
+parsoid=html2wt
+!! html/parsoid
+
foo's bar :
!! wikitext
foo's bar :
-!! html
-
foo's bar :
!! end
+#----------- End of wikitext escaping tests --------------
+
!! test
Tag-like HTML structures are passed through as text
@@ -23277,20 +23596,9 @@ HTML tag with broken attribute value quoting
!! wikitext
Foo
-!! end
-
-!! test
-Parsoid-only: HTML tag with broken attribute value quoting
-!! options
-parsoid
-!! wikitext
-Foo
!! end
@@ -23304,7 +23612,7 @@ Table with broken attribute value quoting
!! html/php
-
Foo
+
Foo
!! html/parsoid
@@ -23325,9 +23633,9 @@ Table with broken attribute value quoting on consecutive lines
!! html/php
-
Foo
+
Foo
-
Bar
+
Bar
!! html/parsoid
@@ -23340,7 +23648,7 @@ Table with broken attribute value quoting on consecutive lines
!! end
!! test
-Parsoid-only: Don't wrap broken template tags in on wt2wt (Bug 42353)
+2. Parsoid-only: Don't wrap broken template tags in on wt2wt (Bug 42353)
!! options
parsoid
!! wikitext
@@ -23350,7 +23658,7 @@ parsoid
!! end
!! test
-Parsoid-only: Don't wrap broken template tags in on wt2wt (Bug 42353)
+1. Parsoid-only: Don't wrap broken template tags in on wt2wt (Bug 42353)
!! options
parsoid
!! wikitext
@@ -24399,7 +24707,7 @@ parsoid={
== [[Category:A2]] hi pal ==
-== [[Category:A3]] how goes it ==
+== [[Category:A3]] how goes it ==
== it goes well [[Category:A4]] ==
@@ -24463,7 +24771,7 @@ parsoid={
"scrubWikitext": true
}
!! html/parsoid
-
+!! wikitext
+RFC 1234
+
+[http://foo.com RFC 1234]
+
+[[Foo|RFC 1234]]
+!! end
+
!! test
Edited Redirect link should emit a non-piped wikitext link
!! options
@@ -25666,6 +26060,16 @@ parsoid={
!! end
+!! test
+Escape nowiki DOM elements
+!! options
+parsoid=html2wt
+!! html/parsoid
+foo
+!! wikitext
+<nowiki>''foo''</nowiki>
+!! end
+
# ---------------------------------------------------
# End of tests spec'ing wikitext serialization norms |
# ---------------------------------------------------