-
Notifications
You must be signed in to change notification settings - Fork 62
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
Add <picture> tag #263
Add <picture> tag #263
Conversation
slegrand45
commented
Mar 24, 2020
- HTML Living standard
- MDN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks of the contribution!
I'm not sure I agree with that signature.
picture
is supposed to have exactly one img
child, and zero-or-more source
children. The right signature is then ?a:attribs -> [< picture_content_fun] elt list_wrap -> [< img] elt -> [> picture] elt
. where picture_content_fun
does not contains img
. There are several other tyxml elements that are implemented similarly (table
, most notably).
If we go that way, we have to write a custom wrapper for the ppx.
test/test_ppx.ml
Outdated
<img src=\"picture/img.png\" alt=\"test picture/img.png\" id=\"idimg\"/> | ||
<source type=\"image/webp\" src=\"picture/img1.webp\"/> | ||
<source type=\"image/jpeg\" src=\"picture/img2.jpg\"/> | ||
</picture></div>"]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use raw string and avoid the escaped quoting.
test/test_html.ml
Outdated
^ "<img src=\"picture/img.png\" alt=\"test picture/img.png\" id=\"idimg\"/>" | ||
^ "<source type=\"image/webp\" src=\"picture/img1.webp\"/>" | ||
^ "<source type=\"image/jpeg\" src=\"picture/img2.jpg\"/>" | ||
^ "</picture></div>" ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer raw strings here ({|...|}
).
@@ -590,7 +592,6 @@ type core_phrasing_without_interactive = | |||
| `Wbr | |||
| `Var | |||
| `U | |||
| `Img |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well spotted!
@@ -855,6 +855,9 @@ module type T = sig | |||
alt: text wrap -> | |||
([< img_attrib], [> img]) nullary | |||
|
|||
val picture : ([< | picture_attrib], [< | picture_content_fun], [> | picture]) star | |||
[@@reflect.filter_whitespace] | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add link to the MDN doc ? :)
Perfect! |
CHANGES: * Move all the PPXs to ppxlib (ocsigen/tyxml#271, Initial code by Sonja @pitag-ha Heinze) * Add the `translate` attribute (ocsigen/tyxml#281 by Javier @jchavarri Chávarri) * Update allowed `inputmode`s (ocsigen/tyxml#279 by Joel @joelburget Burget) * Add the `picture` element (ocsigen/tyxml#263 by Stéphane @slegrand45 Legrand)
CHANGES: * Move all the PPXs to ppxlib (ocsigen/tyxml#271, Initial code by Sonja Heinze) * Add the `translate` attribute (ocsigen/tyxml#281 by Javier Chávarri) * Update allowed `inputmode`s (ocsigen/tyxml#279 by Joel Burget) * Add the `picture` element (ocsigen/tyxml#263 by Stéphane Legrand)
CHANGES: * Move all the PPXs to ppxlib (ocsigen/tyxml#271, Initial code by Sonja @pitag-ha Heinze) * Add the `translate` attribute (ocsigen/tyxml#281 by Javier @jchavarri Chávarri) * Update allowed `inputmode`s (ocsigen/tyxml#279 by Joel @joelburget Burget) * Add the `picture` element (ocsigen/tyxml#263 by Stéphane @slegrand45 Legrand)
CHANGES: * Move all the PPXs to ppxlib (ocsigen/tyxml#271, Initial code by Sonja @pitag-ha Heinze) * Add the `translate` attribute (ocsigen/tyxml#281 by Javier Chávarri) * Update allowed `inputmode`s (ocsigen/tyxml#279 by Joel Burget) * Add the `picture` element (ocsigen/tyxml#263 by Stéphane Legrand)
CHANGES: * Move all the PPXs to ppxlib (ocsigen/tyxml#271, Initial code by Sonja Heinze) * Add the `translate` attribute (ocsigen/tyxml#281 by Javier Chávarri) * Update allowed `inputmode`s (ocsigen/tyxml#279 by Joel Burget) * Add the `picture` element (ocsigen/tyxml#263 by Stéphane Legrand)
CHANGES: * Move all the PPXs to ppxlib (ocsigen/tyxml#271, Initial code by Sonja Heinze) * Add the `translate` attribute (ocsigen/tyxml#281 by Javier Chávarri) * Update allowed `inputmode`s (ocsigen/tyxml#279 by Joel Burget) * Add the `picture` element (ocsigen/tyxml#263 by Stéphane Legrand)
CHANGES: * Move all the PPXs to ppxlib (ocsigen/tyxml#271, Initial code by Sonja Heinze) * Add the `translate` attribute (ocsigen/tyxml#281 by Javier Chávarri) * Update allowed `inputmode`s (ocsigen/tyxml#279 by Joel Burget) * Add the `picture` element (ocsigen/tyxml#263 by Stéphane Legrand)