Metadata-Version: 2.1
Name: jinja2yaml
Version: 0.1.4
Summary: YamlLoader for jinja2
Keywords: jinja2 jinja2-template jinja2-extention jinja2yaml yaml template
Home-page: https://github.com/vd2org/jinja2yaml
Author-Email: vd <jinja2yaml@vd2.org>
License: Copyright 2017-2024 Vd <jinja2yaml@vd2.org>
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of
        this software and associated documentation files (the "Software"), to deal in
        the Software without restriction, including without limitation the rights to
        use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
        the Software, and to permit persons to whom the Software is furnished to do so,
        subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
        FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
        COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
        IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
        CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: User Interfaces
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Project-URL: Homepage, https://github.com/vd2org/jinja2yaml
Project-URL: Repository, https://github.com/vd2org/jinja2yaml.git
Project-URL: Issues, https://github.com/vd2org/jinja2yaml/issues
Requires-Python: <3.13,>=3.8
Requires-Dist: jinja2~=3.1.3
Requires-Dist: pyyaml~=6.0.1
Description-Content-Type: text/markdown

# jinja2loader

YamlLoader is a template loader for jinja2 template framework.
It loads templates from yaml-files. Useful when you need to
store many small templates in one file.

## Install

```bash
pip install j2tools
```

#### Usage:

```yaml
# templates.yaml
home:
  welcome: |
    Welcome, {{username}}!
  goodbye: |
    Goodbye, {{username}}!
```

```python
# main.py
from jinja2 import Environment
from jinja2yaml import YamlLoader

jinja = Environment(loader=YamlLoader('templates.yaml'))

username = 'John Doe'
template1 = jinja.get_template('home/welcome')
rendered1 = template1.render(username=username)
print(rendered1)  # Welcome, John Doe!

template2 = jinja.get_template('home/goodbye')
rendered2 = template2.render(username=username)
print(rendered2)  # Goodbye, John Doe!
``` 
