From d5f367d04b9b7830ead3e3298aafe3987e55c697 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 21 May 2015 00:39:31 -0700 Subject: EPUB writer: Split references into separate chapter. Previously the div-enclosed reference section produced by pandoc-citeproc would not be split into its own chapter, which caused various problems. See #2162, #2163. I'm not sure this is a complete fix. I note that the bibliography doesn't appear in nav or toc, which seems bad. --- src/Text/Pandoc/Writers/EPUB.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index a1a0878e9..4ce7857ac 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -415,10 +415,14 @@ writeEPUB opts doc@(Pandoc meta _) = do let blocks'' = replaceRefs reftable blocks' let isChapterHeader (Header n _ _) = n <= chapterHeaderLevel + isChapterHeader (Div ("",["references"],[]) (Header n _ _:_)) = + n <= chapterHeaderLevel isChapterHeader _ = False let toChapters :: [Block] -> State [Int] [Chapter] toChapters [] = return [] + toChapters (Div ("",["references"],[]) bs@(Header 1 _ _:_) : rest) = + toChapters (bs ++ rest) toChapters (Header n attr@(_,classes,_) ils : bs) = do nums <- get mbnum <- if "unnumbered" `elem` classes -- cgit v1.2.3