Skip to main content

Modern language for markup generation with Python-like concise syntax, custom tags & Django integration. HTML templates reinvented.

Project description

Hypertag is a modern language for front-end development that allows writing markup documents in a way similar to writing Python scripts, where indentation determines relationships between nested elements and removes the need for explicit closing tags. Hypertag provides:

More information:

Setup

Install:

pip install hypertag-lang               # watch out the name, it is "hypertag-lang"

Usage:

from hypertag import HyperHTML
html = HyperHTML().render(script)       # rendering of a Hypertag `script` to HTML

Why to use Hypertag

  • Concise syntax: inspired by Python, the indentation-based syntax is a lot cleaner, more readable and maintainable than raw markup; it requires less typing, is less redundant, and lets you concentrate on coding rather than chasing unmatched opening-closing tags.
  • Code reuse by means of functions/classes is the corner stone of programming, yet it is missing from HTML; this is fixed now with Hypertag: programmers can create reusable components in a form of custom tags (hypertags), defined either as Python functions (external tags) or directly in a document using Hypertag syntax (native tags); hypertags can be parameterized and may represent complex pieces of combined: content, style and layout - for a reuse across documents.
  • Fine-grained control over rendering process is possible with a range of native control blocks (for, while, if-elif-else, try-else) constituting a core part of Hypertag syntax, unlike in templating languages, where control structures are artificially overlaid on top of another language (HTML).
  • Modularity in Hypertag is modeled after Python's: every script may import tags and variables from other scripts, from Python modules, and from the dynamic context of script rendering; scripts and modules are arranged into packages; with these mechanisms in place, building libraries of reusable components is easy and fun.
  • Applicability to different target languages. Hypertag is not just a templating system put on top of HTML. Hypertag is a full-featured standalone programming language tailored to the generation of documents of all kinds. By defining new tags, Hypertag can be adapted to produce an arbitrary document description language.

Acknowledgements

Hypertag was partially modeled on Python's syntax, and was inspired by indentation-based templating languages: Slim, Plim, Shpaml, Haml.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hypertag-lang-1.2.0.tar.gz (98.1 kB view hashes)

Uploaded source

Built Distribution

hypertag_lang-1.2.0-py3-none-any.whl (94.0 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page