Apply a modified patch by Hungerburg to fix bugs 833666, "scour does not clean comments if file starts with a comment", and bug 804238, whereby Scour fails to correctly parse a polygon/polyline if its first coordinate is negative.
Unit tests added for the negative coordinate parsing.
This commit is contained in:
parent
f8c88f0dfa
commit
60b48353b3
4 changed files with 28 additions and 4 deletions
11
scour.py
11
scour.py
|
|
@ -2125,10 +2125,13 @@ def parseListOfPoints(s):
|
|||
# we got negative coords
|
||||
else:
|
||||
for j in xrange(len(negcoords)):
|
||||
# first number could be positive
|
||||
if j == 0:
|
||||
# first number could be positive
|
||||
if negcoords[0] != '':
|
||||
nums.append(negcoords[0])
|
||||
# but it could also be negative
|
||||
elif len(nums) == 0:
|
||||
nums.append('-' + negcoords[j])
|
||||
# otherwise all other strings will be negative
|
||||
else:
|
||||
# unless we accidentally split a number that was in scientific notation
|
||||
|
|
@ -2554,9 +2557,9 @@ def removeComments(element) :
|
|||
# must process the document object separately, because its
|
||||
# documentElement's nodes have None as their parentNode
|
||||
for subelement in element.childNodes:
|
||||
if isinstance(element, xml.dom.minidom.Comment):
|
||||
numCommentBytes += len(element.data)
|
||||
element.documentElement.removeChild(subelement)
|
||||
if isinstance(subelement, xml.dom.minidom.Comment):
|
||||
numCommentBytes += len(subelement.data)
|
||||
element.removeChild(subelement)
|
||||
else:
|
||||
removeComments(subelement)
|
||||
elif isinstance(element, xml.dom.minidom.Comment):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue