diff options
| author | John MacFarlane <[email protected]> | 2022-11-05 19:32:53 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2022-11-06 09:54:25 -0800 |
| commit | 2682c79e957162db0bca1d90d29d2710b14e8e90 (patch) | |
| tree | ac9f1776998614adb848ac19cddd707264dfa0f3 | |
| parent | f9ce4ff4d0c91b735ccf7e5d61bfee268c63dd2b (diff) | |
EPUB writer: refactor createChaptersAndRefTable.
| -rw-r--r-- | src/Text/Pandoc/Writers/EPUB.hs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index 8f03ea211..f058e0a0a 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -536,7 +536,8 @@ pandocToEPUB version opts doc = do (docTitle' meta) : blocks -- create the chapters and their reftable from the original options and the sections - let (chapters, reftable) = createChaptersAndReftable opts secs + let (chapters, reftable) = + createChaptersAndReftable (writerEpubChapterLevel opts) secs -- Create the chapter entries from the chapters. -- Also requires access to the extended writer options and context @@ -831,11 +832,9 @@ createChapterEntries opts' vars cssvars writeHtml chapters = do zipWithM chapToEntry [1..] chapters -- | Splits the blocks into chapters and creates a corresponding reftable -createChaptersAndReftable :: WriterOptions -> [Block] -> ([Chapter], [(Text, Text)]) -createChaptersAndReftable opts secs = (chapters, reftable) +createChaptersAndReftable :: Int -> [Block] -> ([Chapter], [(Text, Text)]) +createChaptersAndReftable chapterHeaderLevel secs = (chapters, reftable) where - chapterHeaderLevel = writerEpubChapterLevel opts - isChapterHeader :: Block -> Bool isChapterHeader (Div _ (Header n _ _:_)) = n <= chapterHeaderLevel isChapterHeader _ = False |
