templatel icon indicating copy to clipboard operation
templatel copied to clipboard

Jinja inspired template language for Emacs Lisp

#+CAPTION: CI Status #+NAME: CI [[https://github.com/clarete/templatel/workflows/CI/badge.svg]]

#+CAPTION: Melpa #+NAME: Melpa [[https://melpa.org/#/templatel][file:https://melpa.org/packages/templatel-badge.svg]]

  • templatel

    A modern templating language for Emacs-Lisp. Inspired on [[https://github.com/pallets/jinja/][Jinja]], /templatel/ brings a high level language for expanding variables with conditional and loop control flow structures.

** Documentation

  • Website: https://clarete.li/templatel
  • Documentation: https://clarete.li/templatel/doc
  • Code: https://github.com/clarete/templatel
  • Issues: https://github.com/clarete/templatel/issues

** How does it look like

#+begin_src jinja

{{ title }}

    {% for user in users %}
  • {{ user.name }}
  • {% endfor %}
#+end_src

That can be rendered with the following Emacs Lisp code:

#+begin_src emacs-lisp (templatel-render-file "tmpl.html.jinja" '(("title" . "A nice web page") ("users" . ((("url" . "https://clarete.li") ("name" . "link")) (("url" . "https://gnu.org") ("name" . "Gnu!!")))))) #+end_src

The rendered code would look like this:

#+begin_src html

A nice web page

#+end_src