Merge branch 'fetch'
Conflicts: packages.json
This commit is contained in:
commit
b6069d4d62
2 changed files with 57 additions and 1 deletions
|
|
@ -85,6 +85,7 @@
|
||||||
"license": "zlib",
|
"license": "zlib",
|
||||||
"web": "https://github.com/Vladar4/libtcod-nim"
|
"web": "https://github.com/Vladar4/libtcod-nim"
|
||||||
},
|
},
|
||||||
|
<<<<<<< HEAD
|
||||||
{
|
{
|
||||||
"name": "nimepak",
|
"name": "nimepak",
|
||||||
"url": "git://github.com/gradha/epak/",
|
"url": "git://github.com/gradha/epak/",
|
||||||
|
|
@ -99,6 +100,8 @@
|
||||||
"license": "Allegro 4 Giftware",
|
"license": "Allegro 4 Giftware",
|
||||||
"web": "https://github.com/gradha/epak"
|
"web": "https://github.com/gradha/epak"
|
||||||
},
|
},
|
||||||
|
=======
|
||||||
|
>>>>>>> fetch
|
||||||
{
|
{
|
||||||
"name": "nimgame",
|
"name": "nimgame",
|
||||||
"url": "git://github.com/Vladar4/nimgame/",
|
"url": "git://github.com/Vladar4/nimgame/",
|
||||||
|
|
@ -2974,6 +2977,18 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"web": "https://christine.website/projects/Vardene"
|
"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",
|
"name": "expat",
|
||||||
"url": "https://github.com/nim-lang/expat",
|
"url": "https://github.com/nim-lang/expat",
|
||||||
|
|
|
||||||
41
pretty_json.nim
Normal file
41
pretty_json.nim
Normal 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()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue