aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-01-06 12:12:21 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-01-06 12:12:21 -0800
commitba6a26b25871a3912556f1a17330d2363b3f3db5 (patch)
tree82517a8711f9bd9abc0afa047698e9608b43e761 /src/Text
parent447a1bbbe8cd90f42a6ab089914ec685ca49923d (diff)
downloadpandoc-ba6a26b25871a3912556f1a17330d2363b3f3db5.tar.gz
EPUB writer: Avoid duplicate notes when headings contain notes.
This arose because the headings are copied into the metadata "title" field, and the note gets rendered twice. We strip the note now before putting the heading in "title".
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index 4daa9609e..d2dd7da2e 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -397,6 +397,10 @@ writeEPUB opts doc@(Pandoc meta _) = do
let chapters = evalState (toChapters blocks'') []
+ let removeNote :: Inline -> Inline
+ removeNote (Note _) = Str ""
+ removeNote x = x
+
let chapToEntry :: Int -> Chapter -> Entry
chapToEntry num (Chapter mbnum bs) = mkEntry (showChapter num)
$ renderHtml
@@ -404,7 +408,9 @@ writeEPUB opts doc@(Pandoc meta _) = do
fromMaybe [] mbnum }
$ case bs of
(Header _ _ xs : _) ->
- Pandoc (setMeta "title" (fromList xs) nullMeta) bs
+ -- remove notes or we get doubled footnotes
+ Pandoc (setMeta "title" (walk removeNote $ fromList xs)
+ nullMeta) bs
_ ->
Pandoc nullMeta bs