I made JSX for Lua
bvisness.me
bvisness.me
- Javascript / Typescript
- Lua (this)
- Go ( https://templ.guide )
- Ruby ( https://github.com/camertron/rux )
Any others?
For Ruby it's strange somebody would prefer to write JSX instead of something like dhtml [2] or [3], are there any other advantages of writing xml directly in the code instead of a small html DSL?
[1]: https://xelaso.net/blog/jsx-quasi-quoting/
[2]: https://github.com/hi5dev/dhtml
[3]: https://stackoverflow.com/questions/23469834/ruby-metaprogra...
As for preferring to write XML directly in my code…95% of my goal is to just deliver XML to the browser. I’d rather just write XML. And honestly the way text nodes are handled in other DSLs seems quite bad to me. I’d much rather write `long paragraph, <strong>emphasis,</strong> long paragraph` than HEREDOC-style long strings that I have to start and end every time I want some inline formatting.
All the examples I see of HTML DSLs are heavy on structure but conspicuously lacking text. For me the text is _the whole point_. I don’t want to worry about string escaping when writing a blog post.
I'm sure it was fun porting the Lua parser to Go and all but I wanted to let you know that Lua is very powerful on its own for making very nice DSLs, for example it can be used to make an HTML Builder DSL akin to JSX within the language itself (and by the way I think it's far more readable than JSX or XML) [2] and also some build tools use it as a base language [3]
[1]: https://lobste.rs/s/oubncm/i_made_jsx_for_lua_because_i_hate...