diff options
| author | John MacFarlane <[email protected]> | 2026-01-06 19:08:30 +0100 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2026-01-07 11:21:50 +0100 |
| commit | b206e941caeba9f840557694f351b5cafe4af657 (patch) | |
| tree | 5c7214c245a26bfc562c39d95cd39a8546ba59e0 | |
| parent | b026624ed7399e62137233dadbacfb4d59c28f3b (diff) | |
EPUB writer: don't use footnote backlinks for EPUBv3.
Here we use aside elements, which are popups, and the backlinks
are not needed; in some readers they cause a redundant number to
appear, since the reader adds a note number.
Standard practice seems to be not to use these.
| -rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 2b4cfc5aa..3c45c2e61 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -1689,14 +1689,16 @@ blockListToNote opts ref blocks = do let kvs = [("role","doc-backlink") | html5] let backlink = Link ("",["footnote-back"],kvs) [Str ref] ("#" <> "fnref" <> ref,"") - let blocks' = - case blocks of - (Para ils : rest) -> - Para (backlink : Str "." : Space : ils) : rest - (Plain ils : rest) -> - Plain (backlink : Str "." : Space : ils) : rest - _ -> Para [backlink , Str "."] : blocks - contents <- blockListToHtml opts blocks' + let addBacklinkInlines bs + | epubv == EPUB3 = bs + | otherwise = + case bs of + (Para ils : rest) -> + Para (backlink : Str "." : Space : ils) : rest + (Plain ils : rest) -> + Plain (backlink : Str "." : Space : ils) : rest + _ -> Para [backlink , Str "."] : blocks + contents <- blockListToHtml opts (addBacklinkInlines blocks) let noteItem = (if epubv == EPUB3 then H5.aside ! customAttribute "epub:type" "footnote" ! customAttribute "role" "doc-footnote" else H.div) ! prefixedId opts ("fn" <> ref) |
