Jinja2 (Feature set)

2025-01-01

The engine is not fully conformant to the jinja2 specification. However, there is enough for most use-cases. If you would like to support more features, please submit them upstream, at which point we can include those changes.

Supported Jinja2 features

  • filters: sort, default, first, last, length, max, min, reverse, unique, sum, attr, map, reject, rejectattr, select, selectattr, pprint, dictsort, abs, float, int, list, round, random, trim, title, upper, wordcount, replace, truncate, groupby, urlencode, capitalize, escape, tojson, striptags, center, xmlattr
  • testers: eq, defined, ge, gt, iterable, le, lt, mapping, ne, number, sequence, string, undefined, in, even, odd, lower, upper
  • functions: range, loop.cycle
  • 'if' statement (with 'elif' and 'else' branches)
  • 'for' statement (with 'else' branch and 'if' part support)
  • 'include' statement (from the Godot resource system)
  • 'import'/'from' statements
  • 'set' statement (both line and block)
  • 'filter' statement
  • 'extends'/'block' statements
  • 'macro'/'call' statements
  • 'with' statement
  • 'do' extension statement
  • recursive loops
  • space control and 'raw'/'endraw' blocks

Supported Godot types

The following Godot types can be passed to the render function:

  • String
  • Dictionary
  • Array
  • Int
  • Float
  • Bool
  • Nil
  • Vector2
  • Vector2i
  • Vector3
  • Vector3i
  • Vector4
  • Vector4i
  • Color

More information