6 ms·
off topic: can anyone recommend good solution for text templating like https://handlebarsjs.com/ https://handlebarsjs.com/ with full power of common lisp? i hav
by newusertoday 6y ago
off topic: can anyone recommend good solution for text templating like https://handlebarsjs.com/ https://handlebarsjs.com/ with full power of common lisp? i have checked the one's mentioned in cliki https://www.cliki.net/templating%20library https://www.cliki.net/templating%20library .
- alaaalawi 6y agoJust curious. I went and skimmed through the handlebarsjs link. I'm used to cl-who and can not see what the js lib does have that is not possible or harder in cl-who. Side note: with a small macro you can start defining your own streamlined components and special tags. akin to having your abstractions. Also l'm taking a course in HTML5+CSS and use this additionally to avoid being drawned in the usual characteristic boilerplate text.
- newusertoday 6y agoI am actually using handlebars along with helpers https://github.com/helpers/handlebars-helpers https://github.com/helpers/handlebars-helpers to automatically generate sql, golang, json and jsx. cl-who is only for markup. What i found useful in handlebars is ability to define inline function templates and use them in template. I am missing cl macro's which would automate my workflow even more so asking if something like this is available in cl.
- WalterGR 6y agoJust curious. I went and skimmed through the handlebarsjs link. I'm used to cl-who and can not see what the js lib does have that is not possible or harder in cl-who. They are very different styles, though. With cl-who you write code that mimics the structure of HTML and that code outputs HTML. With Handlebars etc. you write your HTML in HTML and embed code in it. Some prefer one over the other.
- lokedhs 6y agoI wrote a templating library that was used for a Slack close we developed a number of years back. It parses the HTML with embedded code, and generates a Lisp function which is compiled on the fly thanks to Lisp giving runtime access to the compiler. Whenever the source file is changed, the code is regenerated and compiled. Other languages do the same, but in those cases they have to generate source code and call the compiler as an external program, and then load the generated code into the running program using dynamic linking. The Lisp approach is much more efficient. Thanks to the quality of SBCL, the templates execute with native performance, which is something very few other solutions do. The project is unfortunately not documented, but the code is available here: https://github.com/lokedhs/lofn https://github.com/lokedhs/lofn
- fmakunbound 6y agoYeah, I'd just be using templating in code using cl-who and whatnot. Text template languages like handlbars and are just not a popular choice in Lisp circles.
- WalterGR 6y ago(To save others the time googling, "whatnot" is not a Lisp templating library.) There's a third way, though: text templating libraries that support the full language. Does that exist for Common Lisp?
- fiddlerwoaroof 6y agoThere is a cl-mustache library: I end up just using spinneret for html and postmodern’ s-expression syntax for SQL
- joserr 6y agoHave you checked cl-emb? https://common-lisp.net/project/cl-emb/ https://common-lisp.net/project/cl-emb/