jinja2-indent


Namejinja2-indent JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryA Jinja2 extension for managing indentation in templates.
upload_time2024-12-17 14:09:36
maintainerMihail Mishakin
docs_urlNone
authorMihail Mishakin
requires_python<4.0,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # jinja2-indent

This Jinja2 extension adjusts the indentation of block content to a specified width.

[![PyPI](https://img.shields.io/pypi/v/jinja2-indent.svg)](https://pypi.org/project/jinja2-indent/)
[![Build Status](https://github.com/dldevinc/jinja2-indent/actions/workflows/tests.yml/badge.svg)](https://github.com/dldevinc/jinja2-indent)
[![Software license](https://img.shields.io/pypi/l/jinja2-indent.svg)](https://pypi.org/project/jinja2-indent/)

## Compatibility

-   `python` >= 3.9

## Installation

Install the latest release with pip:

```shell
pip install jinja2-indent
```

## Usage

The `{% indent %}` tag provided by this extension allows you to adjust the indentation level of the content inside the tag block. You can specify the desired width (in spaces), and the extension will reformat the content accordingly. This is particularly useful for aligning nested or indented structures in templates.

### Example

The following example demonstrates how to increase the indentation of a block of text:

```jinja2
root:
{% indent 2 %}
- name: a
  value: 1

- name: b
  value: 2

- name: c
  value: 3
{% endindent %}
```

```
root:
  - name: a
    value: 1

  - name: b
    value: 2

  - name: c
    value: 3
```

The following example demonstrates how to remove unnecessary indentation from a block of text:

```jinja2
- name: a
  value: 1

{% indent 0 %}
  - name: b
    value: 2
{% endindent %}

- name: c
  value: 3
```

```
- name: a
  value: 1

- name: b
  value: 2

- name: c
  value: 3
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "jinja2-indent",
    "maintainer": "Mihail Mishakin",
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": "x896321475@gmail.com",
    "keywords": null,
    "author": "Mihail Mishakin",
    "author_email": "x896321475@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/86/c2/3dc5ff71d68f5456ee63be2daa90642fc25450b4b88aabf673b83bd69013/jinja2_indent-0.3.0.tar.gz",
    "platform": null,
    "description": "# jinja2-indent\n\nThis Jinja2 extension adjusts the indentation of block content to a specified width.\n\n[![PyPI](https://img.shields.io/pypi/v/jinja2-indent.svg)](https://pypi.org/project/jinja2-indent/)\n[![Build Status](https://github.com/dldevinc/jinja2-indent/actions/workflows/tests.yml/badge.svg)](https://github.com/dldevinc/jinja2-indent)\n[![Software license](https://img.shields.io/pypi/l/jinja2-indent.svg)](https://pypi.org/project/jinja2-indent/)\n\n## Compatibility\n\n-   `python` >= 3.9\n\n## Installation\n\nInstall the latest release with pip:\n\n```shell\npip install jinja2-indent\n```\n\n## Usage\n\nThe `{% indent %}` tag provided by this extension allows you to adjust the indentation level of the content inside the tag block. You can specify the desired width (in spaces), and the extension will reformat the content accordingly. This is particularly useful for aligning nested or indented structures in templates.\n\n### Example\n\nThe following example demonstrates how to increase the indentation of a block of text:\n\n```jinja2\nroot:\n{% indent 2 %}\n- name: a\n  value: 1\n\n- name: b\n  value: 2\n\n- name: c\n  value: 3\n{% endindent %}\n```\n\n```\nroot:\n  - name: a\n    value: 1\n\n  - name: b\n    value: 2\n\n  - name: c\n    value: 3\n```\n\nThe following example demonstrates how to remove unnecessary indentation from a block of text:\n\n```jinja2\n- name: a\n  value: 1\n\n{% indent 0 %}\n  - name: b\n    value: 2\n{% endindent %}\n\n- name: c\n  value: 3\n```\n\n```\n- name: a\n  value: 1\n\n- name: b\n  value: 2\n\n- name: c\n  value: 3\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Jinja2 extension for managing indentation in templates.",
    "version": "0.3.0",
    "project_urls": {
        "repository": "https://github.com/dldevinc/jinja2-indent"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "49223624a10c64a5ba59b5d882e7f08819e02b2f3f2953ffa6de7030978be760",
                "md5": "95daa5b7ae3423f59827b761afe0e86f",
                "sha256": "cbc140b02a8d019ccab44a25f2062352ef369685e89a5a0d1ca3c14b95474f69"
            },
            "downloads": -1,
            "filename": "jinja2_indent-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "95daa5b7ae3423f59827b761afe0e86f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 4356,
            "upload_time": "2024-12-17T14:09:34",
            "upload_time_iso_8601": "2024-12-17T14:09:34.224285Z",
            "url": "https://files.pythonhosted.org/packages/49/22/3624a10c64a5ba59b5d882e7f08819e02b2f3f2953ffa6de7030978be760/jinja2_indent-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "86c23dc5ff71d68f5456ee63be2daa90642fc25450b4b88aabf673b83bd69013",
                "md5": "0b608c643a90de0d71d8981f3a722249",
                "sha256": "b803171d17f26fbb6a541749d15d2946c049ee5489ac771af7659953c45c69a3"
            },
            "downloads": -1,
            "filename": "jinja2_indent-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0b608c643a90de0d71d8981f3a722249",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 4100,
            "upload_time": "2024-12-17T14:09:36",
            "upload_time_iso_8601": "2024-12-17T14:09:36.240252Z",
            "url": "https://files.pythonhosted.org/packages/86/c2/3dc5ff71d68f5456ee63be2daa90642fc25450b4b88aabf673b83bd69013/jinja2_indent-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-17 14:09:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dldevinc",
    "github_project": "jinja2-indent",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "jinja2-indent"
}
        
Elapsed time: 1.17842s