!! Version 2 # LanguageConverter and language variants parser tests # This is the standard article assumed to exist. !! article Main Page !! text blah blah !! endarticle !! article A !! text Dummy article to suppress redlinks in tests !! end !! article Template:1x !! text {{{1}}} !! endarticle # For Serbian; localize Template namespace !! article Шаблон:1x !! text {{{1}}} !! endarticle !! article Тест !! text sr-el article variant !! endarticle ## sr-ec ## !! test sr-ec: Simple conversion of Latin to Cyrillic !! options language=sr htmlVariantLanguage=sr-Cyrl !! wikitext abvg !! html/php

абвг

!! html/parsoid

abvg

!! html/parsoid+langconv

абвг

!! end !! test sr-ec: Same as above, but assert that -{}-s must be removed and not converted (1) !! options language=sr htmlVariantLanguage=sr-Cyrl !! wikitext -{lj}-аб-{nj}-вг-{dž}- !! html/php

ljабnjвгdž

!! html/parsoid

абвг

!! html/parsoid+langconv

ljабnjвг

!! end !! test sr-ec: This text has some Cyrillic, but is recognized as Latin, so it should be converted !! options language=sr htmlVariantLanguage=sr-Cyrl !! wikitext абвгšđžčć !! html/php

абвгшђжчћ

!! html/parsoid

абвгšđžčć

!! html/parsoid+langconv

абвгшђжчћ

!! end !! test sr-ec: Same as above, but assert that -{}-s must be removed and not converted (2) !! options language=sr htmlVariantLanguage=sr-Cyrl !! wikitext -{lj}-абвг-{nj}-šđžčć-{dž}- !! html/php

ljабвгnjшђжчћdž

!! html/parsoid

абвгšđžčć

!! html/parsoid+langconv

ljабвгnjшђжчћ

!! end !! test sr-ec: Roman numerals are not converted !! options language=sr htmlVariantLanguage=sr-Cyrl !! wikitext a I b II v III g IV šđžčć !! html/php

а I б II в III г IV шђжчћ

!! html/parsoid

a I b II v III g IV šđžčć

!! html/parsoid+langconv

а I б II в III г IV шђжчћ

!! end ## sr-el ## !! test sr-el: A simple conversion of Latin to Latin !! options language=sr htmlVariantLanguage=sr-Latn !! wikitext abcd !! html/php

abcd

!! html/parsoid

abcd

!! html/parsoid+langconv

abcd

!! end !! test sr-el: A simple conversion of Cyrillic to Latin !! options language=sr htmlVariantLanguage=sr-Latn !! wikitext абцд !! html/php

abcd

!! html/parsoid

абцд

!! html/parsoid+langconv

abcd

!! end !! test sr-el: This text has some Latin, but is recognized as Cyrillic, so it should be converted !! options language=sr htmlVariantLanguage=sr-Latn !! wikitext abcdшђжчћ !! html/php

abcdšđžčć

!! html/parsoid

abcdшђжчћ

!! html/parsoid+langconv

abcdšđžčć

!! end !! test External links should be converted, unless they "look like a URL". !! options language=sr htmlVariantLanguage=sr-Cyrl !! wikitext [http://example.com abcd] [http://example.com http://foo.com] http://example.com [http://example.com -{abcd}-] !! html/php

абцд

http://foo.com

http://example.com

abcd

!! html/parsoid

abcd

http://foo.com

http://example.com

!! html/parsoid+langconv

абцд

http://foo.com

http://example.com

abcd

!! end !! test Language converter: output gets cut off unexpectedly (T7757) !! options language=zh !! wikitext this bit is safe: }- 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/php

this 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 Language converter glossary rules inside attributes (T119158) !! options language=sr htmlVariantLanguage=sr-Latn !! config wgParserEnableLegacyMediaDOM=false !! wikitext -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}- [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]] !! html/php

" onload="alert(1)" data-foo="

!! html/parsoid

foAjrjvi

!! end ### ### Language variants related tests ### !! test Self-link in language variants !! options title=[[Dunav]] language=sr !! wikitext Both [[Dunav]] and [[Дунав]] are names for this river. !! html/php

Both Dunav and Дунав are names for this river.

!! html/parsoid

Both Dunav and Дунав are names for this river.

