From a33828f3759e60355864f0754052f91189f6746f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 22 Feb 2013 19:45:39 -0800 Subject: EPUB writer: Use writerNumberFrom instead of ugly hack. --- src/Text/Pandoc/Writers/EPUB.hs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index d58d05f08..6cc9c2f58 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -147,9 +147,8 @@ writeEPUB opts doc@(Pandoc meta _) = do let chapToEntry :: Int -> [Block] -> Entry chapToEntry num bs = mkEntry (showChapter num) - $ fixSectionNumbers num $ renderHtml - $ writeHtml opts' + $ writeHtml opts'{ writerNumberFrom = num } $ case bs of (Header _ _ xs : _) -> Pandoc (Meta xs [] []) bs _ -> Pandoc (Meta [] [] []) bs @@ -478,9 +477,3 @@ replaceRefs refTable = bottomUp replaceOneRef Just url -> Link lab (url,tit) Nothing -> x replaceOneRef x = x - --- This is ugly and inefficient. -fixSectionNumbers :: Int -> B8.ByteString -> B8.ByteString -fixSectionNumbers num = B8.pack . go . B8.unpack - where go = substitute "1" - ("" ++ show num) -- cgit v1.2.3