aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-08-20 23:00:20 +0200
committerAraq <rumpf_a@web.de>2015-08-20 23:00:20 +0200
commitb6069d4d62315151742ee42b55a78749151c7f24 (patch)
tree7a3b02f985bd81f5818f4bf407992a3d96ad926b
parent4eb9158778f64838d24844b67099be96fd363a38 (diff)
parentdd08bb75ee8875600f9b8303c0442d05379c213f (diff)
downloadpackages-b6069d4d62315151742ee42b55a78749151c7f24.tar.gz
packages-b6069d4d62315151742ee42b55a78749151c7f24.zip
Merge branch 'fetch'
Conflicts: packages.json
-rw-r--r--packages.json17
-rw-r--r--pretty_json.nim41
2 files changed, 57 insertions, 1 deletions
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/",
@@ -2975,6 +2978,18 @@
"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",
"method": "git",
@@ -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()