Hi,
A new language for document generation and HTML templating has been released. Inspired by indentation-based template languages (Slim, Haml, Shpaml), Hypertag (http://hypertag.io/) provides clean, readable syntax, and adds plenty of new features: native custom tags, DOM manipulation, Python-like imports, control blocks, expressions, and more. Multiple elements were carried over from the Python’s syntax to ensure ease of use. An example Hypertag script:
ul
li | Cat
li | Dog
li | Rabbit & Guinea pig
is rendered to:
<ul>
<li>Cat</li>
<li>Dog</li>
<li>Rabbit & Guinea pig</li>
</ul>
The example below contains a control block (for
), chained tags (a
, b
, i
) and an attribute (href
):
h1 | Table of Contents
div
for k in [1,2,3]:
a href='#heading-{k}' : b : i | Heading no. $k
and is rendered to:
<h1>Table of Contents</h1>
<div>
<a href="#heading-1"><b><i>Heading no. 1</i></b></a>
<a href="#heading-2"><b><i>Heading no. 2</i></b></a>
<a href="#heading-3"><b><i>Heading no. 3</i></b></a>
</div>
Hypertag can be called directly from Python code, or be plugged as a template backend into Django. Hypertag scripts can use all of Django’s filter functions.
Hypertag is a full-featured standalone language that is not limited to HTML alone and can generate different markups. See the Quick Start for more info. Install from PyPI as “hypertag-lang”.