aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-02-22 20:38:56 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-02-22 20:38:56 -0800
commita7245b453c433ce4ed585b0097016576090f01cb (patch)
tree65a3709fc1519a228bb7be84166d63c18135f29f /src
parent4d54c6368b07949e3a5be7bd15e5ca8a610034d7 (diff)
downloadpandoc-a7245b453c433ce4ed585b0097016576090f01cb.tar.gz
EPUB writer: Minor section numbering tweaks.
* If we need to add an initial section, make it unnumbered. * Don't add extra space before unnumbered section titles in TOC.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index 6cc9c2f58..d25efa672 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -126,7 +126,8 @@ writeEPUB opts doc@(Pandoc meta _) = do
let blocks' = addIdentifiers
$ case blocks of
(Header 1 _ _ : _) -> blocks
- _ -> Header 1 ("",[],[]) (docTitle meta) : blocks
+ _ -> Header 1 ("",["unnumbered"],[])
+ (docTitle meta) : blocks
let chapterHeaderLevel = writerEpubChapterLevel opts
-- internal reference IDs change when we chunk the file,
@@ -236,7 +237,7 @@ writeEPUB opts doc@(Pandoc meta _) = do
let showNums :: [Int] -> String
showNums = intercalate "." . map show
let tit' = plainify ils
- let tit = if writerNumberSections opts
+ let tit = if writerNumberSections opts && not (null nums)
then showNums nums ++ " " ++ tit'
else tit'
let src = case lookup ident reftable of