Produce HTML from S-Expressions
github.com
Produce HTML from S-Expressions
1–10 of 63 posts
Re: Produce HTML from S-Expressions
#2 (h1 :disabled Hello world!)
(div :class="alert"
So long, and (b thanks) for all the (em fish))
I hate that syntax for attributes.:class="alert" is strictly worse than ((class . "alert")) or any other variation that actually leverages s-expressions instead of merging key and value into the same symbol. Ew.
Not a fan of the bare words instead of strings either, which means this cannot be naively evaluated by a Lisp.
I wouldn't say this is producing html from s-exps, rather that it is vaguely inspired by them.
Re: Produce HTML from S-Expressions
#3(h1 :disabled Hello world!) (div :class="alert" So long, and (b thanks) for all the (em fish)) I hate that syntax for attributes. :class="alert" is strictly worse than ((class . "alert")) or any other variation that actually leverages s-expressions instead of merging key and value into the same symbol. Ew. Not a fan of the bare words instead of strings either, which means this cannot be naively evaluated by a Lisp. I…
Re: Produce HTML from S-Expressions
#4(h1 :disabled Hello world!) (div :class="alert" So long, and (b thanks) for all the (em fish)) I hate that syntax for attributes. :class="alert" is strictly worse than ((class . "alert")) or any other variation that actually leverages s-expressions instead of merging key and value into the same symbol. Ew. Not a fan of the bare words instead of strings either, which means this cannot be naively evaluated by a Lisp. I…
I hear you, but I wasn't aiming for leveraging the power of macros. Using `((class . "alert"))` does not provide any benefits over :class="alert".
> Not a fan of the bare words instead of strings either, which means this cannot be naively evaluated by a Lisp.
I traded off ergonomics against "Evaluation by a Lisp processor".Instead of
(div "My first " (b "hello") (em " world"))
I'd rather do (div My first (b hello) (em world))
Thank you for your input.Re: Produce HTML from S-Expressions
#5(h1 :disabled Hello world!) (div :class="alert" So long, and (b thanks) for all the (em fish)) I hate that syntax for attributes. :class="alert" is strictly worse than ((class . "alert")) or any other variation that actually leverages s-expressions instead of merging key and value into the same symbol. Ew. Not a fan of the bare words instead of strings either, which means this cannot be naively evaluated by a Lisp. I…
It is consistent with HTML however, especially the fact that both collapse whitespace.
Re: Produce HTML from S-Expressions
#6(h1 :disabled Hello world!) (div :class="alert" So long, and (b thanks) for all the (em fish)) I hate that syntax for attributes. :class="alert" is strictly worse than ((class . "alert")) or any other variation that actually leverages s-expressions instead of merging key and value into the same symbol. Ew. Not a fan of the bare words instead of strings either, which means this cannot be naively evaluated by a Lisp. I…
Re: Produce HTML from S-Expressions
#7(h1 :disabled Hello world!) (div :class="alert" So long, and (b thanks) for all the (em fish)) I hate that syntax for attributes. :class="alert" is strictly worse than ((class . "alert")) or any other variation that actually leverages s-expressions instead of merging key and value into the same symbol. Ew. Not a fan of the bare words instead of strings either, which means this cannot be naively evaluated by a Lisp. I…
Most Lisps (all that I know of) have a way to convert symbols to strings. The hard part is resolving the ambiguity between what should be text, and what should be treated as an HTML node. Like, what if I wanted to actually write the string "(b thanks)" on a page? R7RS could probably do this with the pipe identifier syntax[0], but I think R7RS is fairly unique in its capability for identifiers (and thus symbols) with such a wide range of supported characters.
[0] https://standards.scheme.org/corrected-r7rs/r7rs-Z-H-4.html#...
Re: Produce HTML from S-Expressions
#8Re: Produce HTML from S-Expressions
#9And still I can't find one that I like (which is why I also wrote one myself :D).
Re: Produce HTML from S-Expressions
#10(h1 :disabled Hello world!) (div :class="alert" So long, and (b thanks) for all the (em fish)) I hate that syntax for attributes. :class="alert" is strictly worse than ((class . "alert")) or any other variation that actually leverages s-expressions instead of merging key and value into the same symbol. Ew. Not a fan of the bare words instead of strings either, which means this cannot be naively evaluated by a Lisp. I…
> :class="alert" is strictly worse than ((class . "alert")) or any other variation that actually leverages s-expressions instead of merging key and value into the same symbol. Ew. I hear you, but I wasn't aiming for leveraging the power of macros. Using `((class . "alert"))` does not provide any benefits over :class="alert". > Not a fan of the bare words instead of strings either, which means this cannot be naively e…
Of course it does. It is a s-exp, like everything else in this language, so it's just another list you can map, apply or otherwise transform. The keyword approach instead requires a weird incantation of
(string-trim (cadr (string-split (keyword->string :class="alert") ?=)) ?")
to extract the value from the attribute. For what benefit? If the goal is using s-exps, why not use s-exps for everything?