diff options
author | John MacFarlane <jgm@berkeley.edu> | 2013-06-25 18:15:22 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2013-06-25 18:15:22 -0700 |
commit | 16d6005ed90ea1902b6caacf54676876037fda3b (patch) | |
tree | 413fe94d81a26c4dd8953a7ae94f1768e9b33c15 /src | |
parent | f34232c934b82da418ef35ac01a6978df284a117 (diff) | |
download | pandoc-16d6005ed90ea1902b6caacf54676876037fda3b.tar.gz |
Fixed merge bugs in Shared.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index f9a4f38e3..31730a9e7 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -97,7 +97,7 @@ import Text.Pandoc.MIME (getMimeType) import System.FilePath ( (</>), takeExtension, dropExtension ) import Data.Generics (Typeable, Data) import qualified Control.Monad.State as S -import Control.Monad (msum, unless) +import Control.Monad (msum, unless, liftM) import Text.Pandoc.Pretty (charWidth) import System.Locale (defaultTimeLocale) import Data.Time @@ -527,24 +527,24 @@ makeMeta title authors date = -- Variables overwrite metadata fields with the same names. metaToJSON :: Monad m => ([Block] -> m String) -- ^ Writer for output format - => ([Inline] -> m String) -- ^ Writer for output format + -> ([Inline] -> m String) -- ^ Writer for output format -> Meta -- ^ Metadata -> m Value -metaToJSON blockWriter inlineWriter (Meta metamap) = toJSON - `fmap` Traversable.mapM (metaValueToJSON blockWriter inlineWriter) metamap +metaToJSON blockWriter inlineWriter (Meta metamap) = liftM toJSON $ + Traversable.mapM (metaValueToJSON blockWriter inlineWriter) metamap metaValueToJSON :: Monad m => ([Block] -> m String) -> ([Inline] -> m String) -> MetaValue -> m Value -metaValueToJSON blockWriter inlineWriter (MetaMap metamap) = toJSON - `fmap` Traversable.mapM (metaValueToJSON blockWriter inlineWriter) metamap -metaValueToJSON blockWriter inlineWriter (MetaList xs) = - toJSON `fmap` Traversable.mapM (metaValueToJSON blockWriter inlineWriter) xs +metaValueToJSON blockWriter inlineWriter (MetaMap metamap) = liftM toJSON $ + Traversable.mapM (metaValueToJSON blockWriter inlineWriter) metamap +metaValueToJSON blockWriter inlineWriter (MetaList xs) = liftM toJSON $ + Traversable.mapM (metaValueToJSON blockWriter inlineWriter) xs metaValueToJSON _ _ (MetaString s) = return $ toJSON s -metaValueToJSON blockWriter _ (MetaBlocks bs) = toJSON `fmap` blockWriter bs -metaValueToJSON _ inlineWriter (MetaInlines bs) = toJSON `fmap` inlineWriter bs +metaValueToJSON blockWriter _ (MetaBlocks bs) = liftM toJSON $ blockWriter bs +metaValueToJSON _ inlineWriter (MetaInlines bs) = liftM toJSON $ inlineWriter bs setField :: ToJSON a => String |