aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 1796b6481..e904b5fb7 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -189,17 +189,19 @@ writeHtmlString' :: PandocMonad m
=> WriterState -> WriterOptions -> Pandoc -> m String
writeHtmlString' st opts d = do
(body, context) <- evalStateT (pandocToHtml opts d) st
- -- check for empty pagetitle
- context' <-
- case getField "pagetitle" context of
- Just (s :: String) | not (null s) -> return context
- _ -> do
- report $ NoTitleElement "Untitled"
- return $ resetField "pagetitle" ("Untitled" :: String) context
- return $ case writerTemplate opts of
- Nothing -> renderHtml body
- Just tpl -> renderTemplate' tpl $
- defField "body" (renderHtml body) context'
+ case writerTemplate opts of
+ Nothing -> return $ renderHtml body
+ Just tpl -> do
+ -- check for empty pagetitle
+ context' <-
+ case getField "pagetitle" context of
+ Just (s :: String) | not (null s) -> return context
+ _ -> do
+ report $ NoTitleElement "Untitled"
+ return $ resetField "pagetitle" ("Untitled" :: String)
+ context
+ return $ renderTemplate' tpl $
+ defField "body" (renderHtml body) context'
writeHtml' :: PandocMonad m => WriterState -> WriterOptions -> Pandoc -> m Html
writeHtml' st opts d = do