ChatON:P2:meta json to hpp conversion - add k-v pairs skeleton
This commit is contained in:
parent
0c21a0084f
commit
078e04d32b
1 changed files with 9 additions and 1 deletions
|
@ -5,9 +5,17 @@
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
def kv(j, tmpl, k1, k2, comma):
|
||||||
|
print("\t\t{{ \"{}\", \"{}\" }}{}".format("{}-{}".format(k1,k2), j[tmpl][k1][k2], comma))
|
||||||
|
|
||||||
|
|
||||||
fp=open(sys.argv[1])
|
fp=open(sys.argv[1])
|
||||||
j=json.load(fp)
|
j=json.load(fp)
|
||||||
print("{")
|
print("{")
|
||||||
for tmpl in j:
|
for tmpl in j:
|
||||||
print("\t{{ \"{}\", ".format(tmpl))
|
print("\t{{ \"{}\", {{".format(tmpl))
|
||||||
|
kv(j, tmpl, "global", "begin", ",")
|
||||||
|
kv(j, tmpl, "global", "end", ",")
|
||||||
|
print("\t}},")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue