git.iko.soy/typeable/pandoc
on master help sign in
HTML writer: fix implicit_figure at end of footnotes.

Closes #7006.

commit15ba184e6e7825898ebae5a59e2c3a60e0992da0 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 5 Jan 2021, 12:07 (6 years ago) parent385b6a3
2 files changed+27−3
src/Text/Pandoc/Writers/HTML.hs+7−3 test/command/7006.md+20
src/Text/Pandoc/Writers/HTML.hs+7−3
@@ -1455,11 +1455,15 @@ blockListToNote opts ref blocks = do
14551455 else let lastBlock = last blocks
14561456 otherBlocks = init blocks
14571457 in case lastBlock of
1458− (Para lst) -> otherBlocks ++
1458+ Para [Image _ _ (_,tit)]
1459+ | "fig:" `T.isPrefixOf` tit
1460+ -> otherBlocks ++ [lastBlock,
1461+ Plain backlink]
1462+ Para lst -> otherBlocks ++
14591463 [Para (lst ++ backlink)]
1460− (Plain lst) -> otherBlocks ++
1464+ Plain lst -> otherBlocks ++
14611465 [Plain (lst ++ backlink)]
1462− _ -> otherBlocks ++ [lastBlock,
1466+ _ -> otherBlocks ++ [lastBlock,
14631467 Plain backlink]
14641468 contents <- blockListToHtml opts blocks'
14651469 let noteItem = H.li ! prefixedId opts ("fn" <> ref) $ contents
test/command/7006.mdnew file+20
@@ -0,0 +1,20 @@
1+```
2+% pandoc -t html
3+Test.[^fn]
4+
5+[^fn]: Foo:
6+
7+ ![Caption.](/image.jpg)
8+^D
9+<p>Test.<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a></p>
10+<section class="footnotes" role="doc-endnotes">
11+<hr />
12+<ol>
13+<li id="fn1" role="doc-endnote"><p>Foo:</p>
14+<figure>
15+<img src="/image.jpg" alt="Caption." /><figcaption aria-hidden="true">Caption.</figcaption>
16+</figure>
17+<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></li>
18+</ol>
19+</section>
20+```