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

Parser error for attribute transform #326

Open
Mbodin opened this issue Nov 28, 2023 · 2 comments
Open

Parser error for attribute transform #326

Mbodin opened this issue Nov 28, 2023 · 2 comments

Comments

@Mbodin
Copy link
Contributor

Mbodin commented Nov 28, 2023

When I tried the following program:

let%svg test = "<g transform='translate(1,1)'></g>"

I got this error:

Error: Value of transform must be an SVG transform

I'm very surprised as the corresponding parser looks correct:

let transform =

Here follow the versions of my dependencies. I'm pinning to specific commits to get this fix: aantron/markup.ml#69

tyxml-ppx: github:ocsigen/tyxml:tyxml-ppx.opam#d2916535536f2134bad7793a598ba5b7327cae41@a609c0aa
tyxml@opam:4.6.0@5ced2c2c
tyxml-syntax@opam:4.6.0@0e4fa721
markup: github:aantron/markup.ml#d77da228ed8915b6f11fbea00c269cfd5fd9e84a

My environment is a bit dirty at the moment. Does it reproduce on your side?

Tasks

No tasks being tracked yet.
@Mbodin
Copy link
Contributor Author

Mbodin commented Dec 4, 2023

I think that I understand the issue.

In TyXML, it seems that the input is first split along spaces and commas, then parsed:

| [[%type: transforms]] ->

This means that a value of transform (1,1) is transformed first into transform, (1, and 1), then each of these three items are parsed along the transform parser, which expected to see only one block transform (1,1), so each of them is treated as invalid.

Note that in contrary to what is written in the transform parser, white spaces can be expected between transform and its arguments: https://drafts.csswg.org/css-transforms/#svg-translate

@Mbodin
Copy link
Contributor Author

Mbodin commented Dec 4, 2023

This means that in the current state, it is not possible to parse any matrix value. We are definitively missing some tests here.

I'm trying to see what I can do to fix the issue.

Mbodin added a commit to Mbodin/tyxml that referenced this issue Dec 4, 2023
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

No branches or pull requests

1 participant