git.iko.soy/typeable/pandoc
on master help sign in
EPUB writer: Take TOC title from toc-title metadata field.
commitb29a8a5516ea36f143e3cb8db44e22630e3adb6b authorJohn MacFarlane <jgm@berkeley.edu> dateThu 2 Apr 2015, 21:28 (12 years ago) parentf45daf9
1 file changed+5−2
src/Text/Pandoc/Writers/EPUB.hs+5−2
src/Text/Pandoc/Writers/EPUB.hs+5−2
@@ -495,6 +495,9 @@ writeEPUB opts doc@(Pandoc meta _) = do
495495 [] -> "UNTITLED"
496496 (x:_) -> titleText x
497497 x -> stringify x
498+
499+ let tocTitle = fromMaybe plainTitle $
500+ metaValueToString <$> lookupMeta "toc-title" meta
498501 let uuid = case epubIdentifier metadata of
499502 (x:_) -> identifierText x -- use first identifier as UUID
500503 [] -> error "epubIdentifier is null" -- shouldn't happen
@@ -539,7 +542,7 @@ writeEPUB opts doc@(Pandoc meta _) = do
539542 map chapterRefNode chapterEntries)
540543 , unode "guide" $
541544 [ unode "reference" !
542− [("type","toc"),("title",plainTitle),
545+ [("type","toc"),("title", tocTitle),
543546 ("href","nav.xhtml")] $ ()
544547 ] ++
545548 [ unode "reference" !
@@ -620,7 +623,7 @@ writeEPUB opts doc@(Pandoc meta _) = do
620623 let navBlocks = [RawBlock (Format "html") $ ppElement $
621624 unode navtag ! ([("epub:type","toc") | epub3] ++
622625 [("id","toc")]) $
623− [ unode "h1" ! [("id","toc-title")] $ plainTitle
626+ [ unode "h1" ! [("id","toc-title")] $ tocTitle
624627 , unode "ol" ! [("class","toc")] $ evalState (mapM (navPointNode navXhtmlFormatter) secs) 1]]
625628 let landmarks = if epub3
626629 then [RawBlock (Format "html") $ ppElement $