You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MediaWiki writer: fix code for generating spans for header IDs.
We need to generate a span when the header's ID doesn't match
the one MediaWiki would generate automatically. But MediaWiki's
generation scheme is different from ours (it uses uppercase letters,
and `_` instead of `-`, for example).
This means that in going from markdown -> mediawiki, we'll now get
spans before almost every heading, unless explicit identifiers are
used that correspond to the ones MediaWiki auto-generates.
This is uglier output but it's necessary for internal links to
work properly.
See #7697.
Copy file name to clipboardExpand all lines: test/writer.mediawiki
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,31 +3,41 @@ This is a set of tests for pandoc. Most of them are adapted from John Gruber’s
3
3
4
4
-----
5
5
6
+
<span id="headers"></span>
6
7
= Headers =
7
8
9
+
<span id="level-2-with-an-embedded-link"></span>
8
10
== Level 2 with an [[url|embedded link]] ==
9
11
12
+
<span id="level-3-with-emphasis"></span>
10
13
=== Level 3 with ''emphasis''===
11
14
15
+
<span id="level-4"></span>
12
16
==== Level 4 ====
13
17
18
+
<span id="level-5"></span>
14
19
===== Level 5 =====
15
20
21
+
<span id="level-1"></span>
16
22
= Level 1 =
17
23
24
+
<span id="level-2-with-emphasis"></span>
18
25
== Level 2 with ''emphasis''==
19
26
27
+
<span id="level-3"></span>
20
28
=== Level 3 ===
21
29
22
30
with no blank line
23
31
32
+
<span id="level-2"></span>
24
33
== Level 2 ==
25
34
26
35
with no blank line
27
36
28
37
29
38
-----
30
39
40
+
<span id="paragraphs"></span>
31
41
= Paragraphs =
32
42
33
43
Here’s a regular paragraph.
@@ -42,6 +52,7 @@ here.
42
52
43
53
-----
44
54
55
+
<span id="block-quotes"></span>
45
56
= Block Quotes =
46
57
47
58
E-mail style:
@@ -71,6 +82,7 @@ And a following paragraph.
71
82
72
83
-----
73
84
85
+
<span id="code-blocks"></span>
74
86
= Code Blocks =
75
87
76
88
Code:
@@ -90,8 +102,10 @@ These should not be escaped: \$ \\ \> \[ \{</pre>
90
102
91
103
-----
92
104
105
+
<span id="lists"></span>
93
106
= Lists =
94
107
108
+
<span id="unordered"></span>
95
109
== Unordered ==
96
110
97
111
Asterisks tight:
@@ -130,6 +144,7 @@ Minuses loose:
130
144
* Minus 2
131
145
* Minus 3
132
146
147
+
<span id="ordered"></span>
133
148
== Ordered ==
134
149
135
150
Tight:
@@ -164,6 +179,7 @@ Multiple paragraphs:
164
179
<li><p>Item 2.</p></li>
165
180
<li><p>Item 3.</p></li></ol>
166
181
182
+
<span id="nested"></span>
167
183
== Nested ==
168
184
169
185
* Tab
@@ -188,13 +204,15 @@ Same thing but with paragraphs:
188
204
#* Foe
189
205
# Third
190
206
207
+
<span id="tabs-and-spaces"></span>
191
208
== Tabs and spaces ==
192
209
193
210
* this is a list item indented with tabs
194
211
* this is a list item indented with spaces
195
212
** this is an example list item indented with tabs
196
213
** this is an example list item indented with spaces
197
214
215
+
<span id="fancy-list-markers"></span>
198
216
== Fancy list markers ==
199
217
200
218
<ol start="2" style="list-style-type: decimal;">
@@ -239,6 +257,7 @@ B. Williams
239
257
240
258
-----
241
259
260
+
<span id="definition-lists"></span>
242
261
= Definition Lists =
243
262
244
263
Tight using spaces:
@@ -307,6 +326,7 @@ Blank line after term, indented marker, alternate markers:
307
326
;# sublist
308
327
;# sublist
309
328
329
+
<span id="html-blocks"></span>
310
330
= HTML Blocks =
311
331
312
332
Simple block on one line:
@@ -416,6 +436,7 @@ Hr’s:
416
436
417
437
-----
418
438
439
+
<span id="inline-markup"></span>
419
440
= Inline Markup =
420
441
421
442
This is ''emphasized'', and so ''is this''.
@@ -445,6 +466,7 @@ These should not be superscripts or subscripts, because of the unescaped spaces:
445
466
446
467
-----
447
468
469
+
<span id="smart-quotes-ellipses-dashes"></span>
448
470
= Smart quotes, ellipses, dashes =
449
471
450
472
“Hello,” said the spider. “‘Shelob’ is my name.”
@@ -466,6 +488,7 @@ Ellipses…and…and….
466
488
467
489
-----
468
490
491
+
<span id="latex"></span>
469
492
= LaTeX =
470
493
471
494
*
@@ -490,6 +513,7 @@ Here’s a LaTeX table:
490
513
491
514
-----
492
515
516
+
<span id="special-characters"></span>
493
517
= Special Characters =
494
518
495
519
Here is some unicode:
@@ -545,8 +569,10 @@ Minus: -
545
569
546
570
-----
547
571
572
+
<span id="links"></span>
548
573
= Links =
549
574
575
+
<span id="explicit"></span>
550
576
== Explicit ==
551
577
552
578
Just a [[url/|URL]].
@@ -567,6 +593,7 @@ Just a [[url/|URL]].
567
593
568
594
[[|Empty]].
569
595
596
+
<span id="reference"></span>
570
597
== Reference ==
571
598
572
599
Foo [[url/|bar]].
@@ -588,6 +615,7 @@ Foo [[url/|bar]].
588
615
589
616
Foo [[url/|biz]].
590
617
618
+
<span id="with-ampersands"></span>
591
619
== With ampersands ==
592
620
593
621
Here’s a [http://example.com/?foo=1&bar=2 link with an ampersand in the URL].
@@ -598,6 +626,7 @@ Here’s an [[script?foo=1&bar=2|inline link]].
598
626
599
627
Here’s an [[script?foo=1&bar=2|inline link in pointy braces]].
600
628
629
+
<span id="autolinks"></span>
601
630
== Autolinks ==
602
631
603
632
With an ampersand: http://example.com/?foo=1&bar=2
@@ -616,6 +645,7 @@ Auto-links should not occur here: <code><http://example.com/></code>
616
645
617
646
-----
618
647
648
+
<span id="images"></span>
619
649
= Images =
620
650
621
651
From “Voyage dans la Lune” by Georges Melies (1902):
@@ -627,6 +657,7 @@ Here is a movie [[File:movie.jpg|movie]] icon.
627
657
628
658
-----
629
659
660
+
<span id="footnotes"></span>
630
661
= Footnotes =
631
662
632
663
Here is a footnote reference,<ref>Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.</ref> and another.<ref>Here’s the long note. This one contains multiple blocks.
0 commit comments