Python Forum
Hypertag. New language for HTML templating w/ Django support
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hypertag. New language for HTML templating w/ Django support
#1
Lightbulb 
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 &amp; 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:

from hypertag import HyperHTML
html = HyperHTML().render(script)
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 and Language Reference for more info. Install from PyPI as "hypertag-lang".
Gribouillis likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  HTML multi select HTML listbox with Flask/Python rfeyer 0 4,534 Mar-14-2021, 12:23 PM
Last Post: rfeyer
  Python3 + BeautifulSoup4 + lxml (HTML -> CSV) - How to loop to next HTML/new CSV Row BrandonKastning 0 2,329 Mar-22-2020, 06:10 AM
Last Post: BrandonKastning
  Why use HTML in Django Template ift38375 2 2,773 Dec-09-2019, 02:28 AM
Last Post: snippsat
  Posting html values to views/models in Django Malt 1 2,128 Sep-04-2019, 01:44 PM
Last Post: fishhook
  Django: How to automatically substitute a variable in the admin page at Django 1.11? m0ntecr1st0 3 3,246 Jun-30-2019, 12:21 AM
Last Post: scidam
  convert html to pdf in django site shahpy 4 5,979 Aug-17-2018, 11:10 AM
Last Post: Larz60+
  Execute using Html, Save data into Database and Download in CSV in Django --Part 1 Prince_Bhatia 0 3,799 Jan-19-2018, 06:05 AM
Last Post: Prince_Bhatia
  Django field model for HTML parser? Drone4four 0 4,117 Nov-15-2017, 02:43 AM
Last Post: Drone4four
  Django debug of templates and home.html Drone4four 1 3,088 Nov-12-2017, 11:13 AM
Last Post: Drone4four
  read text file using python and display its output to html using django amit 0 18,262 Jul-23-2017, 06:14 AM
Last Post: amit

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020