Skip to content

Support overriding Jinja tags / functions / filters #255

@thibaudcolas

Description

@thibaudcolas

Is your proposal related to a problem?

Part of Jinja2 support plan #180. Version 1.5.0 ships with experimental Jinja support, missing the ability to override tags / functions / filters in particular.

Describe the solution you'd like

A setup similar to how Django Templates tags overrides work, with support for declaring overrides via YAML, or default values globally in Python. In Jinja it would make sense to also do this for functions, not just tags. And possibly filters while we’re at it (see also #114).

Describe alternatives you've considered

N/A

Additional context

I suspect this will require messing with the environment where we inject the custom context: https://github.com/torchbox/django-pattern-library/blob/main/pattern_library/loader_tags.py#L199. However I don’t have a good enough understanding of Jinja to know for sure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions