From fb8a2540bdb91eee0ecf620b4e9d7acf3d78042f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 30 Nov 2016 15:34:58 +0100 Subject: 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] --- src/Text/Pandoc/Writers/Shared.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc/Writers/Shared.hs') 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 -- cgit v1.2.3