From e6810b476fb4153760acc70a65a80c0e174ed9d8 Mon Sep 17 00:00:00 2001 From: Joachim Nielandt Date: Thu, 4 Jan 2018 20:59:55 +0100 Subject: [PATCH] Pretty printed the info.json when modifying it. --- src/assets/post/project/test/info.json | 5 ++++- src/assets/posts.json | 2 +- src/scripts/compileposts.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/assets/post/project/test/info.json b/src/assets/post/project/test/info.json index 115d6a7..673a936 100644 --- a/src/assets/post/project/test/info.json +++ b/src/assets/post/project/test/info.json @@ -1 +1,4 @@ -{"created_timestamp": 1515094644.214663, "title": "Test title"} \ No newline at end of file +{ + "created_timestamp": 1515095948.838848, + "title": "Test title" +} \ No newline at end of file diff --git a/src/assets/posts.json b/src/assets/posts.json index 9cc4ba6..d6f07cb 100644 --- a/src/assets/posts.json +++ b/src/assets/posts.json @@ -1 +1 @@ -[{"info": {"created_timestamp": 1515094644.214663, "title": "Test title"}, "post": [], "type": "project", "id": "test"}, {"info": {"created_timestamp": 1515094644.215065, "title": "cupboard"}, "post": [], "type": "project", "id": "cupboard1"}, {"info": {"created_timestamp": 1515094644.215333, "title": "some things about lxc in arch"}, "post": [], "type": "tech", "id": "lxdarch"}, {"info": {"test": "some dummy value", "created_timestamp": 1515094679.342938, "title": "Who said Web 1.0 was dead anyway?"}, "post": [], "type": "blog", "id": "first"}] \ No newline at end of file +[{"info": {"created_timestamp": 1515095948.838848, "title": "Test title"}, "post": [], "type": "project", "id": "test"}, {"info": {"created_timestamp": 1515094644.215065, "title": "cupboard"}, "post": [], "type": "project", "id": "cupboard1"}, {"info": {"created_timestamp": 1515094644.215333, "title": "some things about lxc in arch"}, "post": [], "type": "tech", "id": "lxdarch"}, {"info": {"created_timestamp": 1515094679.342938, "title": "Who said Web 1.0 was dead anyway?"}, "post": [], "type": "blog", "id": "first"}] \ No newline at end of file diff --git a/src/scripts/compileposts.py b/src/scripts/compileposts.py index 96fb43f..af0269d 100644 --- a/src/scripts/compileposts.py +++ b/src/scripts/compileposts.py @@ -38,7 +38,7 @@ for type in types: d['created_timestamp'] = time.time() # persist it in the json file itself with open(infofile, 'w') as infooutfile: - json.dump(d, infooutfile) + json.dump(d, infooutfile, sort_keys=True, indent=4, separators=(',', ': ')) # # figure out the last change of any file in the folder # lastchange = 0;