diff --git a/packages.json b/packages.json index 4d3280a..d43ca3e 100644 --- a/packages.json +++ b/packages.json @@ -85,6 +85,7 @@ "license": "zlib", "web": "https://github.com/Vladar4/libtcod-nim" }, +<<<<<<< HEAD { "name": "nimepak", "url": "git://github.com/gradha/epak/", @@ -99,6 +100,8 @@ "license": "Allegro 4 Giftware", "web": "https://github.com/gradha/epak" }, +======= +>>>>>>> fetch { "name": "nimgame", "url": "git://github.com/Vladar4/nimgame/", @@ -2974,6 +2977,18 @@ "license": "MIT", "web": "https://christine.website/projects/Vardene" }, + { + "name": "quadtree", + "url": "https://github.com/Nycto/QuadtreeNim", + "method": "git", + "tags": [ + "quadtree", + "algorithm" + ], + "description": "A Quadtree implementation", + "license": "MIT", + "web": "https://github.com/Nycto/QuadtreeNim" + }, { "name": "expat", "url": "https://github.com/nim-lang/expat", @@ -3001,4 +3016,4 @@ "license": "LGPL", "web": "https://github.com/Araq/sphinx" } -] \ No newline at end of file +] diff --git a/pretty_json.nim b/pretty_json.nim new file mode 100644 index 0000000..4249727 --- /dev/null +++ b/pretty_json.nim @@ -0,0 +1,41 @@ + +import strutils, json, os + +proc cleanupWhitespace(s: string): string = + ## Removes trailing whitespace and normalizes line endings to LF. + result = newStringOfCap(s.len) + var i = 0 + while i < s.len: + if s[i] == ' ': + var j = i+1 + while s[j] == ' ': inc j + if s[j] == '\c': + inc j + if s[j] == '\L': inc j + result.add '\L' + i = j + elif s[j] == '\L': + result.add '\L' + i = j+1 + else: + result.add ' ' + inc i + elif s[i] == '\c': + inc i + if s[i] == '\L': inc i + result.add '\L' + elif s[i] == '\L': + result.add '\L' + inc i + else: + result.add s[i] + inc i + if result[^1] != '\L': + result.add '\L' + +proc editJson() = + var contents = parseFile("packages.json") + doAssert contents.kind == JArray + writeFile("packages.json", contents.pretty.cleanupWhitespace) + +editJson()