Skip to content

clarete/templatel

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

https://github.com/clarete/templatel/workflows/CI/badge.svg

https://melpa.org/packages/templatel-badge.svg

templatel

A modern templating language for Emacs-Lisp. Inspired on Jinja, templatel brings a high level language for expanding variables with conditional and loop control flow structures.

Documentation

How does it look like

<h1>{{ title }}</h1>
<ul>
  {% for user in users %}
    <li><a href="{{ user.url }}">{{ user.name }}</a></li>
  {% endfor %}
</ul>

That can be rendered with the following Emacs Lisp code:

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

The rendered code would look like this:

<h1>A nice web page</h1>
<ul>
  <li><a href="https://clarete.li">link</a></li>
  <li><a href="https://gnu.org">Gnu!!</a></li>
</ul>