!! end !! article Дуна !! text content !! endarticle !! test Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title !! options title=[[Duna]] language=sr !! wikitext [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links. !! 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 Link to a section of a variant of this title should be parsed as mw-selflink-fragment !! options title=[[Duna]] language=sr !! wikitext [[Dуна]] is a self-link while [[Duna#Foo]] and [[Dуна#Foo]] are mw-selflink-fragments. !! html/php

Dуна is a self-link while Duna#Foo and Dуна#Foo are mw-selflink-fragments.

!! html/parsoid

Dуна is a self-link while Duna#Foo and Dуна#Foo are mw-selflink-fragments.

!! end !! test Link to pages in language variants !! options language=sr !! wikitext Main Page can be written as [[Маин Паге]] !! html/php

Main Page can be written as Маин Паге

!! html/parsoid

Main Page can be written as Маин Паге

!! end !! test Multiple links to pages in language variants !! options language=sr !! wikitext [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]]. !! html/php

Main Page can be written as Маин Паге same as Маин Паге.

!! html/parsoid

Main Page can be written as Маин Паге same as Маин Паге.

!! end !! article Template:test !! text This is a test template !! endarticle !! test Simple template in language variants !! options language=sr !! wikitext {{тест}} !! html/php

This is a test template

!! end !! test Template with explicit namespace in language variants !! options language=sr !! wikitext {{Template:тест}} !! html/php

This is a test template

!! end !! article Template:paramtest !! text This is a test template with parameter {{{param}}} !! endarticle !! test Basic test for template parameter in language variants !! options language=sr !! wikitext {{парамтест|param=foo}} !! html/php

This is a test template with parameter foo

!! end !! test Simple category in language variants !! options language=sr cat !! metadata cat=МедиаWики_Усер'с_Гуиде sort= !! wikitext [[Category:МедиаWики Усер'с Гуиде]] !! html/php !! html/parsoid !! end !! article Category:分类 !! text blah !! endarticle !! article Category:分類 !! text 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 (T35210) !! options cat language=zh parsoid=wt2html !! metadata cat=分类 sort= !! wikitext [[A]][[Category:分类]] !! html/php

A

!! html/parsoid

A

!! end !! test Stripping -{}- tags (language variants) !! options language=sr !! wikitext Latin proverb: -{Ne nuntium necare}- !! html/php

Latin proverb: Ne nuntium necare

!! html/parsoid

Latin proverb:

!! end !! test Prevent conversion with -{}- tags (language variants) !! options language=sr htmlVariantLanguage=sr-Cyrl !! wikitext Latinski: -{Ne nuntium necare}- !! html/php

Латински: Ne nuntium necare

!! html/parsoid

Latinski:

!! end !! test Prevent conversion of text with -{}- tags (language variants) !! options language=sr htmlVariantLanguage=sr-Cyrl !! wikitext Latinski: -{Ne nuntium necare}- !! html/php

Латински: Ne nuntium necare

!! html/parsoid

Latinski:

!! end !! test Prevent conversion of links with -{}- tags (language variants) !! options language=sr htmlVariantLanguage=sr-Cyrl !! wikitext -{[[Main Page]]}- !! html/php

Main Page

!! html/parsoid

!! end !! test -{}- tags within headlines (within html for parserConvert()) !! config wgFragmentMode=[ "html5", "legacy" ] !! options language=sr htmlVariantLanguage=sr-Cyrl !! wikitext ==-{Naslov}-== Note that even an unprotected headline ID is not affected by language conversion: ==Latinski== !! html/php

Naslov[уреди]

Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге цонверсион:

Латински[уреди]

!! html/parsoid

Note that even an unprotected headline ID is not affected by language conversion:

Latinski

!! end !! test Explicit definition of language variant alternatives !! options language=zh htmlVariantLanguage=zh-Hant-TW !! wikitext -{zh:China;zh-tw:Taiwan}-, not China !! html/php

Taiwan, not China

!! html/parsoid

, not China

!! end !! test Explicit definition of language variant alternatives (BCP 47 codes) !! options language=zh htmlVariantLanguage=zh-Hant-TW !! wikitext -{zh:China;zh-Hant-TW:Taiwan}-, not China !! html/php

Taiwan, not China

!! html/parsoid

, not China

!! end !! test Filter syntax for language variants !! options language=zh htmlVariantLanguage=zh-Hant-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 htmlVariantLanguage=sr-Cyrl !! wikitext -{H|span=>sr-ec:script;title=>sr-ec:src}- ski !! html/php

ски

!! html/parsoid

ski

!! end !! test Explicit session-wise two-way language variant mapping (A flag and - flag) !! options language=zh htmlVariantLanguage=zh-Hant-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!) 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 htmlVariantLanguage=zh-Hant-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 two-way language variant mapping (H flag for hide) !! options language=zh htmlVariantLanguage=zh-Hant-TW !! wikitext (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!) Taiwan is China. !! html/php

(This should be stripped!)

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 htmlVariantLanguage=zh-Hant-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 htmlVariantLanguage=zh-Hant-TW showtitle !! wikitext Should be stripped-{T|zh:China;zh-tw:Taiwan}-! Taiwan is China. !! html/php Taiwan

Should 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 htmlVariantLanguage=zh-Hant-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 htmlVariantLanguage=zh-Hant-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 htmlVariantLanguage=zh-Hant-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 htmlVariantLanguage=zh-Hant-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 htmlVariantLanguage=zh-Hans-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 htmlVariantLanguage=zh-Hans-CN parsoid=wt2html,html2html !! wikitext -{D;N|en}- !! html/php

English

!! html/parsoid

!! end !! test Testing that changing the language variant here in the tests actually works !! options language=zh htmlVariantLanguage=zh showtitle !! wikitext Should be stripped-{T|zh:China; zh-tw:Taiwan}-! !! html/php China

Should be stripped!

!! html/parsoid

Should be stripped!

!! end !! test Title with HTML !! options language=zh htmlVariantLanguage=zh showtitle !! wikitext -{T|zh:Title with HTML&Entities}- Should be stripped! !! html/php Title with HTML&Entities

Should be stripped!

!! end !! test Title with Wiki syntax !! options language=zh htmlVariantLanguage=zh showtitle !! wikitext -{T|zh:Title ''with'' Wiki's süntax©}- Should be stripped! !! html/php Title with Wiki's süntax&copy

Should be stripped!

!! end !! test Title with JavaScript injection !! options language=zh htmlVariantLanguage=zh showtitle !! wikitext -{T|zh:Title click me }- Should be stripped! !! html/php Title click me <script>alert(43)</script>

Should be stripped!

!! end !! test Test 1 from T298401/T67747 !! options language=zh htmlVariantLanguage=zh showtitle !! wikitext -{T|zh:Title &b}- Should be stripped! !! html/php Title <script>a</script>&b

Should be stripped!

!! end !! test Test 2 from T298401/T67747 !! options language=zh htmlVariantLanguage=zh showtitle !! wikitext -{T|zh:Title }- Should be stripped! !! html/php Title

Should be stripped!

!! end !! test Test 3 from T298401/T67747 !! options language=zh htmlVariantLanguage=zh showtitle !! wikitext -{T|zh:Title Foo bar}- Should be stripped! !! html/php Title Foo bar

Should be stripped!

!! end !! test Recursive conversion of alt and title attrs shouldn't clear converter state !! options language=zh htmlVariantLanguage=zh-Hans-CN showtitle !! wikitext -{H|zh-cn:Exclamation; zh-tw:exclamation}- Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-! !! html/php China

Should be stripped!

!! html/parsoid

Should be stripped!

!! end !! test T26072: more test on conversion rule for title !! options language=zh htmlVariantLanguage=zh-Hant-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/php Taiwan

This should be stripped!

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 Partly disable title conversion if variant == main language code !! options language=zh htmlVariantLanguage=zh title=[[ZH]] showtitle !! wikitext -{T|zh-cn:CN;zh-tw:TW}- !! html/php ZH

!! html/parsoid

!! end !! test Partly disable title conversion if variant == main language code, more !! options language=zh htmlVariantLanguage=zh title=[[ZH]] showtitle !! wikitext -{T|TW}- !! html/php ZH

!! html/parsoid

!! end !! test Raw output of variant escape tags (R flag) !! options language=zh htmlVariantLanguage=zh-Hant-TW !! wikitext Raw: -{R|zh:China;zh-tw:Taiwan}- !! 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 htmlVariantLanguage=zh-Hant-TW parsoid=wt2html,html2html !! wikitext -{Variant}- -{D|syntax}- -{D;R|options}- !! html/php

Variant syntax options

!! html/parsoid

!! end !! test Nested markup inside raw output of variant escape tags (R flag) !! options language=zh htmlVariantLanguage=zh-Hant-TW !! wikitext Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}- !! 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 htmlVariantLanguage=zh-Hant-TW !! wikitext X-{ outer -{ inner }- outer }-X !! html/php

X outer inner outer X

!! html/parsoid

XX

!! end !! test Templates inside raw output of variant escape tags (R flag) !! options language=zh htmlVariantLanguage=zh-Hant-TW !! wikitext Nested raw: -{R|nested {{1x|hi}} templates}- !! html/php

Nested raw: nested hi templates

!! html/parsoid

Nested raw:

!! end !! test Strings evaluating false shouldn't be ignored by Language converter (T51072) !! options language=zh htmlVariantLanguage=zh-Hans-CN !! wikitext -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}- !! html/php

0

!! html/parsoid

!! end !! test Conversion rules from [numeric-only string] to [something else] (T48634) !! options language=zh htmlVariantLanguage=zh-Hans-CN !! wikitext -{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 !! html/php

D12345EE12345

!! html/parsoid

012345012345

!! end !! test Two-way converter rule entries with an empty value should be ignored (T53551) !! options language=zh htmlVariantLanguage=zh-Hans-CN !! wikitext -{H|zh-cn:foo;zh-tw:;}-foobar !! html/php

foobar

!! html/parsoid

foobar

!! end !! test One-way converter rule entries with an empty "from" string should be ignored (T53551) !! options language=zh htmlVariantLanguage=zh-Hans-CN !! wikitext -{H|=>zh-cn:foo;}-foobar !! html/php

foobar

!! html/parsoid

foobar

!! end !! test Empty converter rule entries shouldn't be inserted into the conversion table (T53551) !! options language=zh htmlVariantLanguage=zh-Hans-CN !! wikitext -{H|}-foobar !! html/php

foobar

!! html/parsoid

foobar

!! end !! test Nested using of manual convert syntax !! options language=zh htmlVariantLanguage=zh-Hant-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/php

Nested: Hello Hong Kong!

!! html/parsoid

Nested: !

!! end !! test HTML markups with conversion syntax in attribs, nested in other conversion blocks !! options language=zh htmlVariantLanguage=zh-Hans-CN !! wikitext -{zh;zh-hans;zh-hant|A}- !! html/php

A

!! html/parsoid

!! end !! test HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser) !! options language=zh htmlVariantLanguage=zh-Hans-CN !! wikitext -{A}- !! 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 htmlVariantLanguage=zh-Hans-CN !! wikitext a-{b
c}-d a-{zh;zh-hans;zh-hant|b
c}-d a-{H|0=>zh-cn:xy;0=>zh-tw:b
c}-d !! html/php ab
cd ab
cd ad
!! html/parsoid a
d a
d

ad

