Tyxml has a ppx which allows to type regular HTML and get tyxml elements out. I have been working on-and-off on a templating version which allows to type in templated HTML and get a statically typed function that returns tyxml elements. Additionally, a tool tyxml_template
could transform a file foo.html
into a function Foo.make
that takes an argument for each hole in the template and returns a tyxml element. The goal here is not to superseed tyxml combinators but instead to let designers design without having to learn OCaml before importing their work into the typed OCaml world.
The first prototype used mustache. However, mustache is a limited language, and some people expressed the wish to have a something more powerful. My only constraint is that I prefer something standard, to avoid imposing a whole new template language on people.
So, I would like to spark a discussion and collect preferences of the wider community of (potential) tyxml users. So far, I see the following choices:
-
mustache
Good: Simple. Standard. Very solid implementation thanks to recent work by @Armael.
Bad: Simple. -
handlebars.js
Good: Standard. The web programming community seem to like it.
Bad: No OCaml implementation yet. The language is very rich. Providing an implementation of sufficient quality would be a non-trivial effort. -
Jinja templates with the OCaml implementation, Jingoo
Good: Seem popular and close to Django templates. The OCaml implementation look solid.
Bad: The language look very rich, although more reasonable than handlebars. - Something non-standard such as snabela.
Good: Easier to adapt the template language to our need.
Bad: Not standard.
Thoughts, propositions ?