6 ms·
I actually really love this. I much prefer this over HTML syntax. Add a way to do custom tags and imports and this becomes a very, very neat static site generat
by junon 3y ago
I actually really love this. I much prefer this over HTML syntax. Add a way to do custom tags and imports and this becomes a very, very neat static site generation tool.
- lelanthran 3y ago> Add a way to do custom tags I don't know what that means - it currently uses the first element of the list as the tagname, so you can use whatever tags you want to. > and imports and this becomes a very, very neat static site generation tool. I've toyed with the idea of adding more functionality (like imports, environment variables, conditionals, etc). Not too sure I want to go in that direction.
- junon 3y agoThe ability to create tag templates basically. You'd define tags that you could parameterize using attributes, and then within the custom tag "body" would be more tags definitions. If the parser comes across a tag it doesn't know, it emits it verbatim. If it comes across a tag that is defined as a custom tag, then it replaces the tag expression with the expanded tag template body ("expanded" here meaning the parameters are substituted). Similar to JSX, make an implicit parameter called "children" that holds all child elements, and then allow the templates to refer to attributes with a special expression (e.g. `(attr children)` or something, or maybe just `(:children)` if that doesn't break syntax rules).
- lelanthran 3y ago> The ability to create tag templates basically. You'd define tags that you could parameterize using attributes, and then within the custom tag "body" would be more tags definitions. This sounds like a good idea (could call it a `macro` but it might annoy readers who expect Lisp-type macros). Something to DRY the input a little, maybe. I don't want it veering off too much into LispLand because then it's bound to be annoying to devs who wanted a more Lisp-conformant tool.
- mschaef 3y ago> The ability to create tag templates basically. You'd define tags that you could parameterize using attributes, and then within the custom tag "body" would be more tags definitions. Not sure how it might be supported in this library, but Hiccup (in the Clojure) ecosystem is similar and lets you do this with functions. This is a simple example of a scrollable div with a title block. (defelem scroll-column [ id title & contents ] [:div.scroll-column [:div.fixed title] [:div.scrollable { :id id :data-preserve-scroll "true" } contents]]) Note this (and Hiccup in general) heavily depends on Clojure array and hash literals. This wouldn't look as clean in a Lisp without those things.