Fixed addVariablesToJSON.

It was previously not allowing multiple values to become lists.
This commit is contained in:
John MacFarlane 2017-02-25 23:42:56 +01:00
parent 699d289cc5
commit 124551461c

View file

@ -89,9 +89,12 @@ metaToJSON' blockWriter inlineWriter (Meta metamap) = do
-- of the original JSON object itself, prior to addition of variables.
addVariablesToJSON :: WriterOptions -> Value -> Value
addVariablesToJSON opts metadata =
foldl (\acc (x,y) -> resetField x y acc)
(defField "meta-json" (toStringLazy $ encode metadata) metadata)
foldl (\acc (x,y) -> setField x y acc)
(defField "meta-json" (toStringLazy $ encode metadata) (Object mempty))
(writerVariables opts)
`combineMetadata` metadata
where combineMetadata (Object o1) (Object o2) = Object $ H.union o1 o2
combineMetadata x _ = x
metaValueToJSON :: Monad m
=> ([Block] -> m String)