# The parsoid-compatible option below is only relevant when we are running # parser tests in integrated mode with Parsoid. This option is ignored # when this test file is run with Parsoid in standalone mode. !! options parsoid-compatible=wt2html,wt2wt version=2 !! end # This is the standard article assumed to exist. !! article Main Page !! text blah blah !! endarticle !!article Foo !!text FOO !!endarticle !! article Söfnuður !! text Test. !! endarticle !! article 00 !! text This is 00. !! endarticle !! article Template:1x !! text {{{1}}} !! endarticle #### ---------------------------------------------------------------- #### The following section of tests are primarily to test #### wikitext escaping capabilities of Parsoid. Given that #### escaping can be done any number of ways, the wikitext (input) #### is always adjusted to reflect how Parsoid adds nowiki #### escape tags. #### #### We are marking several tests as parsoid-only since the #### HTML in the result section is different from what the #### PHP parser generates for it. #### ---------------------------------------------------------------- #### --------------- Headings --------------- #### 0. Unnested #### 1. Nested inside html
=foo=
=foo= =foo=
=fooa=
!! wikitext=foo= x
=foo=
=foo= x
=foo=
===
!! wikitext===
!! end # in the html2wt direction we emit '= = =' or '== ==
= ==
=a=
=a=
=a=
!! wikitext=a= b
=a= b
=a= b
!! wikitexta =b=
!! wikitext a=a=
=a=
!! wikitextnew
a
!! wikitext == NEW == new ==A== a !! end !! test Headings: Used as horizontal rule !! config wgParserEnableLegacyHeadingDOM=false wgFragmentMode=[ "html5", "legacy" ] !! options parsoid=wt2html !! wikitext =============== !! html/php*foo
#foo
;Foo:bar
!! wikitext*foo
!! wikitexta *b
!! wikitext a{| |}
!! wikitext!foo
!! wikitext !foo !! end !! test Tables: 1c. No escaping needed !! options parsoid=html2wt !! html/parsoid|foo
!! wikitext |foo !! end !! test Tables: 1d. No escaping needed !! options parsoid=html2wt !! html/parsoid|}foo
!! wikitext |}foo !! end !! test Tables: 2a. Nested in td !! options parsoid=html2wt !! html/parsoidfoo|bar |
x a|b |
foo|bar |
x a|b
|
foo||bar | ab||c | a b||c |
foo||bar | ab||c | a b||c
|
foo!!bar |
foo!bar |
---|
foo!!bar | foo|bar | foo!!bar | foo!!bar |
---|
foo!!bar | foo|bar | foo!!bar | foo!!bar |
---|
foo||bar | foo||bar |
---|
foo||bar | foo||bar |
---|
-bar |
---|
-bar |
+bar |
---|
+bar |
foo-bar | foo+bar |
foo-bar | foo+bar |
foo
bar|baz +bar -bar | |
x
a|b |
foo-bar | foo+bar |
foo-bar | foo+bar |
foo
bar|baz +bar -bar | |
x
a|b
|
Foo-bar | +1 | -2 |
Foo-bar | +1 | -2 |
} | |
x | } |
} | |
x | } |
*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.
!! wikitext<foo | bar> |
<foo | bar> |
Foobar] x [http://google.com g] x [[Bar]] x [[Bar]] x |Bar ]]bar [[bar x [[ y x ]] y x ]] y [[ z
!! end !! test Links 3. WikiLinks: No escapes needed !! options parsoid=html2wt !! html/parsoid !! wikitext [[Foo|[Foobar]] [[Foo|foo|bar]] !! html/php !! end !! test Links 4. ExtLinks: Escapes needed !! options parsoid=html2wt !! html/parsoid[http://google.com]
[http://google.com google]
!! wikitext [http://google.com[http://google.com]
[http://google.com google]
!! end !! test Links 5. ExtLinks: No escapes needed !! options parsoid=html2wt !! html/parsoid !! wikitext [http://google.com [google] [[http://google.com]] !! html/php[[1]]
!! end !! test Links 6. Addxhttp://example.comy http://example.com?x http://example.com&x http://example.com'x http://example.com,x http://example.com.x http://example.com;x http://example.com:x http://example.com;x http://example.com!x http://example.com=x http://example.com(x) http://example.com(x)
!! wikitext xx http://example.com y "http://example.com" (http://example.com) (http://example.com) foo http://example.com, http://example.com, foo
!! wikitext x http://example.com y "http://example.com" (http://example.com) (http://example.com) foo http://example.com, http://example.com, foo !! html/phpx http://example.com y "http://example.com" (http://example.com) (http://example.com) foo http://example.com, http://example.com, foo
!! end !! test Links 7b. Don't add spurioushttp://example.com.,;:!?\ -http://example.com:
!! wikitext http://example.com.,;:!?\ -http://example.com: !! html/phphttp://example.com.,;:!?\ -http://example.com:
!! end !! test Links 8. AddRFC 123?foo RFC 123&foo -RFC 123-
!! wikitext RFC 123?foo RFC 123&foo -RFC 123- !! html/phpRFC 123?foo RFC 123&foo -RFC 123-
!! end !! test Links 10. AddPMID 1234
PMID 123y
XPMID 123y
!! wikitext
PMID 123
PMID 123?foo PMID 123&foo -PMID 123-
!! wikitext PMID 123?foo PMID 123&foo -PMID 123- !! html/phpPMID 123?foo PMID 123&foo -PMID 123-
!! end !! test Links 12. AddISBN 12345678901 ISBN 1234567890x aISBN 1234567890b
!! wikitext ISBN 1234567890-ISBN 1234567890's !! wikitext -ISBN 1234567890's !! html/php
!! end !! test Links 14. Protect link-like plain text. (Parsoid bug T78425) !! options parsoid=html2wt !! html/*this is not a link: http://example.com
!! wikitext this is not a link:'foo' ''foo'' '''foo''' foo's 'foo' ''foo'' '''foo''' foo'bar'baz foo's 'foo foo' foo'' 'foo' 'foo foo' 'foo' fools' errand fool's errand 'foo bar 'baz a|!*#-:;+-~[]{}b'x
!! wikitext ''[[foohello]]
[[foohello]]
!! wikitext [[''foo''[[foo]]
[[foo]]
!! wikitext ''[[foo'''bar' 'bar' 'a:b'foo
!! wikitext '''bar''' ''''bar'''' 'a:b'foo !! end #### ----------- Paragraphs --------------- #### 1. No unnecessary escapes #### -------------------------------------- !! test 1. No unnecessary escapes !! options parsoid=html2wt !! html/parsoidbar [[foo]]
=bar [[foo]]
[[bar [[foo]]
]]bar [[foo]]
=bar foo]]=
!! wikitext bara
a
a(tab)
a a
a b
a b
a b
!! wikitext a a a(tab) a a a b a b a b !! html/phpa
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=html2wt !! html/parsoidfoo a b
!! wikitext foo!! wikitexta b c
a b c!! end !! test 4. Leading whitespace in indent-pre suppressing contexts should not be escaped !! options parsoid=html2wt !! html/parsoid
==foo==!! wikitext ==foo== !! end !! test T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block !! options parsoid=html2wt !! html/parsoid
* foo * bar!! wikitext * foo * bar !! end !! test Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup !! options parsoid = { "modes": ["html2wt"] } !! html/parsoid
foo
%foo
*foo
#foo
=foo=
*foo
*foo
*foo
*foo
foo
*foo
!! wikitext foo %foo__TOO__
foo
bar!! wikitext __TOC__ __TOO__ __TOC__ foo __TOC__ bar !! end # last two tags test case-insensitivity !! test During serialization, normalize output when given a SOL-transparent prefix !! options parsoid=html2wt !! html/parsoid
x
y
z
p
!! wikitext x __NOTOC__y __NOTOC__z __notoc__p !! end #### --------------- HTML tags --------------- #### 1. a tags #### 2. other tags #### 3. multi-line html tag #### 4. extension tags #### ----------------------------------------- !! test 1. a tags !! options parsoid=html2wt !! html/parsoid <a href="http://google.com">google</a> !! wikitext google !! end !! test 2. other tags !! options parsoid=html2wt !! html/parsoid<div >foo</div >
!! wikitext<ref>foo</ref>
<ref>bar
baz</ref>
!! wikitext<nowiki>foo</nowiki>
!! wikitext <nowiki>foo</nowiki> !! end ## The quote-char in the input is necessary for triggering the bug !! test (T54035) Nowiki-escaping should not get tripped by " :" in text !! options parsoid=html2wt !! html/parsoidfoo's bar :
!! wikitext foo's bar : !! end !! test Ensure that when a leading-whitespace-containing string is emitted on a newline, it is correctly escaped !! options parsoid={ "modes": ["selser"], "selser": "noauto", "changes": [ [ "div > p", "html", "DEF" ] ] } !! wikitext