Skip to content

TemplateJinjaFilters

ameharoo edited this page Aug 15, 2024 · 2 revisions

Here's the translated page:

Filters Available in Templates

EN RU

In addition to the standard Jinja filters, Mess adds its own filters specifically designed for working with messages.

💁 The filters are described and defined in filters.py.

The full list of filters is described in the table below:

Filter Description
wrap(value: str, left: str, right: str) Wraps value with the string left on the left and right on the right.
field_name(field: MessageField) -> str Returns the name of the field.
field_type(field: MessageField) -> str Returns the type of the message that the field belongs to, using the mangle_message method.
field_message(field: MessageField) -> Message Returns the message object that the field belongs to.
message_pure_type(message: Message) -> str Returns the name of the message.
message_type(message: Message) -> str Returns the type of the message using the mangle_message method.
message_docs(message: Message) -> str Returns the documentation (description) for the message.
message_var_fields(message: Message) -> list Returns a list of fields in the message that are variative (is_variative).
message_novar_fields(message: Message) -> list Returns a list of fields in the message that are not variative (not is_variative).
Clone this wiki locally