diff options
author | John MacFarlane <jgm@berkeley.edu> | 2020-09-13 14:11:07 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2020-09-21 10:10:12 -0700 |
commit | 39f357027aafeed5f20f350db0a892b9cc3efd43 (patch) | |
tree | f39f26dddb5b22f3a495a053cccd04163053dbca /src/Text | |
parent | 045dd212a722c275ae8e8358c70e990ad4e90c51 (diff) | |
download | pandoc-39f357027aafeed5f20f350db0a892b9cc3efd43.tar.gz |
Sort YAML metadata keys in Markdown output case-insensitive.
Use caseFold.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 323d159b0..f0643c91b 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -126,7 +126,7 @@ pandocTitleBlock tit auths dat = mmdTitleBlock :: Context Text -> Doc Text mmdTitleBlock (Context hashmap) = - vcat $ map go $ sortOn fst $ M.toList hashmap + vcat $ map go $ sortOn (T.toCaseFold . fst) $ M.toList hashmap where go (k,v) = case (text (T.unpack k), v) of (k', ListVal xs) @@ -155,7 +155,7 @@ yamlMetadataBlock v = "---" $$ contextToYaml v $$ "---" contextToYaml :: Context Text -> Doc Text contextToYaml (Context o) = - vcat $ map keyvalToYaml $ sortOn fst $ M.toList o + vcat $ map keyvalToYaml $ sortOn (T.toCaseFold . fst) $ M.toList o where keyvalToYaml (k,v) = case (text (T.unpack k), v) of |