diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Options.hs | 4 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/EPUB.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 4 |
3 files changed, 4 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs index ab5cf4c43..39fa2a1b2 100644 --- a/src/Text/Pandoc/Options.hs +++ b/src/Text/Pandoc/Options.hs @@ -270,7 +270,7 @@ data WriterOptions = WriterOptions , writerHTMLMathMethod :: HTMLMathMethod -- ^ How to print math in HTML , writerIgnoreNotes :: Bool -- ^ Ignore footnotes (used in making toc) , writerNumberSections :: Bool -- ^ Number sections in LaTeX - , writerNumberFrom :: Int -- ^ Starting section number + , writerNumberOffset :: [Int] -- ^ Starting number for section, subsection, ... , writerSectionDivs :: Bool -- ^ Put sections in div tags in HTML , writerExtensions :: Set Extension -- ^ Markdown extensions that can be used , writerReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst @@ -314,7 +314,7 @@ instance Default WriterOptions where , writerHTMLMathMethod = PlainMath , writerIgnoreNotes = False , writerNumberSections = False - , writerNumberFrom = 1 + , writerNumberOffset = [0,0,0,0,0,0] , writerSectionDivs = False , writerExtensions = pandocExtensions , writerReferenceLinks = False diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index d25efa672..048f90da1 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -149,7 +149,7 @@ writeEPUB opts doc@(Pandoc meta _) = do let chapToEntry :: Int -> [Block] -> Entry chapToEntry num bs = mkEntry (showChapter num) $ renderHtml - $ writeHtml opts'{ writerNumberFrom = num } + $ writeHtml opts'{ writerNumberOffset = [num - 1] } $ case bs of (Header _ _ xs : _) -> Pandoc (Meta xs [] []) bs _ -> Pandoc (Meta [] [] []) bs diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index d8da74d3a..477087166 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -274,9 +274,7 @@ elementToHtml :: Int -> WriterOptions -> Element -> State WriterState Html elementToHtml _slideLevel opts (Blk block) = blockToHtml opts block elementToHtml slideLevel opts (Sec level num (id',classes,keyvals) title' elements) = do let slide = writerSlideVariant opts /= NoSlides && level <= slideLevel - let num' = case num of - (n:ns) -> n + writerNumberFrom opts - 1 : ns - [] -> [] + let num' = zipWith (+) num (writerNumberOffset opts) modify $ \st -> st{stSecNum = num'} -- update section number -- always use level 1 for slide titles let level' = if slide then 1 else level |