jinja2yaml


Namejinja2yaml JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://github.com/vd2org/jinja2yaml
SummaryYamlLoader for jinja2
upload_time2024-02-26 11:51:58
maintainer
docs_urlNone
author
requires_python<3.13,>=3.8
licenseCopyright 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.
keywords jinja2 jinja2-template jinja2-extention jinja2yaml yaml template
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 jinja2yaml
```

#### 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!
``` 

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/vd2org/jinja2yaml",
    "name": "jinja2yaml",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "<3.13,>=3.8",
    "maintainer_email": "",
    "keywords": "jinja2 jinja2-template jinja2-extention jinja2yaml yaml template",
    "author": "",
    "author_email": "vd <jinja2yaml@vd2.org>",
    "download_url": "https://files.pythonhosted.org/packages/1d/6f/91dc9d063ab307db617a5e81678556e0002edf7fdca9be706217bc343d49/jinja2yaml-0.1.5.tar.gz",
    "platform": null,
    "description": "# jinja2loader\n\nYamlLoader is a template loader for jinja2 template framework.\nIt loads templates from yaml-files. Useful when you need to\nstore many small templates in one file.\n\n## Install\n\n```bash\npip install jinja2yaml\n```\n\n#### Usage:\n\n```yaml\n# templates.yaml\nhome:\n  welcome: |\n    Welcome, {{username}}!\n  goodbye: |\n    Goodbye, {{username}}!\n```\n\n```python\n# main.py\nfrom jinja2 import Environment\nfrom jinja2yaml import YamlLoader\n\njinja = Environment(loader=YamlLoader('templates.yaml'))\n\nusername = 'John Doe'\ntemplate1 = jinja.get_template('home/welcome')\nrendered1 = template1.render(username=username)\nprint(rendered1)  # Welcome, John Doe!\n\ntemplate2 = jinja.get_template('home/goodbye')\nrendered2 = template2.render(username=username)\nprint(rendered2)  # Goodbye, John Doe!\n``` \n",
    "bugtrack_url": null,
    "license": "Copyright 2017-2024 Vd <jinja2yaml@vd2.org>\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy of\n        this software and associated documentation files (the \"Software\"), to deal in\n        the Software without restriction, including without limitation the rights to\n        use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n        the Software, and to permit persons to whom the Software is furnished to do so,\n        subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n        FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n        COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n        IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n        CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "YamlLoader for jinja2",
    "version": "0.1.5",
    "project_urls": {
        "Homepage": "https://github.com/vd2org/jinja2yaml",
        "Issues": "https://github.com/vd2org/jinja2yaml/issues",
        "Repository": "https://github.com/vd2org/jinja2yaml.git"
    },
    "split_keywords": [
        "jinja2",
        "jinja2-template",
        "jinja2-extention",
        "jinja2yaml",
        "yaml",
        "template"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "438b3139918991303d185c6177cb176feaf05f013f8f302623c1ca1dcba51d0f",
                "md5": "28d705505a8febd976541d822e95776e",
                "sha256": "269adea3d0c709099dedbc8fffe8f9e988896640dcc6a3282fb1782be3039963"
            },
            "downloads": -1,
            "filename": "jinja2yaml-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "28d705505a8febd976541d822e95776e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.8",
            "size": 4224,
            "upload_time": "2024-02-26T11:51:57",
            "upload_time_iso_8601": "2024-02-26T11:51:57.214624Z",
            "url": "https://files.pythonhosted.org/packages/43/8b/3139918991303d185c6177cb176feaf05f013f8f302623c1ca1dcba51d0f/jinja2yaml-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d6f91dc9d063ab307db617a5e81678556e0002edf7fdca9be706217bc343d49",
                "md5": "6c72a4ba5776c43c93ddbc85b14ed42a",
                "sha256": "9d0047524a19967c5d81054d092da0a4edae2208bfd881bab1dee551532d6833"
            },
            "downloads": -1,
            "filename": "jinja2yaml-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "6c72a4ba5776c43c93ddbc85b14ed42a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.8",
            "size": 3369,
            "upload_time": "2024-02-26T11:51:58",
            "upload_time_iso_8601": "2024-02-26T11:51:58.722400Z",
            "url": "https://files.pythonhosted.org/packages/1d/6f/91dc9d063ab307db617a5e81678556e0002edf7fdca9be706217bc343d49/jinja2yaml-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-26 11:51:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "vd2org",
    "github_project": "jinja2yaml",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "jinja2yaml"
}
        
Elapsed time: 0.19091s