Markdown writer: proper rendering of empty map in YAML metadata.

Should be `{}` not empty string.

Partially addresses #5398.
This commit is contained in:
John MacFarlane 2019-03-28 14:10:00 -07:00
parent 7fa5fbed9e
commit ba613b2e9e

View file

@ -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