git.iko.soy/typeable/pandoc
on master help sign in
HTML writer: only issue warning for missing title if --standalone.
commit739bf78c376320d19a525b7b0ec5f8e13d32bb4c authorJohn MacFarlane <jgm@berkeley.edu> dateSat 4 Mar 2017, 14:50 (10 years ago) parentaa5ae5f
1 file changed+13−11
src/Text/Pandoc/Writers/HTML.hs+13−11
src/Text/Pandoc/Writers/HTML.hs+13−11
@@ -189,17 +189,19 @@ writeHtmlString' :: PandocMonad m
189189 => WriterState -> WriterOptions -> Pandoc -> m String
190190writeHtmlString' st opts d = do
191191 (body, context) <- evalStateT (pandocToHtml opts d) st
192− -- check for empty pagetitle
193− context' <-
194− case getField "pagetitle" context of
195− Just (s :: String) | not (null s) -> return context
196− _ -> do
197− report $ NoTitleElement "Untitled"
198− return $ resetField "pagetitle" ("Untitled" :: String) context
199− return $ case writerTemplate opts of
200− Nothing -> renderHtml body
201− Just tpl -> renderTemplate' tpl $
202− defField "body" (renderHtml body) context'
192+ case writerTemplate opts of
193+ Nothing -> return $ renderHtml body
194+ Just tpl -> do
195+ -- check for empty pagetitle
196+ context' <-
197+ case getField "pagetitle" context of
198+ Just (s :: String) | not (null s) -> return context
199+ _ -> do
200+ report $ NoTitleElement "Untitled"
201+ return $ resetField "pagetitle" ("Untitled" :: String)
202+ context
203+ return $ renderTemplate' tpl $
204+ defField "body" (renderHtml body) context'
203205
204206writeHtml' :: PandocMonad m => WriterState -> WriterOptions -> Pandoc -> m Html
205207writeHtml' st opts d = do