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:
- Advanced control of rendering process with native control blocks (if, for, while, try).
- High level of modularity thanks to Python-like imports and explicit context specification.
- Unprecedented support for code reuse with native custom tags.
- Native DOM representation and DOM manipulation during rendering.
- Embedded compound expressions.
- All Python operators to manipulate arbitrary Python objects.
- Custom pipeline operator (
:) for chaining multiple functions as filters. - Expression qualifiers (
!?) to create alternative paths of calculation and handle edge cases easily. - Built-in tags for HTML5 generation and for general purposes.
- Integrated Python built-ins.
- Integrated Django filters.
- Django connector.
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.
Release files for hypertag-lang 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hypertag-lang-1.2.0.tar.gz | 98.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hypertag_lang-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 192.1 kB
Release files / hypertag-lang-1.2.0.tar.gz
| Download URL | hypertag-lang-1.2.0.tar.gz |
|---|---|
| Size | 98.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d213c8936d11d453ebf62916d6727fa8c372c2a66e4be3d7ae1a52cabade4fd6
|
|
BLAKE2b-256 checksum How to use checksums |
2b286a768ec544d42d858bfad0b8005a09c616604d87d2f04a623d13f9134775
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.10
|
Release files / hypertag_lang-1.2.0-py3-none-any.whl
| Download URL | hypertag_lang-1.2.0-py3-none-any.whl |
|---|---|
| Size | 94.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
72ca12d988cb7328ac9bae728ff0f02bcc0f737ade0257451cd6be8cf132edec
|
|
BLAKE2b-256 checksum How to use checksums |
437ad67c39b6884bb01a3b9419c00801310720fe535f54f6f99ec70949017c36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.10
|