From: C. Scott Ananian foo foo foo foo
{{{1}}}
-!!end +!! end + +!! test +Templates: With colons +!! wikitext +{{With: Colon}} +!! html/php +Template with colon +
+!! html/parsoid +Template with colon
+!! end #-------------------------------------------------------------------- # Transclusion parameter escaping tests #-------------------------------------------------------------------- + !! test Templates: Parsoid parameter escaping test 1 !! wikitext @@ -7719,13 +7757,16 @@ Piped link with extlink-like text !! wikitext [[Main Page|[bar]]] [[Main Page|This is a [bar]]] +[[Main Page|[bar]] !! html/php !! html/parsoid +This is a [bar] +[bar !! end !! test @@ -8065,7 +8106,6 @@ Plain link to page with question mark in title !! end - # I'm fairly sure the expected result here is wrong. # We want these to be URL links, not pseudo-pages with URLs for titles.... # However the current output is also pretty screwy. @@ -8088,6 +8128,34 @@ Piped link to URL: [[http://www.example.com|an example URL]]Piped link to URL: [example URL]
!! end +!! test +Plain link in template argument +!! options +parsoid=wt2html +!! wikitext +{{echo|[http://www.example.com |123]}} + +{{echo|[[http://www.example.com |123]]}} + +{{echo|[[http://www.example.com |123]}} + +{{echo|[http://www.example.com |123]]}} +!! html/php +[|123] +
{{echo|[|123}} +
+!! html/parsoid + + +[|123]
+ +{{echo|[|123}}
+ + +!! end + !! test T2002: [[page|http://url/]] should link to page, not http://url/ !! wikitext @@ -8172,6 +8240,33 @@ Non-breaking spaces in title !!end +# Add new article for the test below so that it doesn't red-link +!! article +Foo bar baz +!! text +boo +!! endarticle + +!! test +Multiple spaces in titles should normalize to a single underscore +!! options +parsoid=wt2html,wt2wt +!! wikitext +[[Foo bar baz|x]] +[[Foo bar baz|x]] +[[Foo bar baz|x]] +!! html/php + +!! html/parsoid + +!! end + !! test Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue) !! options @@ -8743,6 +8838,8 @@ Blah blah blah !! test Multiple colons escaping interlanguage links +!! options +parsoid=wt2html !! wikitext [[:es:Spanish]] [[::es:Spanish]] @@ -8752,6 +8849,10 @@ Multiple colons escaping interlanguage links [[::es:Spanish]] [[:::es:Spanish]] +!! html/parsoid +es:Spanish +[[::es:Spanish]] +[[:::es:Spanish]]
!! end ## parsoid html2wt will normalize the space to _ @@ -9155,8 +9256,6 @@ some textFoo
!! wikitext +#REDIRECT [[Foo]] Foo +!! end + +!! test +Redirect followed by block on the same line +!! options +parsoid=wt2html +!! wikitext +#REDIRECT [[Main Page]]== hi == +!! html/parsoid +A newline
+!! end + +!! test +Redirect followed by multiple newlines +!! wikitext +#REDIRECT [[Main Page]] + + +A newline +!! html/parsoid + + +
+A newline
{{bar}}
But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]
However, we can still tell this was handled as a link in the preprocessor: [[Foo}}|bar]]
+!! html/parsoid +{{bar}}
+But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]
+However, we can still tell this was handled as a link in the preprocessor: [[Foo}}|bar]]
!! end !! test @@ -11915,26 +12066,33 @@ Preprocessor precedence 2: template is rightmost opening language=zh !! wikitext -{{echo|foo}-}}- -!! html +!! html/php-foo}--
+!! html/parsoid +-foo}--
!! end !! test Preprocessor precedence 3: language converter is rightmost opening !! options language=zh +parsoid=wt2html !! wikitext {{echo|hi}} {{-{R|echo|hi}}}- [[-{R|raw]]}- -!! html +!! html/phphi
{{echo|hi}}
[[raw]]
+!! html/parsoid +hi
+{{
+[[
!! end !! test @@ -11943,7 +12101,9 @@ Preprocessor precedence 4: left-most angle bracket language=zh !! wikitext -!! html +!! html/php +!! html/parsoid + !! end !! article @@ -11956,21 +12116,28 @@ Template:Precedence5 Preprocessor precedence 5: tplarg takes precedence over template !! wikitext {{Precedence5|Bullet}} -!! html +!! html/php{{echo|[[Foo}}
{{echo|[[Foo|bar|bat=baz}}
+!! html/parsoid +{{echo|[[Foo}}
+{{echo|[[Foo|bar|bat=baz}}
!! end # This next test exposes a difference between PHP and Parsoid: @@ -11995,6 +12162,8 @@ Preprocessor precedence 6: broken link is rightmost opening !! test Preprocessor precedence 7: broken template is rightmost opening +!! options +parsoid=wt2html !! wikitext [[Foo|{{echo|Bar]] @@ -12002,12 +12171,17 @@ Preprocessor precedence 7: broken template is rightmost opening Careful: linktrails can move the end of the wikilink: [[Foo|{{echo|y']]a}}l]]l -!! html +!! html/phpBar-x-y]]-z
Careful: linktrails can move the end of the wikilink: y'al]]l
+!! html/parsoid +[[Foo|{{echo|Bar]]
+ +Careful: linktrails can move the end of the wikilink: +y']]all
!! end !! test @@ -12034,7 +12208,7 @@ Template:Preprocessor_precedence_9 Preprocessor precedence 9: groups of braces !! wikitext {{Preprocessor precedence 9|Four|Bullet|1|2}} -!! html +!! html/php--x
--x
-x
+!! html/parsoid +--x
+ +--x
+ +-x
!! end !! test Preprocessor precedence 12: broken language converter closed by brace. +!! options +parsoid=wt2html !! wikitext This form breaks the template, which is unfortunate: * {{echo|foo-{bar}bat}} @@ -12116,7 +12335,7 @@ tag, nothing bad happens:This form breaks the template, which is unfortunate:
This form breaks the template, which is unfortunate:
+But if the broken language converter markup is inside an extension tag, nothing bad happens:
+foo-{bar}bat
foo-{bar}bat
1
5
6
+!! html/parsoid + +1
+2
+3
+4
+5
+6
+!! end + +!! test +Preprocessor precedence 16: matching closing braces to opening braces +!! options +language=zh +parsoid=wt2html +!! wikitext +-{{{echo|foo}}bar}- +!! html/php +foobar +
+!! html/parsoid +!! end ### @@ -13141,6 +13418,14 @@ Templates: Parameters substituted at the top-level
bar
!! end +!! test +Templates: Param with empty arg in the final position +!! wikitext +{{{hi|}}} +!! html/parsoid + +!! end + !!test Parser Functions: 1. Simple example !! wikitext @@ -13884,6 +14169,16 @@ parsoid=wt2html,wt2wt,html2html !! end +!! test +Serialize simple image with figure-inline wrapper +!! options +parsoid=html2wt +!! html/parsoid + +!! wikitext +[[File:Foobar.jpg]] +!! end + !! test Simple image (using File: namespace, now canonical) !! wikitext @@ -14503,7 +14798,7 @@ parsoid=wt2html,wt2wt,html2html # enlarged. !! test -Image: "unspecified format" and border enlarge +Image: unspecified format and border enlarge !! options parsoid=wt2html,wt2wt,html2html !! wikitext @@ -14515,8 +14810,8 @@ parsoid=wt2html,wt2wt,html2html !! html/parsoid - - + + !! end !! test @@ -14562,8 +14857,8 @@ parsoid=wt2html,wt2wt,html2html !! html/parsoid - - + + !! end !! test @@ -14592,8 +14887,8 @@ parsoid=wt2html,wt2wt,html2html !! html/parsoid - - + + !! end !! test @@ -14690,7 +14985,7 @@ SVG thumbnails with no language set !! html/parsoid - + !! end !! test @@ -14703,7 +14998,7 @@ parsoid=wt2html,wt2wt,html2html !! html/parsoid - + !! end !! test @@ -16811,6 +17106,24 @@ HTML tag with leading space is parsed as text !! end +## Don't expect Parsoid and PHP to match, since PHP isn't exactly following +## the HTML5 parsing spec. +!! test +Element with broken attribute syntax +!! options +parsoid=wt2html +!! wikitext +Media:Foobar.jpg +Media:Video.ogv +Media:Video.ogv
!! html/parsoid - +Media:Foobar.jpg +Media:Video.ogv +Media:Video.ogv
!! end !! test @@ -16970,8 +17289,6 @@ Image link to nonexistent file (T3850 - good) !! end - - !! test Character reference normalization in link text (T3938) !! wikitext @@ -17967,12 +18284,17 @@ but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}- then we get cut off here: }- all additional text is vanished -!! html +!! html/phpthis bit is safe: }-
but if we add a conversion instance: xxx
then we get cut off here: }-
all additional text is vanished
+!! html/parsoid +this bit is safe: }-
+but if we add a conversion instance:
+then we get cut off here: }-
+all additional text is vanished
!! end !! test @@ -19679,7 +20001,7 @@ File:File:Foobar.jpg !! html/parsoidBoth Dunav and ÐÑнав are names for this river.
-!!end +!! html/parsoid +Both Dunav and ÐÑнав are names for this river.
+!! end !! article ÐÑна @@ -21019,9 +21348,11 @@ Link to another existing title shouldn't be parsed as self-link even if it's a v title=[[Duna]] language=sr !! wikitext [[ÐÑна]] is not a self-link while [[Duna]] and [[DÑна]] are still self-links. -!! html +!! html/phpÐÑна is not a self-link while Duna and DÑна are still self-links.
+!! html/parsoid +ÐÑна is not a self-link while Duna and DÑна are still self-links.
!! end !! test @@ -21030,9 +21361,11 @@ Link to a section of a variant of this title shouldn't be parsed as self-link title=[[Duna]] language=sr !! wikitext [[DÑна]] is a self-link while [[Dunа#Foo]] and [[DÑна#Foo]] are not self-links. -!! html +!! html/phpDÑна is a self-link while Dunа#Foo and DÑна#Foo are not self-links.
+!! html/parsoid +DÑна is a self-link while Dunа#Foo and DÑна#Foo are not self-links.
!! end !! test @@ -21041,10 +21374,12 @@ Link to pages in language variants language=sr !! wikitext Main Page can be written as [[Ðаин Ðаге]] -!! html +!! html/phpMain Page can be written as Ðаин Ðаге
-!!end +!! html/parsoid +Main Page can be written as Ðаин Ðаге
+!! end !! test @@ -21053,10 +21388,12 @@ Multiple links to pages in language variants language=sr !! wikitext [[Main Page]] can be written as [[Ðаин Ðаге]] same as [[Ðаин Ðаге]]. -!! html +!! html/phpMain Page can be written as Ðаин Ðаге same as Ðаин Ðаге.
-!!end +!! html/parsoid +Main Page can be written as Ðаин Ðаге same as Ðаин Ðаге.
+!! end !! test @@ -21065,7 +21402,7 @@ Simple template in language variants language=sr !! wikitext {{ÑеÑÑ}} -!! html +!! html/phpThis is a test template
!! end @@ -21077,7 +21414,7 @@ Template with explicit namespace in language variants language=sr !! wikitext {{Template:ÑеÑÑ}} -!! html +!! html/phpThis is a test template
!! end @@ -21089,7 +21426,7 @@ Basic test for template parameter in language variants language=sr !! wikitext {{паÑамÑеÑÑ|param=foo}} -!! html +!! html/phpThis is a test template with parameter foo
!! end @@ -21143,9 +21480,11 @@ Stripping -{}- tags (language variants) language=sr !! wikitext Latin proverb: -{Ne nuntium necare}- -!! html +!! html/phpLatin proverb: Ne nuntium necare
+!! html/parsoid +Latin proverb:
!! end @@ -21155,9 +21494,11 @@ Prevent conversion with -{}- tags (language variants) language=sr variant=sr-ec !! wikitext Latinski: -{Ne nuntium necare}- -!! html +!! html/phpÐаÑинÑки: Ne nuntium necare
+!! html/parsoid +Latinski:
!! end @@ -21167,9 +21508,11 @@ Prevent conversion of text with -{}- tags (language variants) language=sr variant=sr-ec !! wikitext Latinski: -{Ne nuntium necare}- -!! html +!! html/phpÐаÑинÑки: Ne nuntium necare
+!! html/parsoid +Latinski:
!! end @@ -21179,9 +21522,11 @@ Prevent conversion of links with -{}- tags (language variants) language=sr variant=sr-ec !! wikitext -{[[Main Page]]}- -!! html +!! html/php +!! html/parsoid +!! end @@ -21191,11 +21536,26 @@ language=sr variant=sr-ec language=sr variant=sr-ec !! wikitext == -{Naslov}- == -!! html + +Note that even an unprotected headline ID is not affected by language +conversion: + +== Latinski == +!! html/php
ÐоÑе ÑÑ Ð°Ñ ÐµÐ²ÐµÐ½ ан ÑнпÑоÑеÑÑед Ñ ÐµÐ°Ð´Ð»Ð¸Ð½Ðµ ÐÐ Ð¸Ñ Ð½Ð¾Ñ Ð°ÑÑеÑÑед бy лангÑаге +ÑонвеÑÑион: +
+Note that even an unprotected headline ID is not affected by language +conversion:
+Taiwan, not China
+!! html/parsoid +, not China
!! end +!! test +Filter syntax for language variants +!! options +language=zh variant=zh-tw +!! wikitext +foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux +!! html/php +fooblog, WEBJOURNAL, WEBLOGquux +
+!! html/parsoid +fooquux
+!! end +# Note that Parsoid post-processing for language variants needs to +# update the `title` attribute here, based on the mw:ExpandedAttrs property !! test Conversion around HTML tags !! options language=sr variant=sr-ec !! wikitext --{H|span=>sr-ec:script;title=>sr-ec:src;}- -ski -!! html +-{H|span=>sr-ec:script;title=>sr-ec:src}- +ski +!! html/phpÑки
+!! html/parsoid ++ski
!! end - !! test -Explicit session-wise language variant mapping (A flag and - flag) +Explicit session-wise two-way language variant mapping (A flag and - flag) !! options language=zh variant=zh-tw !! wikitext +This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now. + Taiwan is not China. -But -{A|zh:China;zh-tw:Taiwan}- is China, -(This-{-|zh:China;zh-tw:Taiwan}- should be stripped!) + +But -{A|zh:China; zh-tw:Taiwan}- is China, + +(This-{-|zh:China; zh-tw:Taiwan}- should be stripped!) + and -{China}- is China. -!! html -Taiwan is not China. -But Taiwan is Taiwan, -(This should be stripped!) -and China is China. +!! html/php +
This is Taiwan, but we'll forget that now. +
Taiwan is not China. +
But Taiwan is Taiwan, +
(This should be stripped!) +
and China is China. +
+!! html/parsoid +This is , but we'll forget that now.
+Taiwan is not China.
+But is China,
+(This should be stripped!)
+and is China.
+!! end + +!! test +Explicit session-wise one-way language variant mapping (A flag and - flag) +!! options +language=zh variant=zh-tw +!! wikitext +This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now. + +COUNTRY is China or Taiwan. + +But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY, + +(This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!) + +and -{COUNTRY}- is COUNTRY. +!! html/php +This is Taiwan, but we'll forget that now. +
COUNTRY is China or Taiwan. +
But Taiwan is Taiwan, +
(This should be stripped!) +
and COUNTRY is COUNTRY.
+!! html/parsoid +This is , but we'll forget that now.
+COUNTRY is China or Taiwan.
+But is COUNTRY,
+(This should be stripped!)
+and is COUNTRY.
!! end !! test -Explicit session-wise language variant mapping (H flag for hide) +Explicit session-wise two-way language variant mapping (H flag for hide) !! options language=zh variant=zh-tw !! wikitext (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!) + Taiwan is China. -!! html +!! html/php(This should be stripped!) -Taiwan is Taiwan. +
Taiwan is Taiwan.
+!! html/parsoid +(This should be stripped!)
+Taiwan is China.
+!! end + +!! test +Explicit session-wise one-way language variant mapping (H flag for hide) +!! options +language=zh variant=zh-tw +!! wikitext +(This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!) + +COUNTRY is Taiwan or China. +!! html/php +(This should be stripped!) +
Taiwan is Taiwan or China. +
+!! html/parsoid +(This should be stripped!)
+COUNTRY is Taiwan or China.
!! end +## Note that parsoid test runner does not support 'showtitle' option. !! test Adding explicit conversion rule for title (T flag) !! options language=zh variant=zh-tw showtitle !! wikitext Should be stripped-{T|zh:China;zh-tw:Taiwan}-! -!! html + +Taiwan is China. +!! html/php TaiwanShould be stripped! +
Taiwan is China.
+!! html/parsoid +Should be stripped!
+Taiwan is China.
+!! end + +!! test +Code coverage: T combined with H flag +!! options +language=zh variant=zh-tw showtitle +!! wikitext +Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-! + +Taiwan is China. +!! html/php +Taiwan +Should be stripped! +
Taiwan is Taiwan. +
+!! html/parsoid +Should be stripped!
+Taiwan is China.
+!! end + +!! test +Code coverage: T with no variants +!! options +language=zh variant=zh-tw showtitle +!! wikitext +-{H|zh:China; zh-tw:Taiwan}- +Taiwan is China.-{T|Taiwan is China}- +!! html/php +Taiwan is China ++Taiwan is Taiwan. +
+!! html/parsoid ++Taiwan is China.
+!! end + +!! test +Code coverage: rules with no variants +!! options +language=zh variant=zh-tw +!! wikitext +-{H|zh:China; zh-tw:Taiwan}- +Taiwan is China. +-{H|China}- +Taiwan is China. +!! html/php ++Taiwan is Taiwan. + +Taiwan is China. +
+!! html/parsoid ++Taiwan is China. + +Taiwan is China.
+!! end + + +!! test +Code coverage: D flag for conversion rule +!! options +language=zh variant=zh-tw +!! wikitext +-{D|zh-cn:XA; zh-tw:YA}- +-{A;D|zh-cn:XB; zh-tw:YB}- +-{D;H|zh-cn:XC; zh-tw:YC}- + +-{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}- + +-{D|0=>zh-tw:1}- +-{A;D|2=>zh-tw:3}- +-{D;H|4=>zh-tw:5}- + +XA XB XC YA YB YC FOO BAR BAT 012345 +!! html/php +大éï¼XAï¼å°ç£ï¼YAï¼ + +大éï¼XCï¼å°ç£ï¼YCï¼ +
FOOâå°ç£ï¼BARï¼FOOâ大éï¼BATï¼ +
0âå°ç£ï¼1ï¼ + +4âå°ç£ï¼5ï¼ +
XA YB YC YA YB YC BAR BAR BAT 013355 +
+!! html/parsoid ++ +
++
+ +
+XA XB XC YA YB YC FOO BAR BAT 012345
+!! end + +!! test +Code coverage: N flag for conversion rule +!! options +language=zh variant=zh-cn +!! wikitext +-{N|zh-cn}- + +-{N|zh-tw}- + +-{N|sr-ec}- +!! html/php +大é +
å°ç£ +
ÑÑпÑки (ÑиÑилиÑа)â +
+!! html/parsoid ++
+
+!! end + +# html2wt suppresses the bogus 'D' flag, so this is wt2html only +!! test +Code coverage: N flag for conversion rule (wt2html only) +!! options +language=zh variant=zh-cn +parsoid=wt2html,html2html +!! wikitext +-{D;N|en}- +!! html/php +
English +
+!! html/parsoid +!! end !! test @@ -21270,25 +21848,31 @@ Testing that changing the language variant here in the tests actually works !! options language=zh variant=zh showtitle !! wikitext -Should be stripped-{T|zh:China;zh-tw:Taiwan}-! -!! html +Should be stripped-{T|zh:China; zh-tw:Taiwan}-! +!! html/php China
Should be stripped!
+!! html/parsoid +Should be stripped!
!! end !! test Recursive conversion of alt and title attrs shouldn't clear converter state !! options -language=zh variant=zh-cn showtitle +language=zh variant=zh-cn +showtitle !! wikitext --{H|zh-cn:Exclamation;zh-tw:exclamation;}- -Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-! -!! html +-{H|zh-cn:Exclamation; zh-tw:exclamation}- +Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-! +!! html/php ChinaShould be stripped!
+!! html/parsoid ++Should be stripped!
!! end !! test @@ -21296,13 +21880,17 @@ T26072: more test on conversion rule for title !! options language=zh variant=zh-tw showtitle !! wikitext -This should be stripped-{T|zh:China;zh-tw:Taiwan}-! -This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-. -!! html +This should be stripped-{T|zh:China; zh-tw:Taiwan}-! + +This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-. +!! html/php TaiwanThis should be stripped! -This won't take interferes with the title rule. +
This won't take interferes with the title rule.
+!! html/parsoid +This should be stripped!
+This won't take interferes with the title rule.
!! end !! test @@ -21311,10 +21899,12 @@ Partly disable title conversion if variant == main language code language=zh variant=zh title=[[ZH]] showtitle !! wikitext -{T|zh-cn:CN;zh-tw:TW}- -!! html +!! html/php ZH+!! html/parsoid + !! end !! test @@ -21323,10 +21913,12 @@ Partly disable title conversion if variant == main language code, more language=zh variant=zh title=[[ZH]] showtitle !! wikitext -{T|TW}- -!! html +!! html/php ZH
+!! html/parsoid + !! end !! test @@ -21335,9 +21927,26 @@ Raw output of variant escape tags (R flag) language=zh variant=zh-tw !! wikitext Raw: -{R|zh:China;zh-tw:Taiwan}- -!! html +!! html/php
Raw: zh:China;zh-tw:Taiwan
+!! html/parsoid +Raw:
+!! end + +# html2wt suppresses the bogus 'D' flags, so this is wt2html only +!! test +Raw output of variant escape tags (R flag) (wt2html only) +!! options +language=zh variant=zh-tw +parsoid=wt2html,html2html +!! wikitext +-{Variant}- -{D|syntax}- -{D;R|options}- +!! html/php +Variant syntax options +
+!! html/parsoid +!! end !! test @@ -21346,9 +21955,24 @@ Nested markup inside raw output of variant escape tags (R flag) language=zh variant=zh-tw !! wikitext Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}- -!! html +!! html/php
Nested raw: nested Taiwan nested
+!! html/parsoid +Nested raw:
+!! end + +!! test +Nested markup and spaces inside raw output of variant escape tags (R flag) +!! options +language=zh variant=zh-tw +!! wikitext +X-{ outer -{ inner }- outer }-X +!! html/php +X outer inner outer X +
+!! html/parsoid +XX
!! end !! test @@ -21357,9 +21981,11 @@ Templates inside raw output of variant escape tags (R flag) language=zh variant=zh-tw !! wikitext Nested raw: -{R|nested {{echo|hi}} templates}- -!! html +!! html/phpNested raw: nested hi templates
+!! html/parsoid +Nested raw:
!! end !! test @@ -21368,9 +21994,11 @@ Strings evaluating false shouldn't be ignored by Language converter (T51072) language=zh variant=zh-cn !! input -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}- -!! result +!! html/php0
+!! html/parsoid +!! end !! test @@ -21379,31 +22007,37 @@ Conversion rules from [numeric-only string] to [something else] (T48634) language=zh variant=zh-cn !! input -{H|0=>zh-cn:B}--{H|0=>zh-cn:C;0=>zh-cn:D}--{H|0=>zh-hans:A}-012345-{A|zh-tw:0;zh-cn:E;}-012345 -!! result +!! html/php
D12345EE12345
+!! html/parsoid +012345012345
!! end !! test -Bidirectional converter rule entries with an empty value should be ignored (T53551) +Two-way converter rule entries with an empty value should be ignored (T53551) !! options language=zh variant=zh-cn !! input -{H|zh-cn:foo;zh-tw:;}-foobar -!! result +!! html/phpfoobar
+!! html/parsoid +foobar
!! end !! test -Unidirectional converter rule entries with an empty "from" string should be ignored (T53551) +One-way converter rule entries with an empty "from" string should be ignored (T53551) !! options language=zh variant=zh-cn !! input -{H|=>zh-cn:foo;}-foobar -!! result +!! html/phpfoobar
+!! html/parsoid +foobar
!! end !! test @@ -21412,9 +22046,11 @@ Empty converter rule entries shouldn't be inserted into the conversion table (T5 language=zh variant=zh-cn !! input -{H|}-foobar -!! result +!! html/phpfoobar
+!! html/parsoid +foobar
!! end !! test @@ -21423,9 +22059,11 @@ Nested using of manual convert syntax language=zh variant=zh-hk !! wikitext Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-! -!! html +!! html/phpNested: Hello Hong Kong!
+!! html/parsoid +Nested: !
!! end !! test @@ -21434,25 +22072,146 @@ HTML markups with conversion syntax in attribs, nested in other conversion block language=zh variant=zh-cn !! wikitext -{zh;zh-hans;zh-hant|A}- -!! html +!! html/phpA
+!! html/parsoid +!! end !! test -HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet) +HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser) !! options -language=zh variant=zh-cn disabled +language=zh variant=zh-cn !! wikitext -{A}- -!! html +!! html/php+disabled
A
+!! html/parsoid ++!! end + +# Parsoid and PHP disagree on how to parse this example: Parsoid +# insists that the content of a language converter element be a valid +# DOM fragment or attribute string +!! test +Language converter markup with block content +!! options +language=zh variant=zh-cn +!! wikitext +a-{b
ab
+a
d
+ +a
d
+ +ad
+!! end + +!! test +LanguageConverter selser (1) +!! options +language=zh variant=zh-cn +parsoid={ + "modes": ["wt2wt", "selser"], + "changes": [ + ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"] + ] +} +!! wikitext +-{raw}- +!! wikitext/edited +-{edited}- +!! end + +!! test +LanguageConverter selser (2) +!! options +language=zh variant=zh-cn +parsoid={ + "modes": ["wt2wt", "selser"], + "changes": [ + ["span[class='x']", "contents", "text", "-{foo}-"], + ["a", "contents", "text", "-{"], + ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"] + ] +} +!! wikitext +TEXT1 +[http://example.com TEXT2] +[[Foo|TEXT3]] +{{echo|TEXT4}} +!! wikitext/edited +ФÑидÑÐ¸Ñ IV Ñе ÑаÑ.
+!! html/parsoid +Fridrih IV je car.
!! end !! test @@ -21513,9 +22274,11 @@ Don't convert raw rule "-{R|=>}-" to "=>" language=sr !! wikitext -{R|=>}- -!! html +!! html/php=>
+!! html/parsoid +!!end !! test @@ -21524,9 +22287,11 @@ Don't break link parsing if language converter markup is in the caption. language=sr variant=sr-ec !! wikitext [[Main Page|-{R|main page}-]] -!! html +!! html/php +!! html/parsoid + !! end !! test @@ -21538,6 +22303,8 @@ language=sr variant=sr-ec !! html/php
foo
+!! html/parsoid +!! end !! test @@ -21545,12 +22312,12 @@ T146305: Don't break image parsing if language converter markup is in the captio !! options language=sr !! wikitext -[[File:Foobar.jpg|thumb|-{R|caption:}-]] +[[ÐаÑоÑека:Foobar.jpg|thumb|-{R|caption:}-]] !! html/php !! html/parsoid - + !! end !! test @@ -21558,14 +22325,15 @@ T146305: Don't break image parsing if nested language converter markup is in the !! options language=zh variant=zh-cn !! wikitext -[[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]] +[[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]] !! html/php !! html/parsoid - + !! end +# XXX html2wt disabled because rich markup in alt is not preserved. !! test Don't break gallery if language converter markup is inside. !! options @@ -21575,7 +22343,7 @@ language=zh File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}- File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt -!! html +!! html/php
B - |
+!! wikitext +-{
}- +
+!! end +!! test +Language converter tricky html2wt cases (2) +!! options +language=sr +parsoid=html2wt,wt2wt +!! html/parsoid +-{foo}-
+!! wikitext +-{foo}- +
+!! end + +!! test +Language converter tricky html2wt cases (3) +!! options +language=sr +parsoid=html2wt,wt2wt +!! html/parsoid ++
+
+!! wikitext +-{R||}- + +-{R|R|raw}- + +-{
| +
R|raw +
-{foo}- +
+!! end + +!! test +Language converter tricky html2wt cases (4) +!! options +language=sr +parsoid=html2wt,wt2wt +!! html/parsoid ++!! wikitext +-{R|{{echo|hey}}}- +!! html/php +
hey +
+!! end + +# Note that thefoobar
+ ++
+
a:b=>c xyz
+!! wikitext +-{H|foobat;xyz=>zh-cn:abc +
A +
0;zh-tw:bar +
abc +
a:b=>c 0;zh-tw:bar +
!! end !! test @@ -25982,12 +26861,17 @@ parsoid=html2wt + !! wikitext [[:fr:Foo|Foo]] [[:fr:Foo|Foo]] [[:fr:Foo|Foo]] [[:fr:Foo|Foo]] +[[:fr:Foo|Foo]] +[[:fr:Foo|Foo]] + [[:fr:Foo|Foo]] [[:fr:Foo|Foo]] !! end @@ -26257,7 +27141,7 @@ Image: Block level image should have \n before and after123
456
-!!end +!! end !! test Image: New block level image should have \n before and after (existing content) @@ -26269,7 +27153,7 @@ Image: New block level image should have \n before and after (existing content)123
456
-!!end +!! end !! test Image: upright option (parsoid) @@ -26281,7 +27165,7 @@ Image: upright option (parsoid) -!!end +!! end !! test Image: upright option is ignored on inline and frame images (parsoid) @@ -26289,7 +27173,15 @@ Image: upright option is ignored on inline and frame images (parsoid) [[File:Foobar.jpg|500x500px|upright=0.5|caption]] !! html/parsoid -!!end +!! end + +!! test +Image: in template parameter with empty parameter +!! wikitext +{{echo|[[File:Foobar.jpg|link=]]}} +!! html/parsoid ++!! end !! test Image: from basic HTML (1)