mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Write empty array and dictionary items on one line.
Makes for slightly tidier plist text.
This commit is contained in:
parent
43abf8e3df
commit
c08fd08025
1 changed files with 6 additions and 0 deletions
|
@ -217,6 +217,9 @@ class pldata:
|
||||||
self.data.append(item)
|
self.data.append(item)
|
||||||
def write_item(self, item, level):
|
def write_item(self, item, level):
|
||||||
if type(item) == dict:
|
if type(item) == dict:
|
||||||
|
if not item:
|
||||||
|
self.data.append("{ }")
|
||||||
|
return
|
||||||
self.data.append("{\n")
|
self.data.append("{\n")
|
||||||
for i in item.items():
|
for i in item.items():
|
||||||
self.data.append('\t' * (level + 1))
|
self.data.append('\t' * (level + 1))
|
||||||
|
@ -227,6 +230,9 @@ class pldata:
|
||||||
self.data.append('\t' * (level))
|
self.data.append('\t' * (level))
|
||||||
self.data.append("}")
|
self.data.append("}")
|
||||||
elif type(item) in(list, tuple):
|
elif type(item) in(list, tuple):
|
||||||
|
if not item:
|
||||||
|
self.data.append("( )")
|
||||||
|
return
|
||||||
self.data.append("(\n")
|
self.data.append("(\n")
|
||||||
for n, i in enumerate(item):
|
for n, i in enumerate(item):
|
||||||
self.data.append('\t' * (level + 1))
|
self.data.append('\t' * (level + 1))
|
||||||
|
|
Loading…
Reference in a new issue