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".
This commit is contained in:
parent
447a1bbbe8
commit
ba6a26b258
1 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue