Properly parse boolean flags in elliptical arc commands
'large-arc-flag' and 'sweep-flag' do not need to be separated from the following path data with comma or whitespace. It results in ambiguous numbers but it's actually valid SVG...
This commit is contained in:
parent
ba7f4b5f18
commit
654e3ea1a6
1 changed files with 14 additions and 6 deletions
|
|
@ -247,16 +247,24 @@ class SVGPathParser(object):
|
||||||
axis_rotation = Decimal(token[1]) * 1
|
axis_rotation = Decimal(token[1]) * 1
|
||||||
|
|
||||||
token = next_val_fn()
|
token = next_val_fn()
|
||||||
if token[1] not in ('0', '1'):
|
if token[1][0] not in ('0', '1'):
|
||||||
raise SyntaxError("expecting a boolean flag; got %r" % (token,))
|
raise SyntaxError("expecting a boolean flag; got %r" % (token,))
|
||||||
large_arc_flag = Decimal(token[1]) * 1
|
large_arc_flag = Decimal(token[1][0]) * 1
|
||||||
|
|
||||||
token = next_val_fn()
|
if len(token[1]) > 1:
|
||||||
if token[1] not in ('0', '1'):
|
token = list(token)
|
||||||
|
token[1] = token[1][1:]
|
||||||
|
else:
|
||||||
|
token = next_val_fn()
|
||||||
|
if token[1][0] not in ('0', '1'):
|
||||||
raise SyntaxError("expecting a boolean flag; got %r" % (token,))
|
raise SyntaxError("expecting a boolean flag; got %r" % (token,))
|
||||||
sweep_flag = Decimal(token[1]) * 1
|
sweep_flag = Decimal(token[1][0]) * 1
|
||||||
|
|
||||||
token = next_val_fn()
|
if len(token[1]) > 1:
|
||||||
|
token = list(token)
|
||||||
|
token[1] = token[1][1:]
|
||||||
|
else:
|
||||||
|
token = next_val_fn()
|
||||||
if token[0] not in self.number_tokens:
|
if token[0] not in self.number_tokens:
|
||||||
raise SyntaxError("expecting a number; got %r" % (token,))
|
raise SyntaxError("expecting a number; got %r" % (token,))
|
||||||
x = Decimal(token[1]) * 1
|
x = Decimal(token[1]) * 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue