Skip to content

Instantly share code, notes, and snippets.

@arlolra
Created December 30, 2015 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arlolra/4a79439db883141f120f to your computer and use it in GitHub Desktop.
Save arlolra/4a79439db883141f120f to your computer and use it in GitHub Desktop.
17d16
< # (ignored by Parsoid, since it emits <link>s)
1339,1340d1337
< !! html/parsoid
< <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
3335,3338d3331
< ## 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.
3342c3335
< parsoid=wt2html
---
> parsoid=wt2html,wt2wt
3346c3339
< !! html/parsoid
---
> !! html
7130,7140d7122
< Piped link with no link text
< !! wikitext
< [[Thomas Bek (bishop of St David's)|]]
< !! html/php
< <p>[[Thomas Bek (bishop of St David's)|]]
< </p>
< !! html/parsoid
< <p>[[Thomas Bek (bishop of St David's)|]]</p>
< !! end
<
< !! test
10881,10884d10862
< ## 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.
10887,10888d10864
< !! options
< parsoid=wt2html,html2html
11069,11072d11044
< ## 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.
11076c11048
< parsoid=wt2html
---
> parsoid=wt2html,wt2wt
14276c14248
< !! html/php
---
> !! html
14287c14259
< !! html/php
---
> !! html
14291,14294d14262
< ## 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.
14300d14267
< parsoid=wt2html
14303c14270
< !! html/php
---
> !! html
14305,14306d14271
< !! html/parsoid
< <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14316c14281
< !! html/php
---
> !! html
14327c14292
< !! html/php
---
> !! html
14338c14303
< !! html/php
---
> !! html
14342,14345d14306
< ## 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.
14348,14349d14308
< !! options
< parsoid=wt2html
14376c14335
< !! html/php
---
> !! html
14386,14392d14344
< !! html/parsoid
< <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
< <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
< <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
< <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
< <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/></p>
< <link rel="mw:PageProp/Category" href="Category:Baz"/>
14395,14399d14346
< ## 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.
< ##
14404c14351
< parsoid=wt2html
---
> parsoid=wt2html,wt2wt
14411c14358
< !! html/php
---
> !! html
14509,14512d14455
< ## 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.
14515,14516d14457
< !! options
< parsoid=wt2html
14567,14576c14508,14510
< # 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.
---
> # html2wt localizes the "Category" namespace.
> # XXX the <link> element needs an empty data-parsoid attribute, or
> # else the html2html test fails because spaces are inserted.
14580c14514
< parsoid=wt2html
---
> parsoid=wt2html,wt2wt,html2html
16221,16222d16154
< !! html/parsoid
< <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16225d16156
< ## Don't expect parsoid to rt this form.
16228,16229d16158
< !! options
< parsoid=wt2html,html2html
16239,16240d16167
< !! html/parsoid
< <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16254,16255d16180
< !! html/parsoid
< <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16269,16270d16193
< !! html/parsoid
< <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16273c16196
< ## Don't expect parsoid to rt this form.
---
>
16276,16277d16198
< !! options
< parsoid=wt2html,html2html
16287,16288d16207
< !! html/parsoid
< <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16291c16210
< ## Don't expect parsoid to rt this form.
---
>
16294,16295d16212
< !! options
< parsoid=wt2html,html2html
16305,16306d16221
< !! html/parsoid
< <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16322,16323d16236
< !! html/parsoid
< <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16329,16350d16241
< <tag width="200" height="100" depth="50" square=""></tag>
< !! html/php
< <pre>
< ''
< array (
< 'width' => '200',
< 'height' => '100',
< 'depth' => '50',
< 'square' => '',
< )
< </pre>
<
< !! html/parsoid
< <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
< !! end
<
< ## Don't expect parsoid to rt this form.
< !! test
< Parser hook: basic arguments, variations
< !! options
< parsoid=wt2html,html2html
< !! wikitext
16363,16364d16253
< !! html/parsoid
< <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16370c16259
< <tag filename="/tmp/bla"></tag>
---
> <tag filename='/tmp/bla'></tag>
16379,16380d16267
< !! html/parsoid
< <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16383d16269
< ## Don't expect parsoid to rt this form.
16386,16387d16271
< !! options
< parsoid=wt2html,html2html
16398,16399d16281
< !! html/parsoid
< <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16432,16433c16314
<
< <statictag action="flush" />
---
> <statictag action=flush/>
16435,16436c16316
< <p><br />
< hello, world
---
> <p>hello, world
16438,16440d16317
< !! html/parsoid
< <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
< <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16442a16320
>
16447c16325
< <statictag action="flush" />
---
> <statictag action=flush/>
16451,16453d16328
< !! html/parsoid
< <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
< <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
19339,19342d19213
< ## 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.
19346,19348c19217
< cat
< language=zh
< parsoid=wt2html
---
> language=zh cat
19351c19220
< !! html/php
---
> !! html
19353,19355d19221
< !! html/parsoid
< <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
< <link rel="mw:PageProp/Category" href="Category:分类"/>
19357a19224
>
19892c19759
< !! html/php
---
> !! html
20214c20081
< !! html/php
---
> !! html
20224c20091
< !! html/php
---
> !! html
20234c20101
< !! html/php
---
> !! html
20244c20111
< !! html/php
---
> !! html
20254c20121
< !! html/php
---
> !! html
20264c20131
< !! html/php
---
> !! html
20276c20143
< !! html/php
---
> !! html
20288c20155
< !! html/php
---
> !! html
20299c20166
< !! html/php
---
> !! html
20311c20178
< !! html/php
---
> !! html
20322c20189
< !! html/php
---
> !! html
20328,20329d20194
< !! options
< title=[[Foo]]
20332c20197
< !! html/php
---
> !! html
20335,20336d20199
< !! html/parsoid
< <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20343c20206
< !! html/*
---
> !! html
20355c20218
< !! html/php
---
> !! html
20674c20537
< !! html/php
---
> !! html
20679,20681c20542,20550
< !! html/parsoid
< <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
< <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
---
> !! end
>
> !! test
> Strip reserved data attributes
> !! wikitext
> <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
> !! html
> <div data-ok="fred">d</div>
>
21519a21389,21390
> !!options
> parsoid
21525c21396
< !! html/parsoid
---
> !! html
21537a21409,21410
> !!options
> parsoid
21542c21415
< !! html/parsoid
---
> !! html
21551a21425,21426
> !!options
> parsoid
21557c21432
< !! html/parsoid
---
> !! html
21568a21444,21445
> !!options
> parsoid
21572c21449
< !! html/parsoid
---
> !! html
21580a21458,21459
> !!options
> parsoid
21587c21466
< !! html/parsoid
---
> !! html
21597a21477,21478
> !!options
> parsoid
21606c21487
< !! html/parsoid
---
> !! html
21618a21500,21501
> !!options
> parsoid
21634c21517
< !! html/parsoid
---
> !! html
21653a21537,21538
> !!options
> parsoid
21658c21543
< !! html/parsoid
---
> !! html
21661c21546
< <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo {{echo|</span></li>
---
> <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <span typeof="mw:Nowiki" data-parsoid='{"src":"{{","dsr":[12,14,0,0]}'>{{</span>echo|</span></li>
21666a21552,21553
> !!options
> parsoid
21670c21557
< !! html/parsoid
---
> !! html
21678a21566,21567
> !!options
> parsoid
21683c21572
< !! html/parsoid
---
> !! html
21693a21583,21584
> !!options
> parsoid
21698c21589
< !! html/parsoid
---
> !! html
21731a21623,21624
> !!options
> parsoid
21737c21630
< !! html/parsoid
---
> !! html
21748a21642,21643
> !!options
> parsoid
21753c21648
< !! html/parsoid
---
> !! html
21762a21658,21659
> !!options
> parsoid
21768c21665
< !! html/parsoid
---
> !! html
21785c21682
< !! html/parsoid
---
> !! html
21792a21690,21691
> !!options
> parsoid
21797c21696
< !!html/parsoid
---
> !!html
21807a21707,21708
> !!options
> parsoid
21812c21713
< !!html/parsoid
---
> !!html
21822a21724,21725
> !!options
> parsoid
21827c21730
< !! html/parsoid
---
> !! html
21836a21740,21741
> !!options
> parsoid
21843c21748
< !! html/parsoid
---
> !! html
22077c21982
< !! test
---
> !!test
22079,22080d21983
< !! options
< parsoid={ "suppressErrors": true }
23674,23675c23577
< __TOC__
< bar
---
> __TOC__ bar
23825,23837d23726
< Self-closed tag with broken attribute value quoting
< !! options
< parsoid=wt2html,html2html
< !! wikitext
< <div title="Hello world />Foo
< !! html/php+tidy
< <div title="Hello world"></div>
< <p>Foo</p>
< !! html/parsoid
< <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
< !! end
<
< !! test
24465,24477d24353
< !! test
< Always encapsulate foster box when template range is expanded to table
< !! options
< parsoid=wt2wt
< !! wikitext
< {|
< hello
< {{OpenTable}}
< |}
< !! html/parsoid
<
< !! end
<
24912,24913c24788
<
< <span>bar</span>
---
> <nowiki> </nowiki><span>bar</span>
24955c24830
< == hello there [[Category:A1]] ==
---
> == hello there [[Category:A1]] ==
24957c24832
< == [[Category:A2]] hi pal ==
---
> == [[Category:A2]] hi pal ==
24959c24834
< == <!--foo--> [[Category:A3]] how goes it ==
---
> == <!--foo--> [[Category:A3]] how goes it ==
24961c24836
< == it goes well [[Category:A4]] <!--bar--> ==
---
> == it goes well [[Category:A4]] <!--bar--> ==
24963c24838
< ==howdy [[Category:A5]]==
---
> ==howdy [[Category:A5]] ==
25748c25623
< Strip span tags added to mark misnested links
---
> Strip span tags added to mark as misnested
25757,25803d25631
< !! test
< Use data-parsoid.firstWikitextNode to compute newline constraints for template content
< !! options
< parsoid=html2wt
< !! html/parsoid
< <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span><table about="#mwt2" typeof="mw:Transclusion mw:ExpandedAttrs" data-parsoid='{"a":{"{{echo|c\n{{!}}d\n}}":null},"sa":{"{{echo|c\n{{!}}d\n}}":""},"firstWikitextNode":"table","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c\n{{!}}d\n"}},"i":0}},"\n|}"]}'>
< <tbody><tr><td>d
< </td></tr>
< </tbody></table>
< !! wikitext
< {{echo|a}}
< {|{{echo|c
< {{!}}d
< }}
< |}
< !! end
<
< ## This test verifies the presence and computation of this attribute indirectly
< ## by making an edit and ensuring that the serialization is correct (which it would be
< ## only if firstWikitextNode is properly set).
< !! test
< data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
< !! options
< parsoid= {
< "modes": ["wt2wt"],
< "changes": [
< [ "div#x", "remove" ],
< [ "div", "before", "<div>new</div>" ]
< ]
< }
< !! wikitext
< <div id="x">foo</div>
< {|
< {{echo|<div>boo</div>
< {{!}}b}}
< |c
< |}
< !! wikitext/edited
<
< <div>new</div>
< {|
< {{echo|<div>boo</div>
< {{!}}b}}
< |c
< |}
< !! end
<
25809,25863d25636
< 1. Categories should always be serialized on their own line
< !! options
< parsoid=html2wt
< !! html/parsoid
< foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
< !! wikitext
< foo
< [[Category:Foo]]
< bar
< !! end
<
< !! test
< 2. Categories that are part of templates should not introduce a line break
< !! wikitext
< foo {{echo|<span>bar</span> [[Category:baz]]}} bar
< !! html/parsoid
< <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>bar&lt;/span> [[Category:baz]]"}},"i":0}}]}'>bar</span><span about="#mwt1"> </span><link rel="mw:PageProp/Category" href="./Category:Baz" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:baz"}}'/> bar</p>
< !! end
<
< # Careful while editing these next 2 tests. There are \u200f characters
< # before and after the <link> tags in the HTML and following some
< # of the categories in wikitext
< # Do not remove these characters in edits.
< #
< # As part of the serialization, these bidi characters will get stripped.
< !! test
< RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
< !! options
< parsoid={
< "modes": ["html2wt"],
< "scrubWikitext": true
< }
< !! html/parsoid
< <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
< ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
< !! wikitext
< [[קטגוריה:טקסים]]
< [[קטגוריה: שיטות משפט]]
< !! end
<
< !! test
< RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
< !! options
< parsoid={
< "modes": ["html2wt"],
< "scrubWikitext": true
< }
< !! html/parsoid
< <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
< !! wikitext
< [[קטגוריה:טקסים]]
< ‏y
< !! end
<
< !! test
25951,25979d25723
< Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
< !! options
< parsoid={
< "modes": ["html2wt"],
< "scrubWikitext": true
< }
< !! html/parsoid
< <h2>foo<br/>bar</h2>
< <h2>foo <span><br/>bar</span> baz</h2>
< !! wikitext
< == foo bar ==
<
< == foo <span> bar</span> baz ==
< !! end
<
< !! test
< Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
< !! options
< parsoid={
< "modes": ["html2wt"],
< "scrubWikitext": false
< }
< !! html/parsoid
< <h2>foo<br/>bar</h2>
< !! wikitext
< == foo<br> bar ==
< !! end
<
< !! test
26484,26506d26227
< # This is meant to be an interim fix while we go about figuring out
< # how to not introduce these trailing <nowiki/>s in the first place.
< !! test
< T115717: Strip trailing <nowiki/>s (without affecting valid uses)
< !! options
< parsoid=html2wt
< !! html/parsoid
< <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
< y</p>
< <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,23,null,null],"pi":[[{"k":"1","named":true,"spc":["\n"," "," ",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
< <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,24,null,null],"pi":[[{"k":"1","named":true,"spc":["\n"," "," ","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
< !! wikitext
< x
< y
<
< {{echo|
< 1 = <nowiki/>}}
<
< {{echo|
< 1 = <nowiki/>
< }}
< !! end
<
26511,26538d26231
< # T104032
< !! test
< Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
< !! options
< parsoid=html2wt
< !! html/parsoid
< a<p>b</p>
< <b>c</b><p>d</p>
< <table><tr>
< <td>a<p>b</p></td>
< <td><b>c</b><p>d</p></td>
< </tr></table>
< !! wikitext
< a
<
< b
<
< '''c'''
<
< d
< {|
< |a
< b
< |'''c'''
< d
< |}
< !! end
<
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment