aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs5
-rw-r--r--tests/writer.markdown2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 1715f0af1..aa29ebce1 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -38,7 +38,8 @@ import Text.Pandoc.Shared
import Text.Pandoc.Writers.Shared
import Text.Pandoc.Options
import Text.Pandoc.Parsing hiding (blankline, char, space)
-import Data.List ( group, isPrefixOf, find, intersperse, transpose )
+import Data.List ( group, isPrefixOf, find, intersperse, transpose, sortBy )
+import Data.Ord ( comparing )
import Text.Pandoc.Pretty
import Control.Monad.State
import qualified Data.Set as Set
@@ -127,7 +128,7 @@ jsonToYaml (Object hashmap) =
(k', Object _, x) -> (k' <> ":") $$ nest 2 x
(_, String "", _) -> empty
(k', _, x) -> k' <> ":" <> space <> x)
- $ H.toList hashmap
+ $ sortBy (comparing fst) $ H.toList hashmap
jsonToYaml (Array vec) =
vcat $ map (\v -> hang 2 "- " (jsonToYaml v)) $ V.toList vec
jsonToYaml (String "") = empty
diff --git a/tests/writer.markdown b/tests/writer.markdown
index 6691836a3..9db6ae452 100644
--- a/tests/writer.markdown
+++ b/tests/writer.markdown
@@ -1,8 +1,8 @@
---
-date: 'July 17, 2006'
author:
- John MacFarlane
- Anonymous
+date: 'July 17, 2006'
title: Pandoc Test Suite
...