Skip to main content

Haml-ish syntax for jinja2 templates

Project description

Overview

This extension to jinja makes it possible to use a haml-ish syntax for your jinja templates. It is implemented as a preprocessor and so it runs only the first time your template is parsed. So it will not affect the performance of your templates except for the first run.

Forked from Pitmairen/hamlish-jinja

Usage

Install

You can install the latest version with pip

pip install git+https://git.barkshark.xyz/barkshark/hamlish-jinja

or

pip install jinja2-haml

Basic Usage

To use this extension you just need to add it to you jinja environment and use “.haml”, “.jhaml”, or “.jaml” as an extension for your templates.

from jinja2 import Environment
from hamlish_jinja import HamlishExtension

env = Environment(extensions = [HamlishExtension])

Environment

Added in version 0.2.0

The environment gets extended with a new method hamlish_from_string which works the same as the standard env.from_string method, but renders the template with the hamlish preprocessor.

tpl = '''
%div
    %p
        test
'''

env.hamlish_from_string(tpl).render()

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

Jinja2-Haml-0.3.5.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

Jinja2_Haml-0.3.5-py2.py3-none-any.whl (16.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file Jinja2-Haml-0.3.5.tar.gz.

File metadata

  • Download URL: Jinja2-Haml-0.3.5.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for Jinja2-Haml-0.3.5.tar.gz
Algorithm Hash digest
SHA256 c4aa29cef0d67146fedb3be145aad79746ef8957363d434efe4cebfca78d373e
MD5 2adac7bb85d70b83bb9021536f4f25a0
BLAKE2b-256 fb92e86160db90a7bd085ec80057733f4c5f68899c273ffb40176fd6d6709cfe

See more details on using hashes here.

File details

Details for the file Jinja2_Haml-0.3.5-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for Jinja2_Haml-0.3.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 81bba88d1aeb63f0016b972a6b031b97b501e09594c5585ad71cb834c1f70552
MD5 10a7400db30184b62e51335b3b7bef37
BLAKE2b-256 adda999785dc51cdf13f2c22e224a0958c2adc4d1bcbbb3f03898e0f008316cb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page