-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathparserTests.txt
17241 lines (15498 loc) · 496 KB
/
parserTests.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# 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
# MediaWiki Parser test cases
# Some taken from https://meta.wikimedia.org/wiki/Parser_testing
# All (C) their respective authors and released under the GPL
#
# The syntax should be fairly self-explanatory.
#
# Currently supported test options:
# One of the following modes:
#
# (default) generate HTML output
# pst apply pre-save transform
# msg apply message transform
# comment run through MediaWiki\CommentFormatter\CommentFormatter::format() instead of main parser
#
# Options for adding metadata to the metadata section:
# (Previously, these options pre- or post- pended to the html section)
#
# cat add category links
# extlinks add external link metadata
# ill add inter-language links
# iwl add inter-wiki links
# links add local wiki links
# special add links to special pages
# templates add template information
# property=XXX add the value of the page property with the given name.
# This can also be a comma-separated list.
# extension=XXX add the JSON-encoded value of the given extension data.
# This can also be a comma-separated list.
# showtitle add the rendered title
# showflags add the set parser output flags
# showtocdata add table of contents data
# showindicators add the page status indicators
# showmedia add the titles of the rendered media
#
# Parser parameters:
#
# subpage enable subpages (disabled by default)
# title=[[XXX]] run test using article title XXX
# language=XXX set content language to XXX for this test
# wtVariantLanguage=XXX set the wikitext (input) variant of language for this
# test using a BCP-47 code (eg zh-Hant-TW)
# htmlVariantLanguage=XXX set the html (output) variant of language for this
# test using a BCP-47 code (eg zh-Hant-TW)
# userLanguage=XXX set user language to XXX for this test
# notoc disable table of contents
# thumbsize=NNN set the default thumb size to NNNpx for this test
# wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
# local format section links in edit comment text as local links
#
# Configuration globals:
#
# wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
# wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
# wgEnableMagicLinks, wgLocaltimezone
#
# Test execution options:
#
# disabled do not run test
# parsoid parsoid-specific options (not run by PHP parser unless
# the test includes an html/php section)
# php php-only test (not run by the parsoid parser unless
# the test includes an html/parsoid section)
#
# For testing purposes, temporary articles can created:
# !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
# where '/' denotes a newline.
# This is the standard article assumed to exist.
!! article
Main Page
!! text
blah blah
!! endarticle
!!article
Foo
!!text
FOO
!!endarticle
!!article
Foo''s bar''s
!!text
Article titles can contain single quotes!
!!endarticle
!!article
Template:Foo
!!text
FOO
!!endarticle
!! article
Template:redirect to foo
!! text
#REDIRECT [[Template:Foo]]
!! endarticle
!! article
Template:Blank
!! text
!! endarticle
!! article
Template:pipe
!! text
|
!! endarticle
!! article
Template:=
!! text
<nowiki>=</nowiki>
!! endarticle
!! article
Template:inner list
!! text
* item 1
!! endarticle
!! article
Template:tbl-start
!! text
{|
!! endarticle
!! article
Template:tbl-end
!! text
|}
!! endarticle
!! article
Template:table_attribs_3
!! text
<noinclude>
|</noinclude>style{{=}}"background:#f9f9f9;"|Foo
!! endarticle
!! article
Template:table_attribs_6
!! text
style="background: <nowiki>
red;</nowiki>" |
!! endarticle
!! article
Template:1x
!! text
{{{1}}}
!! endarticle
# For is; localize Template namespace
!! article
Snið:1x
!! text
{{{1}}}
!! endarticle
!! article
Template:3x_on_newline
!! text
{{{1}}}
{{{1}}}
{{{1}}}
!! endarticle
!! article
Template:1x_with_span
!! text
<span>{{{1}}}</span>
!! endarticle
!! article
Template:1x_with_div
!! text
<div>{{{1}}}</div>
!! endarticle
!! article
Template:1x with depth
!! text
{{1x|{{{1}}}}}
!! endarticle
!! article
Template:blank_param
!! text
{{{1}}}
{{{}}}
!! endarticle
## See T48811 for details
!! article
Template:mixed_attr_content_template
!! text
style="color:red;" title="T48811"
|-
|foo
!! endarticle
## This template has a category in fosterable position. See T249740 for details
!! article
Template:mixed_attr_content_template_2
!! text
style="color:red;" title="T249740"
|-
[[Category:Fostered Content]]
|foo
!! endarticle
!! article
A?b
!! text
Weirdo titles!
!! endarticle
!!article
Template:Bullet
!!text
*Bar
!!endarticle
!!article
Template:OpenTable
!!text
{|
!!endarticle
!!article
Template:EmptyLITest
!!text
*a
*
*
*b
!!endarticle
!!article
Template:EmptyTRTest
!!text
{|
|-
|-
|foo
|-
|-
|bar
|}
!!endarticle
!!article
Template:EmptyTRWithHTMLAttrTest
!!text
<table>
<tr align="center"></tr>
<tr><td>foo</td></tr>
<tr align="center"></tr>
<tr><td>bar</td></tr>
</table>
!!endarticle
!! article
Template:With: Colon
!! text
Template with colon
!! endarticle
!! article
Template:Template with pagename
!! text
This is {{PAGENAME}}.
!! endarticle
!! article
File:Redirect to foobar.jpg
!! text
#REDIRECT[[File:Foobar.jpg]]
!! endarticle
# Use an entity in the name
!! article
Template:Foo–bar
!! text
foo
!! endarticle
###
### Basic tests
###
!! test
Blank input
!! wikitext
!! html
!! end
!! test
Simple paragraph
!! wikitext
This is a simple paragraph.
!! html
<p>This is a simple paragraph.
</p>
!! end
!! test
Paragraphs with extra newline spacing
!! wikitext
a
b (+2 nls)
c (+3 nls)
d (+4 nls)
e (+5 nls)
!! html
<p>a
</p><p>b (+2 nls)
</p><p><br />
c (+3 nls)
</p><p><br />
</p><p>d (+4 nls)
</p><p><br />
</p><p><br />
e (+5 nls)
</p>
!! end
!! test
Paragraphs with newline spacing with comment lines in between
!! wikitext
----
a
<!--foo-->
b
----
a
<!--foo--><!--More than 1 comment, still stripped-->
b
----
a
<!--foo--> <!----> <!-- bar -->
b
----
a
<!--foo-->
b
----
a
<!--foo-->
b
----
a
<!--foo-->
b
----
a
<!--foo-->
b
----
!! html
<hr />
<p>a
b
</p>
<hr />
<p>a
b
</p>
<hr />
<p>a
b
</p>
<hr />
<p>a
</p><p>b
</p>
<hr />
<p>a
</p><p>b
</p>
<hr />
<p>a
</p><p><br />
b
</p>
<hr />
<p>a
</p><p><br />
b
</p>
<hr />
!! end
!! test
Paragraphs with newline spacing with non-empty white-space lines in between
!! wikitext
----
a
b
----
a
b
----
!! html
<hr />
<p>a
</p><p>b
</p>
<hr />
<p>a
</p><p><br />
b
</p>
<hr />
!! end
!! test
Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
!! wikitext
----
a
<!--foo-->
b
----
a
<!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
b
----
a
<!--foo-->
<!--bar-->
b
----
a
<!--foo-->
<!--bar-->
b
----
!! html
<hr />
<p>a
b
</p>
<hr />
<p>a
b
</p>
<hr />
<p>a
</p><p>b
</p>
<hr />
<p>a
</p><p><br />
b
</p>
<hr />
!! end
!! test
Extra newlines: More paragraphs with indented comment
!! wikitext
a
<!--boo-->
b
!! html
<p>a
</p><p><br />
b
</p>
!!end
!! test
Extra new lines before and after lists are preserved
!! wikitext
a
*b
c
!! html/php
<p>a
</p><p><br />
</p>
<ul><li>b</li></ul>
<p><br />
c
</p>
!! html/parsoid
<p>a</p>
<p>
<br></p>
<ul><li>b</li></ul>
<p>
<br>
c</p>
!! end
# Parsoid regression test
!!test
Multiple newlines after tables are converted to p-br-p tags
!!options
parsoid=wt2html,wt2wt
!! config
wgParserEnableLegacyHeadingDOM=false
!!wikitext
{|
|x
|}
=b=
!!html/php
<table>
<tbody><tr>
<td>x
</td></tr></tbody></table>
<p><br />
</p><p><br />
</p>
<div class="mw-heading mw-heading1"><h1 id="b">b</h1><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></div>
!!html/parsoid
<table>
<tbody>
<tr>
<td>x</td>
</tr>
</tbody>
</table>
<p><br/></p>
<p><br/></p>
<h1 id="b">b</h1>
!!end
!! test
Parsing an URL
!! wikitext
http://fr.wikipedia.org/wiki/🍺
<!-- EasterEgg we love beer, better be able be able to link to it -->
!! html
<p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
</p>
!! end
!! test
Simple list
!! wikitext
*Item 1
*Item 2
!! html
<ul><li>Item 1</li>
<li>Item 2</li></ul>
!! end
###
### Non-html5 tags
###
## The attribute on the font tag is so Parsoid won't normalize it away
!! test
Non-html5 tags should be accepted
!! wikitext
<center>''foo''</center>
<big>''foo''</big>
<font style="123">''foo''</font>
<strike>''foo''</strike>
<tt>''foo''</tt>
!! html
<center><i>foo</i></center>
<p><big><i>foo</i></big>
<font style="123"><i>foo</i></font>
<strike><i>foo</i></strike>
<tt><i>foo</i></tt>
</p>
!! end
!! test
<wbr> is valid wikitext (T54468)
!! wikitext
<wbr>
!! html
<p><wbr />
</p>
!! end
# <strike> is HTML4, <s> is HTML4/5.
!! test
<s> or <strike> for strikethrough
!! wikitext
<strike>strike</strike>
<s>s</s>
!! html
<p><strike>strike</strike>
</p><p><s>s</s>
</p>
!! end
## a not permitted
## i,b,br omitted
!! test
Text-level semantic html elements in wikitext
!! wikitext
<em>text</em>
<strong>text</strong>
<small>text</small>
<s>text</s>
<cite>text</cite>
<q>text</q>
<dfn>text</dfn>
<abbr>text</abbr>
<data>text</data>
<time>text</time>
<code>text</code>
<var>text</var>
<samp>text</samp>
<kbd>text</kbd>
<sub>text</sub>
<u>text</u>
<mark>text</mark>
<ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
<bdi>text</bdi>
<bdo>text</bdo>
<span>text</span>
<wbr />
!! html
<p><em>text</em>
<strong>text</strong>
<small>text</small>
<s>text</s>
<cite>text</cite>
<q>text</q>
<dfn>text</dfn>
<abbr>text</abbr>
<data>text</data>
<time>text</time>
<code>text</code>
<var>text</var>
<samp>text</samp>
<kbd>text</kbd>
<sub>text</sub>
<u>text</u>
<mark>text</mark>
<ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
<bdi>text</bdi>
<bdo>text</bdo>
<span>text</span>
<wbr />
</p>
!! end
# test cases taken from
# https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
!! test
Ruby markup (W3C-style)
!! wikitext
;Mono-ruby for individual base characters
:<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
;Group ruby
:<ruby>今日<rt>きょう</rt></ruby>
;Jukugo ruby
:<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
;Inline ruby
:<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
;Double-sided ruby
:<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
<ruby>
<rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
<rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
<rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
</ruby>
!! html
<dl><dt>Mono-ruby for individual base characters</dt>
<dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
<dt>Group ruby</dt>
<dd><ruby>今日<rt>きょう</rt></ruby></dd>
<dt>Jukugo ruby</dt>
<dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
<dt>Inline ruby</dt>
<dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
<dt>Double-sided ruby</dt>
<dd><ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
<p><ruby>
<rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
<rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
<rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
</ruby>
</p>
!! end
# The next two test different paths in the sanitizer.
!! test
Non-word characters don't terminate tag names (T19663, T42670, T54022)
!! wikitext
<blockquote|>a</blockquote>
<b→> doesn't terminate </b→>
<bä> doesn't terminate </bä>
<boo> doesn't terminate </boo>
<s.foo> doesn't terminate </s.foo>
<sub-ID#1>
!! html
<p><blockquote|>a
</p><p><b→> doesn't terminate </b→>
</p><p><bä> doesn't terminate </bä>
</p><p><boo> doesn't terminate </boo>
</p><p><s.foo> doesn't terminate </s.foo>
</p><p><sub-ID#1>
</p>
!! end
###
### See tests/parser/ParserTestParserHook.php for the <tåg> extension)
### This checks that HTML5 tags (with non-word characters in the tag
### name) make it safely through the parser -- the Sanitizer will
### munge them later, as it should.
###
!! test
Non-word characters are valid in extension tags (T19663)
!! wikitext
<tåg>tåg</tåg>
!! html/php
<pre>'tåg'
array (
)
</pre>
!! html/parsoid
<pre typeof="mw:Extension/tåg" about="#mwt3" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}'>'tåg'
array (
)
</pre>
!! end
!! test
Isolated close tags should be treated as literal text (T54760)
!! options
parsoid=wt2html
!! wikitext
</b>
<s.foo>s</s>
!! html
<p class="mw-empty-elt">
</p><p><s.foo>s
</p>
!! end
!! test
Self-closed tag hooks
!! wikitext
<pre />
<gallery />
<indicator name="something" />
!! html/php
<pre></pre>
<ul class="gallery mw-gallery-traditional">
</ul>
!! html/parsoid
<pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{}}'></pre>
<ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt5" data-mw='{"name":"gallery","attrs":{}}'>
</ul>
<meta typeof="mw:Extension/indicator" about="#mwt6" data-mw='{"name":"indicator","attrs":{"name":"something"},"html":""}'/>
!! end
###
### Special characters
###
!! test
Bare pipe character (T54363)
!! wikitext
|
!! html
<p>|
</p>
!! end
!! test
Bare pipe character from a template (T54363)
!! wikitext
{{pipe}}
!! html
<p>|
</p>
!! end
!! test
Implicit newline insertion/sol when expanding templates (T241150/T14974/T2529)
!! wikitext
{{1x|#foo}}{{1x|#foo}}
!! html/php
<ol><li>foo</li>
<li>foo</li></ol>
!! html/parsoid
<ol about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}],[{"k":"1"}]],"dsr":[0,22,null,null]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"#foo"}},"i":0}},{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"#foo"}},"i":1}}]}'><li>foo</li>
<li>foo</li></ol>
!! end
###
### <nowiki> test cases
###
!! test
<nowiki> unordered list
!! wikitext
<nowiki>* This is not an unordered list item.</nowiki>
!! html/php
<p>* This is not an unordered list item.
</p>
!! html/parsoid
<p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
!! end
!! test
<nowiki> spacing
!! wikitext
<nowiki>Lorem ipsum dolor
sed abit.
sed nullum.
:and a colon
</nowiki>
!! html/php
<p>Lorem ipsum dolor
sed abit.
sed nullum.
:and a colon
</p>
!! html/parsoid
<p><span typeof="mw:Nowiki">Lorem ipsum dolor
sed abit.
sed nullum.
:and a colon
</span></p>
!! end
!! test
Don't parse <nowiki><span class="error"></nowiki> (T149622)
!! wikitext
<nowiki><span class="error"></nowiki>
!! html/php
<p><span class="error">
</p>
!! html/parsoid
<p><span typeof="mw:Nowiki"><span class="error"></span></p>
!! end
!! test
nowiki 3
!! wikitext
:There is not nowiki.
:There is <nowiki>nowiki</nowiki>.
#There is not nowiki.
#There is <nowiki>nowiki</nowiki>.
*There is not nowiki.
*There is <nowiki>nowiki</nowiki>.
!! html/php
<dl><dd>There is not nowiki.</dd>
<dd>There is nowiki.</dd></dl>
<ol><li>There is not nowiki.</li>
<li>There is nowiki.</li></ol>
<ul><li>There is not nowiki.</li>
<li>There is nowiki.</li></ul>
!! html/parsoid
<dl><dd data-parsoid='{}'>There is not nowiki.</dd>
<dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
<ol><li data-parsoid='{}'>There is not nowiki.</li>
<li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
<ul><li data-parsoid='{}'>There is not nowiki.</li>
<li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
!! end
!! test
Entities inside <nowiki>
!! wikitext
<nowiki><</nowiki>
!! html/php
<p><
</p>
!! html/parsoid
<p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&lt;","srcContent":"<"}'><</span></span></p>
!! end
!! test
Entities inside template parameters
!! wikitext
{{1x|–}}
!! html/php
<p>–
</p>
!! html/parsoid
<p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&ndash;"}},"i":0}}]}'>–</span></p>
!! end
!! test
Properly escape nowiki when combined with other wiki markup
!! options
parsoid=html2wt
!! html/parsoid
<p>* </nowiki> tag</p>
!! wikitext
<nowiki>*</nowiki> <nowiki></nowiki></nowiki> tag
!! end
!! test
T93824: Put escaped HTML tags inside nowiki
!! options
parsoid=html2wt
!! html/parsoid
<p><h2>foo</h2></p>
!! wikitext
<nowiki><h2>foo</h2></nowiki>
!! end
!! test
T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
!! options
parsoid=html2wt
!! html/parsoid
<p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
!! wikitext
This text: L'[[Foo]]
This text: L<nowiki>''</nowiki>[[Foo]]
This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
!! end
!! test
T71950: 2. Put nowiki as close to cause as possible, after ' :'
!! options
parsoid=html2wt
!! html/parsoid
<p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
</p>
!! wikitext
This text : L<nowiki>''</nowiki>[[Foo]]
!! end
# This test and the next one are html2wt only as they test that incorrect wikitext
# passed in template arguments gets escaped or wrapped in nowikis where required.
!! test
T71482: Use {{!}} instead of nowiki for single pipe in template argument
!! options
parsoid=html2wt