diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-07-01 20:56:27 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-07-01 20:56:27 -0700 |
commit | e7a68fc7e82028dbf66f25350b45875fbe634db6 (patch) | |
tree | ae38206a120796b06cda8d771ea468b53c7ce5eb /src/Text | |
parent | 7f83d88a656eff36b070fec0958bd2687c35c146 (diff) | |
download | pandoc-e7a68fc7e82028dbf66f25350b45875fbe634db6.tar.gz |
Markdown writer: Render yaml title block fields in alpha order.
This makes the output predictable; previously it varied across
implementations.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 5 |
1 files changed, 3 insertions, 2 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 |