EPUB: Set epub3 template variable controlling doctype.
This commit is contained in:
parent
583ce1073c
commit
927a9271a5
2 changed files with 6 additions and 4 deletions
|
@ -72,13 +72,14 @@ writeEPUB :: EPUBVersion
|
|||
-> Pandoc -- ^ Document to convert
|
||||
-> IO B.ByteString
|
||||
writeEPUB version opts doc@(Pandoc meta _) = do
|
||||
let epub3 = version == EPUB3
|
||||
epochtime <- floor `fmap` getPOSIXTime
|
||||
let mkEntry path content = toEntry path epochtime content
|
||||
let opts' = opts{ writerEmailObfuscation = NoObfuscation
|
||||
, writerStandalone = True
|
||||
, writerWrapText = False }
|
||||
let sourceDir = writerSourceDirectory opts'
|
||||
let vars = writerVariables opts'
|
||||
let vars = ("epub3", if epub3 then "true" else "false"):writerVariables opts'
|
||||
let mbCoverImage = lookup "epub-cover-image" vars
|
||||
|
||||
titlePageTemplate <- readDataFile (writerUserDataDir opts)
|
||||
|
@ -106,7 +107,8 @@ writeEPUB version opts doc@(Pandoc meta _) = do
|
|||
|
||||
-- title page
|
||||
let tpContent = fromStringLazy $ writeHtmlString
|
||||
opts'{writerTemplate = titlePageTemplate}
|
||||
opts'{writerTemplate = titlePageTemplate,
|
||||
writerVariables = vars}
|
||||
(Pandoc meta [])
|
||||
let tpEntry = mkEntry "title_page.xhtml" tpContent
|
||||
|
||||
|
@ -140,7 +142,7 @@ writeEPUB version opts doc@(Pandoc meta _) = do
|
|||
let chapToEntry :: Int -> [Tag String] -> Entry
|
||||
chapToEntry num ts = mkEntry (showChapter num)
|
||||
$ fromStringLazy
|
||||
$ renderTemplate [("body",renderTags ts), ("pagetitle",show num)]
|
||||
$ renderTemplate (("body",renderTags ts):("pagetitle",show num):vars)
|
||||
$ pageTemplate
|
||||
|
||||
let chapterEntries = zipWith chapToEntry [1..] chunks
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 2e0841bf8e4aeb7710fe1d8519f69c224354a1f4
|
||||
Subproject commit 8aad14418920ab350ddd84762dc5313673c6975f
|
Loading…
Add table
Reference in a new issue