1
This commit is contained in:
parent
ff483ad567
commit
54eebf109f
@ -49,11 +49,54 @@ class MyDoc(object):
|
|||||||
return '"%s"' % (val)
|
return '"%s"' % (val)
|
||||||
return val
|
return val
|
||||||
def outRsp(item, ident):
|
def outRsp(item, ident):
|
||||||
self._wf.write(' * %s"%s": %s, //%s\n' %
|
if isinstance(item[1], list):
|
||||||
(''.join([' ' for i in range(ident)]),
|
if item[0].find('!') != -1:
|
||||||
item[0],
|
self._wf.write(' * %s"%s": [ //%s\n' %
|
||||||
getJsonValue(item[1]),
|
(''.join([' ' for i in range(ident)]),
|
||||||
item[2]))
|
item[0].replace('!', ''),
|
||||||
|
item[2]))
|
||||||
|
if len(item[1]) == 1:
|
||||||
|
if type(item[1]) in (int, float, str):
|
||||||
|
self._wf.write(' * %s%s\n' %
|
||||||
|
(''.join([' ' for i in range(ident + 1)]),
|
||||||
|
getJsonValue(item[1][0])))
|
||||||
|
elif type(item[1][0]) in (list,):
|
||||||
|
self._wf.write(' * %s{\n' %
|
||||||
|
(''.join([' ' for i in range(ident + 1)]),
|
||||||
|
))
|
||||||
|
outRsp(item[1][0], ident + 2)
|
||||||
|
self._wf.write(' * %s}\n' %
|
||||||
|
(''.join([' ' for i in range(ident + 1)]),
|
||||||
|
))
|
||||||
|
else:
|
||||||
|
[outRsp(p, ident + 1) for p in item[1][0].fields]
|
||||||
|
else:
|
||||||
|
self._wf.write(' * %s{\n' %
|
||||||
|
(''.join([' ' for i in range(ident + 1)]),
|
||||||
|
))
|
||||||
|
for subitem in item[1]:
|
||||||
|
outRsp(subitem, ident + 2)
|
||||||
|
self._wf.write(' * %s}\n' %
|
||||||
|
(''.join([' ' for i in range(ident + 1)]),
|
||||||
|
))
|
||||||
|
self._wf.write(' * %s]\n' % (''.join([' ' for i in range(ident)])))
|
||||||
|
else:
|
||||||
|
self._wf.write(' * %s"%s": { //%s\n' %
|
||||||
|
(''.join([' ' for i in range(ident)]),
|
||||||
|
item[0],
|
||||||
|
item[2]))
|
||||||
|
for subitem in item[1]:
|
||||||
|
outRsp(subitem, ident + 2)
|
||||||
|
self._wf.write(' * %s}\n' % (''.join([' ' for i in range(ident)])))
|
||||||
|
else:
|
||||||
|
if type(item[1]) in (int, float, str):
|
||||||
|
self._wf.write(' * %s"%s": %s, //%s\n' %
|
||||||
|
(''.join([' ' for i in range(ident)]),
|
||||||
|
item[0],
|
||||||
|
getJsonValue(item[1]),
|
||||||
|
item[2]))
|
||||||
|
else:
|
||||||
|
[outRsp(p, 1) for p in item[1].fields]
|
||||||
|
|
||||||
for item in c.apis:
|
for item in c.apis:
|
||||||
self._wf.write('\n /**\n')
|
self._wf.write('\n /**\n')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user