aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-02-22 19:45:39 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-02-22 19:45:39 -0800
commita33828f3759e60355864f0754052f91189f6746f (patch)
tree4c841b60819e00e80217241fe7a3e534d580c10c /src/Text
parent4c106993b5a56d5dd3157a7b1c4836150c8fee1e (diff)
downloadpandoc-a33828f3759e60355864f0754052f91189f6746f.tar.gz
EPUB writer: Use writerNumberFrom instead of ugly hack.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs9
1 files changed, 1 insertions, 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 "<span class=\"header-section-number\">1"
- ("<span class=\"header-section-number\">" ++ show num)