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