w3c / svgwg

SVG Working Group specifications
Other
695 stars 131 forks source link

Decimal point not allowed according to Path Data ENBF #926

Closed waruyama closed 7 months ago

waruyama commented 7 months ago

Either I am completely missing something, or the ENBF for a coordinate in path data does not allow decimal points.

Here is the relevant part of the SVG 2.0 spec: https://www.w3.org/TR/SVG2/paths.html#PathDataBNF

According to this a coordinate can only consist of digits with an optional leading sign. This is the ENBF for a coordinate as written in the spec:

coordinate::= sign? number

sign::= "+"|"-"
number ::= ([0-9])+

The correct definition for number (to allow numbers like "0.3", ".3", "3.") must probably look like this:

number ::= ([0-9]+ "."? [0-9]* | "." [0-9]+)
dalboris commented 7 months ago

Indeed, and also things like 1.0e-42 should be allowed too. This was correct in SVG 1.1, see:

https://www.w3.org/TR/SVG11/paths.html#PathDataBNF

I believe the idea is that in SVG 2.0, it should delegate the definition of "number" to CSS.

There are in fact a few other things that were broken when the grammar was rewritten between 1.1 and 2.0, see:

Is there someone on the committee and/or with merge rights that can volunteer to review these changes, integrate them, and close all these related issues? The above PR is a good place to start as it's quite a trivial change: only one line modified. If someone is willing to review and merge PRs, starting with the one above, then I can take the time to volunteer to make other PRs to fix the remaining grammar problems.

dalboris commented 7 months ago

Also, I just realized that the link you provided is from the W3C Candidate Recommendation of 04 October 2018.

The number syntax has already been fixed since, the latest version ("Editors draft") can be found at this link:

https://svgwg.org/svg2-draft/

Which already contains the following fix to the number grammar:

https://github.com/w3c/svgwg/commit/93c09f1726913fb6f5c198c95742f47c2961a035

So I think we can close this specific issue.

waruyama commented 7 months ago

Sorry for that, the link came up in the Google search when searching for the SVG2 spec and I did not check if it is the current version.

Closing this issue.