diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-03-28 14:10:00 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-03-28 14:10:00 -0700 |
commit | ba613b2e9ee8c49b20d652ced066c98429bca3a2 (patch) | |
tree | fbc33bec3d6336372c0de23ac12f262924c209d9 | |
parent | 7fa5fbed9e0440694e9c52a8dc83f3e4f29c8a96 (diff) | |
download | pandoc-ba613b2e9ee8c49b20d652ced066c98429bca3a2.tar.gz |
Markdown writer: proper rendering of empty map in YAML metadata.
Should be `{}` not empty string.
Partially addresses #5398.
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 4 |
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 |