aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Custom.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-11-30 15:34:58 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2016-11-30 15:34:58 +0100
commitfb8a2540bdb91eee0ecf620b4e9d7acf3d78042f (patch)
tree448a3c909200e8bbd45ecaa65f2f85d88bcc66c6 /src/Text/Pandoc/Writers/Custom.hs
parentac312caabd8c4e595e0b930154fd3033ba397ace (diff)
downloadpandoc-fb8a2540bdb91eee0ecf620b4e9d7acf3d78042f.tar.gz
Options: Removed writerStandalone, made writerTemplate a Maybe.
Previously setting writerStandalone = True did nothing unless a template was provided in writerTemplate. Now a fragment will be generated if writerTemplate is Nothing; otherwise, the specified template will be used and standalone output generated. [API change]
Diffstat (limited to 'src/Text/Pandoc/Writers/Custom.hs')
-rw-r--r--src/Text/Pandoc/Writers/Custom.hs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/Custom.hs b/src/Text/Pandoc/Writers/Custom.hs
index 631241724..cf641dcd6 100644
--- a/src/Text/Pandoc/Writers/Custom.hs
+++ b/src/Text/Pandoc/Writers/Custom.hs
@@ -202,11 +202,9 @@ writeCustom luaFile opts doc@(Pandoc meta _) = do
Lua.close lua
setForeignEncoding enc
let body = rendered
- if writerStandalone opts
- then do
- let context' = setField "body" body context
- return $ renderTemplate' (writerTemplate opts) context'
- else return body
+ case writerTemplate opts of
+ Nothing -> return body
+ Just tpl -> return $ renderTemplate' tpl $ setField "body" body context
docToCustom :: LuaState -> WriterOptions -> Pandoc -> IO String
docToCustom lua opts (Pandoc (Meta metamap) blocks) = do