Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NUMBER_PATTERN regex for parsing SVG viewboxes #128

Merged
merged 2 commits into from
Aug 4, 2023

Conversation

jams2
Copy link
Contributor

@jams2 jams2 commented Aug 4, 2023

Fixes #127

The NUMBER_PATTERN in the SVG viewbox regular expression was missing the optional + or - in the final integer production.

The definition for number, as used in SVG attributes, can be found here:

# https://github.com/wagtail/Willow/issues/127
(
"-5.000000011410315e-06 0.0 750.00001 525.000007",
ViewBox(-5.000000011410315e-06, 0.0, 750.00001, 525.000007),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a test for -5.000000011410315e06 which should be valid as far as I can tell from https://www.w3.org/TR/SVG11/types.html#DataTypeNumber and https://www.w3.org/TR/SVG11/types.html#DataTypeInteger ?

Other than that, LGTM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, added a few more tests.

@zerolab zerolab merged commit 72f9af7 into wagtail:main Aug 4, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SvgViewBoxParseError at /cms/images/
2 participants