Skip to content

Commit ce45459

Browse files
committed
Add tricky edge case that messes with the reordering introduced in d7203c9
1 parent 0c2e4bf commit ce45459

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/test_syntax/extensions/test_footnotes.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,34 @@ def test_footnote_order(self):
361361
'</div>'
362362
)
363363

364+
def test_footnote_order_tricky(self):
365+
"""Test that tricky sequence of footnote references."""
366+
367+
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">'
376+
'<a class="footnote-ref" href="#fn:tricky">2</a></sup>.</p>\n'
377+
'<div class="footnote">\n'
378+
'<hr />\n'
379+
'<ol>\n'
380+
'<li id="fn:ordinary">\n'
381+
'<p>This should be the first footnote.&#160;<a class="footnote-backref" '
382+
'href="#fnref:ordinary" title="Jump back to footnote 1 in the text">&#8617;</a></p>\n'
383+
'</li>\n'
384+
'<li id="fn:tricky">\n'
385+
'<p>This should be the second footnote.&#160;<a class="footnote-backref" '
386+
'href="#fnref:tricky" title="Jump back to footnote 2 in the text">&#8617;</a></p>\n'
387+
'</li>\n'
388+
'</ol>\n'
389+
'</div>'
390+
)
391+
364392
def test_footnote_reference_within_code_span(self):
365393
"""Test footnote reference within a code span."""
366394

0 commit comments

Comments
 (0)