git.iko.soy/typeable/pandoc
on master help sign in
Markdown writer: proper rendering of empty map in YAML metadata.

Should be `{}` not empty string. Partially addresses #5398.

commitba613b2e9ee8c49b20d652ced066c98429bca3a2 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 28 Mar 2019, 14:10 (8 years ago) parent7fa5fbe
1 file changed+3−1
src/Text/Pandoc/Writers/Markdown.hs+3−1
src/Text/Pandoc/Writers/Markdown.hs+3−1
@@ -149,7 +149,9 @@ jsonToYaml (Object hashmap) =
149149 (k', Array vec, x)
150150 | V.null vec -> empty
151151 | otherwise -> (k' <> ":") $$ x
152− (k', Object _, x) -> (k' <> ":") $$ nest 2 x
152+ (k', Object hm, x)
153+ | H.null hm -> k' <> ": {}"
154+ | otherwise -> (k' <> ":") $$ nest 2 x
153155 (_, String "", _) -> empty
154156 (k', _, x) -> k' <> ":" <> space <> hang 2 "" x)
155157 $ sortBy (comparing fst) $ H.toList hashmap