Ignore lines with a " before the first = as well

This commit is contained in:
Gunter Labes 2023-03-10 15:10:29 +01:00 committed by GitHub
parent 5e45184480
commit 13f87fdebb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -149,9 +149,10 @@ def comma_split(csstring, list=None, strip="r"):
def parse_attribute(line):
"Parse a WML key-value pair from a line."
if '=' not in line or line.find("#") > -1 and line.find("#") < line.find("="):
return None
where = line.find("=")
# Ignore lines with a # or " before the first =. They're likely line continuations that won't be parsed correctly.
if '=' not in line or -1 < line.find("#") < where or -1 < line.find("\"") < where:
return None
leader = line[:where]
after = line[where+1:]
if re.search("\s#", after):