aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-11-04 20:53:27 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-11-04 20:53:41 -0800
commita7b8351d436434165c6cc70ba855322c76c102cf (patch)
tree3da55f5f470a95a09348d0c9c26080a82969f1fa /src/Text/Pandoc/Writers
parent7f5e2af1fb9f7eff11c50996bc6b6245ec9550ff (diff)
downloadpandoc-a7b8351d436434165c6cc70ba855322c76c102cf.tar.gz
EPUB writer: Removed need for separate epub-coverpage template.
The standard epub-page template is now used.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index 4effc7b2b..dabb9722b 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -74,12 +74,15 @@ writeEPUB :: EPUBVersion
writeEPUB version opts doc@(Pandoc meta _) = do
let epub3 = version == EPUB3
epochtime <- floor `fmap` getPOSIXTime
+ pageTemplate <- readDataFile (writerUserDataDir opts)
+ $ "templates" </> "epub-page" <.> "html"
let mkEntry path content = toEntry path epochtime content
let vars = ("epub3", if epub3 then "true" else "false")
: ("css", "stylesheet.css")
: writerVariables opts
let opts' = opts{ writerEmailObfuscation = NoObfuscation
, writerStandalone = True
+ , writerTemplate = pageTemplate
, writerSectionDivs = True
, writerHtml5 = epub3
, writerTableOfContents = False -- we always have one in epub
@@ -95,23 +98,14 @@ writeEPUB version opts doc@(Pandoc meta _) = do
titlePageTemplate <- readDataFile (writerUserDataDir opts')
$ "templates" </> "epub-titlepage" <.> "html"
- coverImageTemplate <- readDataFile (writerUserDataDir opts')
- $ "templates" </> "epub-coverimage" <.> "html"
-
- pageTemplate <- readDataFile (writerUserDataDir opts')
- $ "templates" </> "epub-page" <.> "html"
-
-- cover page
(cpgEntry, cpicEntry) <-
case mbCoverImage of
Nothing -> return ([],[])
Just img -> do
let coverImage = "cover-image" ++ takeExtension img
- let cpContent = fromStringLazy $ writeHtmlString
- opts'{writerTemplate = coverImageTemplate,
- writerHtml5 = epub3,
- writerVariables = ("coverimage",coverImage):vars}
- (Pandoc meta [])
+ let cpContent = renderHtml $ writeHtml opts'
+ (Pandoc meta [RawBlock "html" $ "<div id=\"cover-image\">\n<img src=\"" ++ coverImage ++ " alt=\"cover image\" />\n</div"])
imgContent <- B.readFile img
return ( [mkEntry "cover.xhtml" cpContent]
, [mkEntry coverImage imgContent] )