diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-05-21 00:39:31 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-05-21 00:45:57 -0700 |
commit | d5f367d04b9b7830ead3e3298aafe3987e55c697 (patch) | |
tree | 8ef3381fd27855a1ce4d68039831e435f68711ab /src/Text/Pandoc/Writers | |
parent | 57e16e32879e8960f34bd6215e2226ae284171af (diff) | |
download | pandoc-d5f367d04b9b7830ead3e3298aafe3987e55c697.tar.gz |
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.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/EPUB.hs | 4 |
1 files changed, 4 insertions, 0 deletions
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 |