Skip to content

Commit

Permalink
Use regular page template for nav.xhtml.
Browse files Browse the repository at this point in the history
This includes the HTML doctype.

Closes #1759.
  • Loading branch information
jgm committed Nov 17, 2014
1 parent 65db0ed commit 91a26fc
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/Text/Pandoc/Writers/EPUB.hs
Original file line number Diff line number Diff line change
Expand Up @@ -611,17 +611,14 @@ writeEPUB opts doc@(Pandoc meta _) = do
(_:_) -> [unode "ol" ! [("class","toc")] $ subs]

let navtag = if epub3 then "nav" else "div"
let navData = UTF8.fromStringLazy $ ppTopElement $
unode "html" ! [("xmlns","http://www.w3.org/1999/xhtml")
,("xmlns:epub","http://www.idpf.org/2007/ops")] $
[ unode "head" $
[ unode "title" plainTitle
, unode "link" ! [("rel","stylesheet"),("type","text/css"),("href","stylesheet.css")] $ () ]
, unode "body" $
unode navtag ! [("epub:type","toc") | epub3] $
[ unode "h1" ! [("id","toc-title")] $ plainTitle
, unode "ol" ! [("class","toc")] $ evalState (mapM (navPointNode navXhtmlFormatter) secs) 1]
]
let navBlocks = [RawBlock (Format "html") $ ppElement $
unode navtag ! [("epub:type","toc") | epub3] $
[ unode "h1" ! [("id","toc-title")] $ plainTitle
, unode "ol" ! [("class","toc")] $ evalState (mapM (navPointNode navXhtmlFormatter) secs) 1]]
let navData = renderHtml $ writeHtml opts'
(Pandoc (setMeta "title"
(walk removeNote $ fromList $ docTitle' meta) nullMeta)
navBlocks)
let navEntry = mkEntry "nav.xhtml" navData

-- mimetype
Expand Down

0 comments on commit 91a26fc

Please sign in to comment.