diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2014-05-12 13:05:42 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2014-05-12 13:05:42 -0700 |
commit | 2348f07b11700e685cd194c93c5891d2c288dbc0 (patch) | |
tree | 8a380a10d0ebb542c460c4b62b47ea527bcdeee8 | |
parent | 06edff7402bc88ca99723b718b83a5ea95860b33 (diff) | |
download | pandoc-2348f07b11700e685cd194c93c5891d2c288dbc0.tar.gz |
Shared addMetaField: if old and new values both lists, concatenate.
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 31c490af6..4f506b5a6 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -564,8 +564,10 @@ addMetaField :: ToMetaValue a -> Meta addMetaField key val (Meta meta) = Meta $ M.insertWith combine key (toMetaValue val) meta - where combine newval (MetaList xs) = MetaList (xs ++ [newval]) + where combine newval (MetaList xs) = MetaList (xs ++ tolist newval) combine newval x = MetaList [x, newval] + tolist (MetaList ys) = ys + tolist y = [y] -- | Create 'Meta' from old-style title, authors, date. This is -- provided to ease the transition from the old API. |