Skip to main content
A Library to Quickly Turn Functions into Jinja2 Extensions
==========================================================

This library is best demonstrated through example:

```python
import jinjatag

### Configure your Jinja2 Environment:
jinja_tag = jinjatag.JinjaTag()
jinja2_env = Environment(extensions=[jinja_tag])
jinja_tag.init()

### Decorate your functions

@jinjatag.simple_tag()
def mytag(foo, bar=None, **kwargs):
return "mytag: "+foo+(bar or '')+str(kwargs)

@jinjatag.simple_block()
def myblock(body, foo, bar=None):
return "myblock : "+body+foo+(bar or '')

```

Then, in your template code, use your new tags:

{% mytag foo='abc' xyz='def' %}

{% myblock foo='bar' %}contents{% endmyblock %}

The resulting output:

mytag: abc{'xyz':'def'}

myblock: contentsbar

That's really all there is to it. A simple_tag is expected to accept 0 or more arguments and return a string. A simple_block is expected to accept at least one argument which will be its rendered body.


Install
-------

The module is registered with pypi, so simply use:

easy_install jinjatag

or, if you're so inclined:

pip install jinjatag


Further Documentation
----------------------

More documentation is available at http://mankyd.github.com/jinjatag/

Also, tests are available in https://github.com/mankyd/jinjatag/tree/master/jinjatag/tests


License
--------

GPL v3

Authors
-------

Dave Mankoff
Mike Axiak

Download files

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

Source Distribution

jinjatag-0.1.5.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jinjatag-0.1.5-py2.7.egg (9.5 kB view details)

Uploaded Egg

File details

Details for the file jinjatag-0.1.5.tar.gz.

File metadata

  • Download URL: jinjatag-0.1.5.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jinjatag-0.1.5.tar.gz
Algorithm Hash digest
SHA256 0ed942f1b0c603c93ba4f764cfb07bb4f725246e8f5074c9dbfbed22334a1500
MD5 41cc547adb0f1e2fd8ef65dee29ae5ba
BLAKE2b-256 b7d894c41fc74e6d5cb5a1ac9eb99543c6e85f790b58426f0b98e8c377874a82

See more details on using hashes here.

File details

Details for the file jinjatag-0.1.5-py2.7.egg.

File metadata

  • Download URL: jinjatag-0.1.5-py2.7.egg
  • Upload date:
  • Size: 9.5 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jinjatag-0.1.5-py2.7.egg
Algorithm Hash digest
SHA256 8f73f35dc57ca28daeae8298c1db7591427b7b56fa7cbf888d24cf33a1b245fe
MD5 22fb8cc5dddd15a91f5b769ea048a903
BLAKE2b-256 a8112879690210d7d926f2ce150256cf0fae64e53cbc1d05925bcc538494f4e2

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.6

2 files

This release

0.1.5 This release

2 files

0.1.4

3 files

0.1.3

2 files

0.1.2

1 file

0.1.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page