summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Shared.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/Shared.hs
parentac312caabd8c4e595e0b930154fd3033ba397ace (diff)
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/Shared.hs')
-rw-r--r--src/Text/Pandoc/Writers/Shared.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs
index 0f0edbbd1..845d22077 100644
--- a/src/Text/Pandoc/Writers/Shared.hs
+++ b/src/Text/Pandoc/Writers/Shared.hs
@@ -49,6 +49,7 @@ import Data.Aeson (FromJSON(..), fromJSON, ToJSON (..), Value(Object), Result(..
import Text.Pandoc.UTF8 (toStringLazy)
import qualified Data.Traversable as Traversable
import Data.List ( groupBy )
+import Data.Maybe ( isJust )
-- | Create JSON value for template from a 'Meta' and an association list
-- of variables, specified at the command line or in the writer.
@@ -62,7 +63,7 @@ metaToJSON :: Monad m
-> Meta
-> m Value
metaToJSON opts blockWriter inlineWriter (Meta metamap)
- | writerStandalone opts = do
+ | isJust (writerTemplate opts) = do
let baseContext = foldl (\acc (x,y) -> setField x y acc) (Object H.empty)
$ writerVariables opts
renderedMap <- Traversable.mapM