Filters from `os.path` for jinja2
Project description
jinja2-ext-path
$ pip install jinja2-ext-path
Usage
See Extensions - Adding Extensions.
You would be able to use it like this:
jinja_env = Environment(extensions=['jinja2_ext_path.basename', 'jinja2_ext_path.dirname'])
Or:
jinja_env.add_extension('jinja2_ext_path.dirname')
Then you can render like this:
jinja2_env.from_string("{{ '/home/user/test.txt'| dirname }}")
For further reference:
Please note: currently methods os.path.dirname
and os.path.basename
are included. Feel free to put in a PR.
Installation
$ pip install jinja2-ext-path
Development
This project uses pre-commit.
License
Licensed under GNU General Public License (Version 3, 29 June 2007).
See LICENSE.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jinja2_ext_path-0.2.0.tar.gz
(1.6 kB
view details)
Built Distribution
File details
Details for the file jinja2_ext_path-0.2.0.tar.gz
.
File metadata
- Download URL: jinja2_ext_path-0.2.0.tar.gz
- Upload date:
- Size: 1.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c861912730189ca83bb8eb47ce12d766f93435350a2969aa6a31ea7e981617e0 |
|
MD5 | e014159115f5fef03ed46ef12d6cde2a |
|
BLAKE2b-256 | 4fa1c2a6cf5c4d2e2f4eec7d89f28cb32e93d80bb0f156d93aae3b3515d42717 |
File details
Details for the file jinja2_ext_path-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: jinja2_ext_path-0.2.0-py3-none-any.whl
- Upload date:
- Size: 2.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3173f666845673f7493449c5f2b0b3417d67365e57d1267df69ad28cc7bd34d1 |
|
MD5 | 5cb583555f18954ef44b116c2e6fa4fb |
|
BLAKE2b-256 | d9965b0603088a8be83f9e65fb491c55b72a55b7d0919322ecc540baf3c941eb |