diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2015-04-02 21:28:55 -0700 | 
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2015-04-02 21:28:55 -0700 | 
| commit | b29a8a5516ea36f143e3cb8db44e22630e3adb6b (patch) | |
| tree | cd21ac51ef93f22281a06bc717806168ea4fee9c /src/Text/Pandoc | |
| parent | f45daf932ca9405227fb6c364677128e29e71ee7 (diff) | |
| download | pandoc-b29a8a5516ea36f143e3cb8db44e22630e3adb6b.tar.gz | |
EPUB writer: Take TOC title from toc-title metadata field.
Diffstat (limited to 'src/Text/Pandoc')
| -rw-r--r-- | src/Text/Pandoc/Writers/EPUB.hs | 7 | 
1 files changed, 5 insertions, 2 deletions
| diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index 63c3b5501..29ea44e02 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -495,6 +495,9 @@ writeEPUB opts doc@(Pandoc meta _) = do                                     []   -> "UNTITLED"                                     (x:_) -> titleText x                          x  -> stringify x + +  let tocTitle = fromMaybe plainTitle $ +                   metaValueToString <$> lookupMeta "toc-title" meta    let uuid = case epubIdentifier metadata of                    (x:_) -> identifierText x  -- use first identifier as UUID                    []    -> error "epubIdentifier is null"  -- shouldn't happen @@ -539,7 +542,7 @@ writeEPUB opts doc@(Pandoc meta _) = do                    map chapterRefNode chapterEntries)            , unode "guide" $               [ unode "reference" ! -                   [("type","toc"),("title",plainTitle), +                   [("type","toc"),("title", tocTitle),                      ("href","nav.xhtml")] $ ()               ] ++               [ unode "reference" ! @@ -620,7 +623,7 @@ writeEPUB opts doc@(Pandoc meta _) = do    let navBlocks = [RawBlock (Format "html") $ ppElement $                     unode navtag ! ([("epub:type","toc") | epub3] ++                                     [("id","toc")]) $ -                    [ unode "h1" ! [("id","toc-title")] $ plainTitle +                    [ unode "h1" ! [("id","toc-title")] $ tocTitle                      , unode "ol" ! [("class","toc")] $ evalState (mapM (navPointNode navXhtmlFormatter) secs) 1]]    let landmarks = if epub3                       then [RawBlock (Format "html") $ ppElement $ | 
