git.iko.soy/typeable/pandoc
on master help sign in
EPUB writer: don't include 'landmarks' if there aren't any.
167e52aJohn MacFarlane
src/Text/Pandoc/Writers/EPUB.hs+10−9
@@ -793,13 +793,8 @@ pandocToEPUB version opts doc = do
793 [("id","toc")]) $
793 [("id","toc")]) $
794 [ unode "h1" ! [("id","toc-title")] $ tocTitle
794 [ unode "h1" ! [("id","toc-title")] $ tocTitle
795 , unode "ol" ! [("class","toc")] $ tocBlocks ]]
795 , unode "ol" ! [("class","toc")] $ tocBlocks ]]
796− let landmarks = if epub3
796+ let landmarkItems = if epub3
797− then [RawBlock (Format "html") $ ppElement $
798− unode "nav" ! [("epub:type","landmarks")
799− ,("id","landmarks")
800− ,("hidden","hidden")] $
801− [ unode "ol" $
802− [ unode "li"
797+ then [ unode "li"
803 [ unode "a" ! [("href", "text/cover.xhtml")
798 [ unode "a" ! [("href", "text/cover.xhtml")
804 ,("epub:type", "cover")] $
799 ,("epub:type", "cover")] $
805 "Cover"] |
800 "Cover"] |
@@ -811,9 +806,15 @@ pandocToEPUB version opts doc = do
811 "Table of contents"
806 "Table of contents"
812 ] | writerTableOfContents opts
807 ] | writerTableOfContents opts
813 ]
808 ]
814− ]
809+ else []
810+ let landmarks = if null landmarkItems
811+ then []
812+ else [RawBlock (Format "html") $ ppElement $
813+ unode "nav" ! [("epub:type","landmarks")
814+ ,("id","landmarks")
815+ ,("hidden","hidden")] $
816+ [ unode "ol" landmarkItems ]
815 ]
817 ]
816− else []
817 navData <- lift $ writeHtml opts'{ writerVariables = ("navpage","true"):
818 navData <- lift $ writeHtml opts'{ writerVariables = ("navpage","true"):
818 cssvars False ++ vars }
819 cssvars False ++ vars }
819 (Pandoc (setMeta "title"
820 (Pandoc (setMeta "title"