Merge branch 'fetch'

Conflicts:
	packages.json
This commit is contained in:
Araq 2015-08-20 23:00:20 +02:00
commit b6069d4d62
2 changed files with 57 additions and 1 deletions

View File

@ -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"
}
]
]

41
pretty_json.nim Normal file
View File

@ -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()