aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-03-28 14:10:00 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-03-28 14:10:00 -0700
commitba613b2e9ee8c49b20d652ced066c98429bca3a2 (patch)
treefbc33bec3d6336372c0de23ac12f262924c209d9 /src/Text/Pandoc
parent7fa5fbed9e0440694e9c52a8dc83f3e4f29c8a96 (diff)
downloadpandoc-ba613b2e9ee8c49b20d652ced066c98429bca3a2.tar.gz
Markdown writer: proper rendering of empty map in YAML metadata.
Should be `{}` not empty string. Partially addresses #5398.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 4964fbad0..3850dccd2 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -149,7 +149,9 @@ jsonToYaml (Object hashmap) =
(k', Array vec, x)
| V.null vec -> empty
| otherwise -> (k' <> ":") $$ x
- (k', Object _, x) -> (k' <> ":") $$ nest 2 x
+ (k', Object hm, x)
+ | H.null hm -> k' <> ": {}"
+ | otherwise -> (k' <> ":") $$ nest 2 x
(_, String "", _) -> empty
(k', _, x) -> k' <> ":" <> space <> hang 2 "" x)
$ sortBy (comparing fst) $ H.toList hashmap