@@ -341,8 +341,14 @@ def test_footnote_order(self):
341
341
"""Test that footnotes occur in order of reference appearance."""
342
342
343
343
self .assertMarkdownRenders (
344
- 'First footnote reference[^first]. Second footnote reference[^last].\n \n '
345
- '[^last]: Second footnote.\n [^first]: First footnote.' ,
344
+ self .dedent (
345
+ """
346
+ First footnote reference[^first]. Second footnote reference[^last].
347
+
348
+ [^last]: Second footnote.
349
+ [^first]: First footnote.
350
+ """
351
+ ),
346
352
'<p>First footnote reference<sup id="fnref:first"><a class="footnote-ref" '
347
353
'href="#fn:first">1</a></sup>. Second footnote reference<sup id="fnref:last">'
348
354
'<a class="footnote-ref" href="#fn:last">2</a></sup>.</p>\n '
@@ -362,17 +368,23 @@ def test_footnote_order(self):
362
368
)
363
369
364
370
def test_footnote_order_tricky (self ):
365
- """Test that tricky sequence of footnote references."""
371
+ """Test a tricky sequence of footnote references."""
366
372
367
373
self .assertMarkdownRenders (
368
- '`Footnote reference in code spans should be ignored[^tricky]`. '
369
- 'A footnote reference[^ordinary]. '
370
- 'Another footnote reference[^tricky].\n \n '
371
- '[^ordinary]: This should be the first footnote.\n '
372
- '[^tricky]: This should be the second footnote.' ,
373
- '<p><code>Footnote reference in code spans should be ignored[^tricky]</code>. '
374
- 'A footnote reference<sup id="fnref:ordinary"><a class="footnote-ref" '
375
- 'href="#fn:ordinary">1</a></sup>. Another footnote reference<sup id="fnref:tricky">'
374
+ self .dedent (
375
+ """
376
+ `Footnote reference in code spans should be ignored[^tricky]`.
377
+ A footnote reference[^ordinary].
378
+ Another footnote reference[^tricky].
379
+
380
+ [^ordinary]: This should be the first footnote.
381
+ [^tricky]: This should be the second footnote.
382
+ """
383
+ ),
384
+ '<p><code>Footnote reference in code spans should be ignored[^tricky]</code>.\n '
385
+ 'A footnote reference<sup id="fnref:ordinary">'
386
+ '<a class="footnote-ref" href="#fn:ordinary">1</a></sup>.\n '
387
+ 'Another footnote reference<sup id="fnref:tricky">'
376
388
'<a class="footnote-ref" href="#fn:tricky">2</a></sup>.</p>\n '
377
389
'<div class="footnote">\n '
378
390
'<hr />\n '
@@ -409,9 +421,14 @@ def test_footnote_reference_within_footnote_definition(self):
409
421
"""Test footnote definition containing another footnote reference."""
410
422
411
423
self .assertMarkdownRenders (
412
- 'Main footnote[^main].\n \n '
413
- '[^main]: This footnote references another[^nested].\n '
414
- '[^nested]: Nested footnote.' ,
424
+ self .dedent (
425
+ """
426
+ Main footnote[^main].
427
+
428
+ [^main]: This footnote references another[^nested].
429
+ [^nested]: Nested footnote.
430
+ """
431
+ ),
415
432
'<p>Main footnote<sup id="fnref:main"><a class="footnote-ref" href="#fn:main">1</a></sup>.</p>\n '
416
433
'<div class="footnote">\n '
417
434
'<hr />\n '
@@ -433,7 +450,13 @@ def test_footnote_reference_within_blockquote(self):
433
450
"""Test footnote reference within a blockquote."""
434
451
435
452
self .assertMarkdownRenders (
436
- '> This is a quote with a footnote[^quote].\n \n [^quote]: Quote footnote.' ,
453
+ self .dedent (
454
+ """
455
+ > This is a quote with a footnote[^quote].
456
+
457
+ [^quote]: Quote footnote.
458
+ """
459
+ ),
437
460
'<blockquote>\n '
438
461
'<p>This is a quote with a footnote<sup id="fnref:quote">'
439
462
'<a class="footnote-ref" href="#fn:quote">1</a></sup>.</p>\n '
@@ -453,7 +476,14 @@ def test_footnote_reference_within_list(self):
453
476
"""Test footnote reference within a list item."""
454
477
455
478
self .assertMarkdownRenders (
456
- '1. First item with footnote[^note]\n 1. Second item\n \n [^note]: List footnote.' ,
479
+ self .dedent (
480
+ """
481
+ 1. First item with footnote[^note]
482
+ 1. Second item
483
+
484
+ [^note]: List footnote.
485
+ """
486
+ ),
457
487
'<ol>\n '
458
488
'<li>First item with footnote<sup id="fnref:note">'
459
489
'<a class="footnote-ref" href="#fn:note">1</a></sup></li>\n '
@@ -511,7 +541,13 @@ def test_footnote_reference_within_html(self):
511
541
"""Test footnote reference within HTML tags."""
512
542
513
543
self .assertMarkdownRenders (
514
- 'A <span>footnote reference[^1] within a span element</span>.\n \n [^1]: The footnote.' ,
544
+ self .dedent (
545
+ """
546
+ A <span>footnote reference[^1] within a span element</span>.
547
+
548
+ [^1]: The footnote.
549
+ """
550
+ ),
515
551
'<p>A <span>footnote reference<sup id="fnref:1">'
516
552
'<a class="footnote-ref" href="#fn:1">1</a>'
517
553
'</sup> within a span element</span>.</p>\n '
@@ -530,7 +566,13 @@ def test_duplicate_footnote_references(self):
530
566
"""Test multiple references to the same footnote."""
531
567
532
568
self .assertMarkdownRenders (
533
- 'First[^dup] and second[^dup] reference.\n \n [^dup]: Duplicate footnote.' ,
569
+ self .dedent (
570
+ """
571
+ First[^dup] and second[^dup] reference.
572
+
573
+ [^dup]: Duplicate footnote.
574
+ """
575
+ ),
534
576
'<p>First<sup id="fnref:dup">'
535
577
'<a class="footnote-ref" href="#fn:dup">1</a></sup> and second<sup id="fnref2:dup">'
536
578
'<a class="footnote-ref" href="#fn:dup">1</a></sup> reference.</p>\n '
@@ -560,7 +602,13 @@ def test_footnote_definition_without_reference(self):
560
602
"""Test footnote definition without corresponding reference."""
561
603
562
604
self .assertMarkdownRenders (
563
- 'No reference here.\n \n [^orphan]: Orphaned footnote.' ,
605
+ self .dedent (
606
+ """
607
+ No reference here.
608
+
609
+ [^orphan]: Orphaned footnote.
610
+ """
611
+ ),
564
612
'<p>No reference here.</p>\n '
565
613
'<div class="footnote">\n '
566
614
'<hr />\n '
@@ -577,7 +625,13 @@ def test_footnote_id_with_special_chars(self):
577
625
"""Test footnote id containing special and Unicode characters."""
578
626
579
627
self .assertMarkdownRenders (
580
- 'Special footnote id[^!#¤%/()=?+}{§øé].\n \n [^!#¤%/()=?+}{§øé]: The footnote.' ,
628
+ self .dedent (
629
+ """
630
+ Special footnote id[^!#¤%/()=?+}{§øé].
631
+
632
+ [^!#¤%/()=?+}{§øé]: The footnote.
633
+ """
634
+ ),
581
635
'<p>Special footnote id<sup id="fnref:!#¤%/()=?+}{§øé">'
582
636
'<a class="footnote-ref" href="#fn:!#¤%/()=?+}{§øé">1</a></sup>.</p>\n '
583
637
'<div class="footnote">\n '
0 commit comments