on master help sign in
Nicer order for JSON fields
commitabe4a81f084910592e4021d979709503e074afe0 authorEvan Czaplicki <info@elm-lang.org> dateThu 5 Sep 2013, 15:44 (13 years ago) parent5b2c4f6
1 file changed+6−1
compiler/Docs.hs+6−1
compiler/Docs.hs+6−1
@@ -38,6 +38,11 @@ main = do
3838 flags <- cmdArgs defaultFlags
3939 mapM parseFile (files flags)
4040
41+config = Config { confIndent = 2, confCompare = keyOrder keys }
42+ where
43+ keys = ["name","document","comment","raw","aliases","datatypes"
44+ ,"values","typeVariables","type","constructors"]
45+
4146parseFile path = do
4247 source <- readFile path
4348 case iParse docs "" source of
@@ -45,7 +50,7 @@ parseFile path = do
4550 putStrLn $ "Documenting " ++ path
4651 let docPath = "docs" </> replaceExtension path ".json"
4752 createDirectoryIfMissing True (dropFileName docPath)
48− BS.writeFile docPath (encodePretty' (defConfig { confIndent = 2 }) json)
53+ BS.writeFile docPath (encodePretty' config json)
4954 Left err -> do
5055 putStrLn $ "Parse error in " ++ path ++ " at " ++ show err
5156 exitFailure