Skip to content

Implement 'xmlattr' filter #143

Closed
Closed
@flexferrum

Description

@flexferrum

Implement 'xmlattr' filter according to the jinja2 specification:

Create an SGML/XML attribute string based on the items in a dict. All values that are neither none nor undefined are automatically escaped:

<ul{{ {'class': 'my_list', 'missing': none,
        'id': 'list-%d'|format(variable)}|xmlattr }}>
...
</ul>

Results in something like this:

<ul class="my_list" id="list-42">
...
</ul>

As you can see it automatically prepends a space in front of the item if the filter returned something unless the second parameter is false.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions