mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-24 09:16:43 +00:00
Writers.Shared: metaToJSON, generalized type so it can take a Text.
Previously a String was needed as argument; now any ToJSON instance will do. API change.
This commit is contained in:
@@ -62,10 +62,10 @@ import Text.Pandoc.XML (escapeStringForXML)
|
||||
-- Variables overwrite metadata fields with the same names.
|
||||
-- If multiple variables are set with the same name, a list is
|
||||
-- assigned. Does nothing if 'writerTemplate' is Nothing.
|
||||
metaToJSON :: (Functor m, Monad m)
|
||||
metaToJSON :: (Functor m, Monad m, ToJSON a)
|
||||
=> WriterOptions
|
||||
-> ([Block] -> m String)
|
||||
-> ([Inline] -> m String)
|
||||
-> ([Block] -> m a)
|
||||
-> ([Inline] -> m a)
|
||||
-> Meta
|
||||
-> m Value
|
||||
metaToJSON opts blockWriter inlineWriter meta
|
||||
@@ -75,9 +75,9 @@ metaToJSON opts blockWriter inlineWriter meta
|
||||
|
||||
-- | Like 'metaToJSON', but does not include variables and is
|
||||
-- not sensitive to 'writerTemplate'.
|
||||
metaToJSON' :: Monad m
|
||||
=> ([Block] -> m String)
|
||||
-> ([Inline] -> m String)
|
||||
metaToJSON' :: (Monad m, ToJSON a)
|
||||
=> ([Block] -> m a)
|
||||
-> ([Inline] -> m a)
|
||||
-> Meta
|
||||
-> m Value
|
||||
metaToJSON' blockWriter inlineWriter (Meta metamap) = do
|
||||
@@ -98,9 +98,9 @@ addVariablesToJSON opts metadata =
|
||||
where combineMetadata (Object o1) (Object o2) = Object $ H.union o1 o2
|
||||
combineMetadata x _ = x
|
||||
|
||||
metaValueToJSON :: Monad m
|
||||
=> ([Block] -> m String)
|
||||
-> ([Inline] -> m String)
|
||||
metaValueToJSON :: (Monad m, ToJSON a)
|
||||
=> ([Block] -> m a)
|
||||
-> ([Inline] -> m a)
|
||||
-> MetaValue
|
||||
-> m Value
|
||||
metaValueToJSON blockWriter inlineWriter (MetaMap metamap) = liftM toJSON $
|
||||
|
||||
Reference in New Issue
Block a user