aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIsaac Muse <faceless.shop@gmail.com>2017-01-23 12:31:41 -0700
committerWaylan Limberg <waylan.limberg@icloud.com>2017-01-23 14:31:41 -0500
commit8afeaafcb06c07058e1f296e3d3867048c01d18c (patch)
treef503585751230e4332c2c237162876947d393dce /tests
parent594b25d53798c30735da5a9be19c06cc94052a16 (diff)
downloadmarkdown-8afeaafcb06c07058e1f296e3d3867048c01d18c.tar.gz
markdown-8afeaafcb06c07058e1f296e3d3867048c01d18c.tar.bz2
markdown-8afeaafcb06c07058e1f296e3d3867048c01d18c.zip
Create additional references for duplicate footnotes (#534)
Track when we find duplicate footnote references and create unique ids for them. Then add an additional tree-processor after inline to go back and update the footnotes with additional back references that link to the duplicate footnote references. Fixes #468.
Diffstat (limited to 'tests')
-rw-r--r--tests/extensions/extra/footnote.html12
-rw-r--r--tests/extensions/extra/footnote.txt10
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/extensions/extra/footnote.html b/tests/extensions/extra/footnote.html
index e5b41a7..9cf42ed 100644
--- a/tests/extensions/extra/footnote.html
+++ b/tests/extensions/extra/footnote.html
@@ -1,5 +1,8 @@
<p>This is the body with a footnote<sup id="fnref:1"><a class="footnote-ref" href="#fn:1" rel="footnote">1</a></sup> or two<sup id="fnref:2"><a class="footnote-ref" href="#fn:2" rel="footnote">2</a></sup> or more<sup id="fnref:3"><a class="footnote-ref" href="#fn:3" rel="footnote">3</a></sup> <sup id="fnref:4"><a class="footnote-ref" href="#fn:4" rel="footnote">4</a></sup> <sup id="fnref:5"><a class="footnote-ref" href="#fn:5" rel="footnote">5</a></sup>.</p>
<p>Also a reference that does not exist[^6].</p>
+<p>Duplicate<sup id="fnref:a"><a class="footnote-ref" href="#fn:a" rel="footnote">6</a></sup> footnotes<sup id="fnref2:a"><a class="footnote-ref" href="#fn:a" rel="footnote">6</a></sup> test<sup id="fnref3:a"><a class="footnote-ref" href="#fn:a" rel="footnote">6</a></sup>.</p>
+<p>Duplicate<sup id="fnref:b"><a class="footnote-ref" href="#fn:b" rel="footnote">7</a></sup> footnotes<sup id="fnref2:b"><a class="footnote-ref" href="#fn:b" rel="footnote">7</a></sup> test<sup id="fnref3:b"><a class="footnote-ref" href="#fn:b" rel="footnote">7</a></sup>.</p>
+<p>Single after duplicates<sup id="fnref:c"><a class="footnote-ref" href="#fn:c" rel="footnote">8</a></sup>.</p>
<div class="footnote">
<hr />
<ol>
@@ -29,5 +32,14 @@
Second line of first paragraph is not intended.
Nor is third...&#160;<a class="footnote-backref" href="#fnref:5" rev="footnote" title="Jump back to footnote 5 in the text">&#8617;</a></p>
</li>
+<li id="fn:a">
+<p>1&#160;<a class="footnote-backref" href="#fnref:a" rev="footnote" title="Jump back to footnote 6 in the text">&#8617;</a><a class="footnote-backref" href="#fnref2:a" rev="footnote" title="Jump back to footnote 6 in the text">&#8617;</a><a class="footnote-backref" href="#fnref3:a" rev="footnote" title="Jump back to footnote 6 in the text">&#8617;</a></p>
+</li>
+<li id="fn:b">
+<p>2&#160;<a class="footnote-backref" href="#fnref:b" rev="footnote" title="Jump back to footnote 7 in the text">&#8617;</a><a class="footnote-backref" href="#fnref2:b" rev="footnote" title="Jump back to footnote 7 in the text">&#8617;</a><a class="footnote-backref" href="#fnref3:b" rev="footnote" title="Jump back to footnote 7 in the text">&#8617;</a></p>
+</li>
+<li id="fn:c">
+<p>3&#160;<a class="footnote-backref" href="#fnref:c" rev="footnote" title="Jump back to footnote 8 in the text">&#8617;</a></p>
+</li>
</ol>
</div> \ No newline at end of file
diff --git a/tests/extensions/extra/footnote.txt b/tests/extensions/extra/footnote.txt
index c5c1c92..f95ff2c 100644
--- a/tests/extensions/extra/footnote.txt
+++ b/tests/extensions/extra/footnote.txt
@@ -2,6 +2,12 @@ This is the body with a footnote[^1] or two[^2] or more[^3] [^4] [^5].
Also a reference that does not exist[^6].
+Duplicate[^a] footnotes[^a] test[^a].
+
+Duplicate[^b] footnotes[^b] test[^b].
+
+Single after duplicates[^c].
+
[^1]: Footnote that ends with a list:
* item 1
@@ -18,3 +24,7 @@ Also a reference that does not exist[^6].
[^5]: First line of first paragraph.
Second line of first paragraph is not intended.
Nor is third...
+
+[^a]: 1
+[^b]: 2
+[^c]: 3