fix quote detection of multi-line VRMLscripts #5
@ -715,7 +715,7 @@ class vrmlNode(object):
|
|||||||
for v in f:
|
for v in f:
|
||||||
if v != ',':
|
if v != ',':
|
||||||
try:
|
try:
|
||||||
ret.append(float(v))
|
ret.append(float(v.strip('"')))
|
||||||
except:
|
except:
|
||||||
break # quit of first non float, perhaps its a new field name on the same line? - if so we are going to ignore it :/ TODO
|
break # quit of first non float, perhaps its a new field name on the same line? - if so we are going to ignore it :/ TODO
|
||||||
# print(ret)
|
# print(ret)
|
||||||
@ -1219,6 +1219,11 @@ class vrmlNode(object):
|
|||||||
else:
|
else:
|
||||||
value += '\n' + l
|
value += '\n' + l
|
||||||
|
|
||||||
|
# append a final quote if it is not there, like it's e.g. the case with multiline javascripts (#101717)
|
||||||
|
quote_count = l.count('"')
|
||||||
|
if quote_count % 2: # odd number?
|
||||||
|
value += '"'
|
||||||
|
|
||||||
# use shlex so we get '"a b" "b v"' --> '"a b"', '"b v"'
|
# use shlex so we get '"a b" "b v"' --> '"a b"', '"b v"'
|
||||||
value_all = shlex.split(value, posix=False)
|
value_all = shlex.split(value, posix=False)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user