@@ -343,7 +343,6 @@ writeEPUB opts doc@(Pandoc meta _) = do
343 , writerStandalone = True
343 , writerStandalone = True
344 , writerSectionDivs = True
344 , writerSectionDivs = True
345 , writerHtml5 = epub3
345 , writerHtml5 = epub3
346− , writerTableOfContents = False -- we always have one in epub
347 , writerVariables = vars
346 , writerVariables = vars
348 , writerHTMLMathMethod =
347 , writerHTMLMathMethod =
@@ -612,13 +611,34 @@ writeEPUB opts doc@(Pandoc meta _) = do
613 let navtag = if epub3 then "nav" else "div"
612 let navtag = if epub3 then "nav" else "div"
614 let navBlocks = [RawBlock (Format "html") $ ppElement $
613 let navBlocks = [RawBlock (Format "html") $ ppElement $
615− unode navtag ! [("epub:type","toc") | epub3] $
614+ unode navtag ! ([("epub:type","toc") | epub3] ++
616 [ unode "h1" ! [("id","toc-title")] $ plainTitle
616 [ unode "h1" ! [("id","toc-title")] $ plainTitle
617 , unode "ol" ! [("class","toc")] $ evalState (mapM (navPointNode navXhtmlFormatter) secs) 1]]
617 , unode "ol" ! [("class","toc")] $ evalState (mapM (navPointNode navXhtmlFormatter) secs) 1]]
618+ let landmarks = if epub3
619+ then [RawBlock (Format "html") $ ppElement $
620+ unode "nav" ! [("epub:type","landmarks")
621+ ,("hidden","hidden")] $
624+ [ unode "a" ! [("href", "cover.xhtml")
625+ ,("epub:type", "cover")] $
627+ epubCoverImage metadata /= Nothing
630+ [ unode "a" ! [("href", "#toc")
631+ ,("epub:type", "toc")] $
633+ ] | writerTableOfContents opts
618 let navData = renderHtml $ writeHtml opts'
638 let navData = renderHtml $ writeHtml opts'
619 (Pandoc (setMeta "title"
639 (Pandoc (setMeta "title"
620 (walk removeNote $ fromList $ docTitle' meta) nullMeta)
640 (walk removeNote $ fromList $ docTitle' meta) nullMeta)
621− navBlocks)
641+ (navBlocks ++ landmarks))
622 let navEntry = mkEntry "nav.xhtml" navData
642 let navEntry = mkEntry "nav.xhtml" navData
624 -- mimetype
644 -- mimetype