Metadata-Version: 2.1
Name: jinja2-ext-path
Version: 0.2.0
Summary: Filters from `os.path` for jinja2
Author: Stephan Meijer
Author-email: me@stephanmeijer.com
Requires-Python: >=3.0,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: jinja2 (>=3.1.2,<4.0.0)
Description-Content-Type: text/markdown

# jinja2-ext-path

    $ pip install jinja2-ext-path

## Usage

See [Extensions - Adding Extensions](https://jinja.palletsprojects.com/en/3.0.x/extensions/#adding-extensions).

You would be able to use it like this:

```py
jinja_env = Environment(extensions=['jinja2_ext_path.basename', 'jinja2_ext_path.dirname'])
```

Or:

```py
jinja_env.add_extension('jinja2_ext_path.dirname')
```

Then you can render like this:

```py
jinja2_env.from_string("{{ '/home/user/test.txt'| dirname }}")
```

For further reference:

- [Python 3 — os.path](https://docs.python.org/3/library/os.path.html)
- [jinja2 — Template Designer Documentation - Filters](https://jinja.palletsprojects.com/en/3.1.x/templates/#filters)

**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](https://pre-commit.com/#installation).

## License

Licensed under **GNU General Public License** (Version 3, 29 June 2007).

See [LICENSE.md](LICENSE.md).