!! end !! test LanguageConverter selser (1) !! options language=zh htmlVariantLanguage=zh-Hans-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 htmlVariantLanguage=zh-Hans-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]] {{1x|TEXT4}} !! wikitext/edited -{foo}- [http://example.com -{] [[Foo|-{]] {{1x|-{}} !! end # Tests LanguageVariantText in ConstrainedText !! test LanguageConverter selser (3) !! options language=zh htmlVariantLanguage=zh-Hans-CN parsoid={ "modes": ["wt2wt", "selser"], "changes": [ ["td > span", "attr", "typeof", "mw:LanguageVariant"], ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"] ] } !! wikitext {| |- |Foo |} !! wikitext/edited {| |- |-{edited}- |} !! end # Tests LanguageVariantText._fromSelSer !! test LanguageConverter selser (4) !! options language=zh htmlVariantLanguage=zh-Hans-CN parsoid={ "modes": ["wt2wt", "selser"], "changes": [ ["td > span.x", "remove"] ] } !! wikitext {| |- |Foo-{Bar}- ||Foo-{Bar}- |} !! wikitext/edited {| |- |-{Bar}- ||-{Bar}- |} !! end # Since Parsoid is starting to emit canonical wikitext for links, # [http://example.com http://example.com] will not RT back to that # form anymore. # Parsoid does not language-convert links (it is done in a # post-processing step) !! test Proper conversion of text in external links !! options language=sr htmlVariantLanguage=sr-Cyrl parsoid=wt2html !! wikitext http://www.google.com gopher://www.google.com [http://www.google.com http://www.google.com] [gopher://www.google.com gopher://www.google.com] [https://www.google.com irc://www.google.com] [ftp://www.google.com www.google.com/ftp://dir] [//www.google.com www.google.com] !! html/php

http://www.google.com gopher://www.google.com http://www.google.com gopher://www.google.com irc://www.google.com www.гоогле.цом/фтп://дир www.гоогле.цом

!! html/parsoid

http://www.google.com gopher://www.google.com http://www.google.com gopher://www.google.com irc://www.google.com www.google.com/ftp://dir www.google.com

!! end !! test Do not convert roman numbers to language variants !! options language=sr htmlVariantLanguage=sr-Cyrl !! wikitext Fridrih IV je car. !! html/php

Фридрих IV је цар.

!! html/parsoid

Fridrih IV je car.

!! end !! test Unclosed language converter markup "-{" !! options language=sr !! wikitext -{T|hello !! html

-{T|hello

!! end !! test Don't convert raw rule "-{R|=>}-" to "=>" !! options language=sr !! wikitext -{R|=>}- !! html/php

=>

!! html/parsoid

!!end !! test Don't break link parsing if language converter markup is in the caption. !! options language=sr htmlVariantLanguage=sr-Cyrl !! wikitext [[Main Page|-{R|main page}-]] !! html/php

main page

!! html/parsoid

!! end !! test T146304: Don't break template parsing if language converter markup is in the parameter. !! options language=sr htmlVariantLanguage=sr-Cyrl !! wikitext {{1x|-{R|foo}-}} !! html/php

foo

!! html/parsoid

!! end !! test T153135: Don't break list handling if language converter markup is in the item. !! options language=zh htmlVariantLanguage=zh-Hans-CN !! wikitext ;-{zh-cn:AAA;zh-tw:BBB}- ;-{R|foo:bar}- !! html/php
AAA
foo:bar
!! html/parsoid
!! end # Note that parsoid does not protect colons unless language converter # markup is properly nested, because it is a backtracking parser. !! test T153135: Unclosed markup in definition list (code coverage) !! options language=zh htmlVariantLanguage=zh-Hans-CN !! wikitext ;foo:bar ;-{zh-cn:AAA !! html/php
foo:bar
-{zh-cn:AAA
!! html/parsoid
foo:bar
-{zh-cn
AAA
!! end !! test T153135: Nested language converter markup in definition list (code coverage) !! options language=zh htmlVariantLanguage=zh-Hans-CN !! wikitext ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def !! html/php
AAA foo:bar bat:baz
def
!! html/parsoid
def
!! end # html2wt mode disabled due to insertion. !! test T153140: Don't break table handling if language converter markup is in the cell. !! options language=sr htmlVariantLanguage=sr-Cyrl parsoid=wt2html,wt2wt,html2html !! wikitext {| |- | -{R|B}- |} !! html/php
B
!! html/parsoid
!! end !! test Language converter tricky html2wt cases (1) !! options language=sr parsoid=html2wt,wt2wt !! html/parsoid

!! wikitext -{}-}- !! html/php

}-

!! end !! test Language converter tricky html2wt cases (2) !! options language=sr parsoid=html2wt,wt2wt !! html/parsoid

-{foo}-

!! wikitext -{foo}- !! html/php

-{foo}-

!! end !! test Language converter tricky html2wt cases (3) !! options language=sr parsoid=html2wt,wt2wt !! html/parsoid

!! wikitext -{R||}- -{R|R|raw}- -{-{foo}-}- !! html/php

|

R|raw

-{foo}-

!! end !! test Language converter tricky html2wt cases (4) !! options language=sr parsoid=html2wt,wt2wt !! html/parsoid

!! wikitext -{R|{{1x|hey}}}- !! html/php

hey

!! end # Note that the escaping added by parsoid for source text, # destination text, and language names only works on the PHP side # for *destination text*. (HTML entity escaping wouldn't work # any better.) This is probably a bug, at least for source texts. # (For language names PHP uses a precise regexp based on the languages # it currently knows have variants, which is fragile since this set # can grow/shrink over time.) !! test Language converter tricky html2wt cases (5) !! options language=zh htmlVariantLanguage=zh-Hans-CN !! html/parsoid

foobar

a:b=>c xyz

!! wikitext -{H|a:b=>c=>zh-cn:x;foo=>zh-cn:boo;bar=>zh-cn:bat;xyz=>zh-cn:abc}-foobar -{H|A=>bo:g;us:B}- -{A|zh-tw:xyz; zh-cn:0;zh-tw:bar}- -{bo:g;us:xyz; zh-cn:abc}- a:b=>c xyz !! html/php+disabled

foobat;xyz=>zh-cn:abc

A

0;zh-tw:bar

abc

a:b=>c 0;zh-tw:bar

!! end !! test T239806: Trailing garbage in language converter rules (1) !! options language=zh htmlVariantLanguage=zh-Hans parsoid=wt2html,html2html !! wikitext -{H|zh-cn:约翰·塞纳; zh-hk:莊·先拿; zh-tw:約翰·希南; ;}- -{H|zh-cn:泰瑞斯·吉布森; zh-hk:泰列斯·吉遜; zh-tw:泰瑞斯·吉布森; ;}- -{H|zh-cn:金·米尔福特; zh-tw:金·米爾福特; 真·米爾福特;}- !! html/php

!! html/parsoid

!! end !! test T239806: Trailing garbage in language converter rules (2) !! options language=zh htmlVariantLanguage=zh-Hans parsoid=wt2html,html2html !! wikitext -{H|zh-cn:玛格特·罗比; zh-tw:瑪格·羅比; zh-hk:瑪歌·羅比; zh-sg:玛格·罗比; ;}- !! html/php

!! html/parsoid

!! end !! test T179579: Nowiki and lc interaction !! options parsoid=wt2html language=sr !! wikitext -{
123}- -{123|456}- !! html/parsoid

!! end !! test Balinese language conversion !! options language=ban htmlVariantLanguage=ban-x-palmleaf !! wikitext ᬫᬦ᭄ᬢ᭄ᬭ -{ban-x-palmleaf:AAA;ban:BBB}- !! html/php

mantra AAA

!! html/parsoid

ᬫᬦ᭄ᬢ᭄ᬭ

!! end !! test Langconvert tag: crh-latn to crh-cyrl !! wikitext test !! html/php

тест

!! end !! test Langconvert tag: en to en-x-piglatin !! config wgUsePigLatinVariant=true !! wikitext test !! html/php

esttay

!! end !! test Langconvert tag: gan-hans to gan-hant !! wikitext !! html/php

!! end !! test Langconvert tag: ku-latn to ku-arab !! wikitext test !! html/php

تەست

!! end !! test Langconvert tag: shi-latn to shi-tfng !! wikitext test !! html/php

ⵜⴻⵙⵜ

!! end !! test Langconvert tag: sr-latn to sr-cyrl !! wikitext zdravo !! html/php

здраво

!! end !! test Langconvert tag: sr-el to sr-ec (should fail) !! wikitext zdravo !! html/php

Error: Langconvert tag's from and to attributes must not be empty and must contain BCP 47 codes for convertible variants of the same language.

!! end !! test Langconvert tag: tg to tg-latn !! wikitext тест !! html/php

test

!! end !! test Langconvert tag: uz-cyrl to uz-latn !! wikitext тест !! html/php

test

!! end !! test Langconvert tag: zh-hans to zh-hant !! wikitext !! html/php

!! end !! test Langconvert tag: self-closed !! wikitext xx !! html/php

xx

!! end !! test T302678: Serialize empty twoway !! options language=zh parsoid=html2wt !! html/parsoid

!! wikitext -{H|}- !! end ## Legacy parser inconsistency in the title attribute !! test Nonexistent internal link targets should be resolved using variants (T258856) !! options language=sr variant=sr-ec !! wikitext [[Test]] !! html/php

Тест

!! html/parsoid

Test

!! html/parsoid+langconv

Тест

!! end