fix wmltools' parse_attribute to not consider pango color hashes as a comment
While there are many places that wmllint assumes that "#" begins a comment, from Vultraz's description it sounded like parse_attribute was being used to find the attribute's value, and then a string_strip was done on the value. So I looked for the direct cause in wmltools. Again, the solution is to look for whitespace to precede the hashsign. Incidentally, I don't know why the original code had the first "where -= 1", then had value and comment go from [:where+1] and [where+1:].
This commit is contained in:
parent
d90f082312
commit
6cf03fe827
1 changed files with 4 additions and 7 deletions
|
@ -60,13 +60,10 @@ def parse_attribute(line):
|
|||
leader = line[:where]
|
||||
after = line[where+1:]
|
||||
after = after.lstrip()
|
||||
if "#" in after:
|
||||
where = after.find("#")
|
||||
where -= 1
|
||||
while after[where] in (" ", "\t"):
|
||||
where -= 1
|
||||
value = after[:where+1]
|
||||
comment = after[where+1:]
|
||||
if re.search("\s#", after):
|
||||
where = len(re.split("\s+#", after)[0])
|
||||
value = after[:where]
|
||||
comment = after[where:]
|
||||
else:
|
||||
value = after.rstrip()
|
||||
comment = ""
|
||||
|
|
Loading…
Add table
Reference in a new issue