Show HN: Polly: A templating language for Rust
gitlab.com
gitlab.com
Prefer logic-less functions to output html strings? Hiccup has this use case covered. This is all stock Clojure[script], not a templating language:
(def foo [:h2 "something cool"])
(hiccup.core/html foo) ;;=> "<h2>something cool</h2>"
Plus there's plenty of ways to quickly build up a bootstrap (, etc) page. (defn bootstrap-page [hiccup-form]
(hiccup.page/html5
(hiccup.page/include-js "link-to-jquery.js"
"link-to-bootstrap.js")
(hiccup.page/include-css "link-to-bootstrap.css")
hiccup-form))
BTW, there are some interactive examples at http://hiccup.space my $rows= list(list(1,2,3), list(4,5,6));
HTML(BODY(TABLE($rows->map(fun($row) { TR($row->map(*TD)) }))))->string
# => '<html><body><table><tr><td>1</td><td>2</td><td>3</td></tr><tr><td>4</td><td>5</td><td>6</td></tr></table></body></html>'
ref HTML()
# => 'PXML::PXHTML';
[1] http://functional-perl.org/Also here's a quick list of some other CL-WHO alternatives - http://stackoverflow.com/questions/671572/cl-who-like-html-t...
HTML syntax has its problems, but when you work with the web, you have to know it anyways. Why would I want to deal with yet another syntax? It also means that as a user of the templating system you have to hope that the system can deal with all the quirks that HTML has (e.g., <br> in HTML 4, <br/> in XHTML and both in HTML 5).
It would be interesting so see an FAQ that explains where the advantages are over other templating solutions like Handlebars.
Also, it wasn't clear to me from looking at https://gitlab.com/Polly-lang/Polly/blob/master/GUIDE.md#var... how I would actually write, say, an email addressing including an "@" symbol (I'm sure it's possible, just not documented there).
There are already at least two programming languages named Polly and a third one Poly.
Just search for the desired name + "programming language".
A Function's logic, isn't defined in Polly. You have to define it in Rust. This moves all the logic to your Rust server, where your logic should be. It also provides the advantage of being compiled, and optimised with the program, rather than if Polly defined it's own syntax for functions, and logic, and trying to parse that out at run-time.