git.iko.soy/typeable/pandoc
on master help sign in
HTML writer: Fixed footnote backlinks with --id-prefix.
e3f0123John MacFarlane
src/Text/Pandoc/Writers/HTML.hs+1−1
@@ -1150,7 +1150,7 @@ blockListToNote :: PandocMonad m => WriterOptions -> String -> [Block] -> StateT
1150blockListToNote opts ref blocks =
1150blockListToNote opts ref blocks =
1151 -- If last block is Para or Plain, include the backlink at the end of
1151 -- If last block is Para or Plain, include the backlink at the end of
1152 -- that block. Otherwise, insert a new Plain block with the backlink.
1152 -- that block. Otherwise, insert a new Plain block with the backlink.
1153− let backlink = [Link ("",["footnote-back"],[]) [Str "↩"] ("#" ++ writerIdentifierPrefix opts ++ "fnref" ++ ref,[])]
1153+ let backlink = [Link ("",["footnote-back"],[]) [Str "↩"] ("#" ++ "fnref" ++ ref,[])]
1154 blocks' = if null blocks
1154 blocks' = if null blocks
1155 then []
1155 then []
1156 else let lastBlock = last blocks
1156 else let lastBlock = last blocks
test/command/4235.mdnew file+12
@@ -0,0 +1,12 @@
1+```
2+% pandoc --id-prefix='foo'
3+This.^[Has a footnote.]
4+^D
5+<p>This.<a href="#foofn1" class="footnote-ref" id="foofnref1"><sup>1</sup></a></p>
6+<section class="footnotes">
7+<hr />
8+<ol>
9+<li id="foofn1"><p>Has a footnote.<a href="#foofnref1" class="footnote-back">↩</a></p></li>
10+</ol>
11+</section>
12+```