Discussion:
[elm-discuss] Elm as templating engine
Birowsky
2017-09-02 23:18:25 UTC
Permalink
Trying to use elm as a templating engine for AMP pages. But they have
specific requirements where I need to specify attributes without values. Is
that possible with some elm construct?

https://www.ampproject.org/docs/tutorials/create/basic_markup

for an example:

amp =
boolProperty "⚡" True


creates `⚡="true"` instead of just the `⚡`
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Gusztáv Szikszai
2017-09-03 03:54:30 UTC
Permalink
You need to use `attribute` with an empty string as
value. https://ellie-app.com/4ckwSKX7YKGa1/0
Post by Birowsky
Trying to use elm as a templating engine for AMP pages. But they have
specific requirements where I need to specify attributes without values. Is
that possible with some elm construct?
https://www.ampproject.org/docs/tutorials/create/basic_markup
amp =
boolProperty "⚡" True
creates `⚡="true"` instead of just the `⚡`
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Birowsky
2017-09-03 08:07:50 UTC
Permalink
Unfortunately, it just adds `=""`. You can't see it in the dev tools
because the browser strips it away.

Now, while the validation passes with empty string as a value, what
frightens me, is that the AMP docs state that the online validator is not a
complete validation and some errors would surface only after google crawls
the content. I swear I read it somewhere in the official docs, I'll update
when I find it :}
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Peter Damoc
2017-09-04 14:23:52 UTC
Permalink
Post by Birowsky
Unfortunately, it just adds `=""`. You can't see it in the dev tools
because the browser strips it away.
Fortunately that is OK as it is implicitly equivalent to what you want:
http://w3c.github.io/html/infrastructure.html#sec-boolean-attributes
(see the first Note of the section)
--
There is NO FATE, we are the creators.
blog: http://damoc.ro/
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Birowsky
2017-09-05 13:27:55 UTC
Permalink
Yap, that's the route I took. If you don't hear back from me, it means
Google has not complained :}
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Rupert Smith' via Elm Discuss
2017-09-04 13:44:03 UTC
Permalink
Post by Birowsky
Trying to use elm as a templating engine for AMP pages. But they have
specific requirements where I need to specify attributes without values. Is
that possible with some elm construct?
https://www.ampproject.org/docs/tutorials/create/basic_markup
amp =
boolProperty "⚡" True
creates `⚡="true"` instead of just the `⚡`
I know its horrible, but the only way I can think of to do it is to use
Html.text:

Html.text "<div with-valueless-attribute>"

Valueless attributes do not seem to be allowed by the Elm virtual DOM code,
even though they can be valid Html:

https://github.com/elm-lang/virtual-dom/blob/master/src/VirtualDom.elm#L159
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...