@@ -147,9 +147,8 @@ writeEPUB opts doc@(Pandoc meta _) = do
147147
148148 let chapToEntry :: Int -> [Block] -> Entry
149149 chapToEntry num bs = mkEntry (showChapter num)
150− $ fixSectionNumbers num
151150 $ renderHtml
152− $ writeHtml opts'
151+ $ writeHtml opts'{ writerNumberFrom = num }
153152 $ case bs of
154153 (Header _ _ xs : _) -> Pandoc (Meta xs [] []) bs
155154 _ -> Pandoc (Meta [] [] []) bs
@@ -478,9 +477,3 @@ replaceRefs refTable = bottomUp replaceOneRef
478477 Just url -> Link lab (url,tit)
479478 Nothing -> x
480479 replaceOneRef x = x
481−
482−-- This is ugly and inefficient.
483−fixSectionNumbers :: Int -> B8.ByteString -> B8.ByteString
484−fixSectionNumbers num = B8.pack . go . B8.unpack
485− where go = substitute "<span class=\"header-section-number\">1"
486− ("<span class=\"header-section-number\">" ++ show num)