Implementation Notes
Differences / Implementation Notes
- named arguments (e.g.
|filter(param = value)
) are not supported. See #410 - currently twig.js does not have the same auto-escaping that Twig does.
Feature Support
Built-in Tags
Docs: Twig 3.x tags
Example syntax: {% tagName %}
apply
: ???autoescape
: ???block
: Supportedcache
: ???deprecated
: ???do
: ???embed
: Supportedextends
: Supportedflush
: N/Afor
: Supportedfrom
: Supportedif
: Supportedimport
: Supportedinclude
: Supportedmacro
: Supportedsandbox
: ???set
: Supporteduse
: Supportedverbatim
: Supportedwith
: Supported
Built-in Filters
Docs: Twig 3.x filters
Example syntax: {{ variable|filterName }}
abs
: Supportedbatch
: Supportedcapitalize
: Supportedcolumn
: ???convert_encoding
: N/Acountry_name
: ???currency_name
: ???currency_symbol
: ???data_uri
: ???date
: Supporteddate_modify
: Supporteddefault
: Supportedescape
: Supportedfilter
: Supportedfirst
: Supportedformat
: Supportedformat_currency
: ???format_date
: ???format_datetime
: ???format_number
: ???format_time
: ???html_to_markdown
: ???inky_to_html
: ???inline_css
: ???join
: Supportedjson_encode
: Supportedkeys
: Supportedlanguage_name
: ???last
: Supportedlength
: Supportedlocale_name
: ???lower
: Supportedmap
: ???markdown_to_html
: ???merge
: Supportednl2br
: Supportednumber_format
: Supportedraw
: ???replace
: Supportedreverse
: Supportedround
: Supportedslice
: Supportedsort
: Supportedspaceless
: Supportedsplit
: Supportedstriptags
: Supportedtimezone_name
: ???title
: Supportedtrim
: Supportedu
: ???upper
: Supportedurl_encode
: Supported
Built-in Functions
Docs: Twig 3.x functions
Example syntax: {{ functionName(arguments) }}
attribute
: ???block
: ???constant
: ???cycle
: ???date
: ???dump
: ???html_classes
: ???include
: Throws error: "include function does not exist and is not defined in the context" https://github.com/twigjs/twig.js/issues/392max
: ???min
: ???parent
: ???random
: ???range
: ???source
: ???country_timezones
: ???template_from_string
: ???
Built-in Tests
Docs: Twig 3.x tests
Example syntax: {{ expression is testName }}
constant
:defined
: Supporteddivisibleby
: Supportedempty
: Supportedeven
: Supportediterable
: Supportednull
/none
: Supportedodd
: Supportedsameas
: Supported
Built-in Operators
Docs: Twig 3.x operators
Example syntax: {{ expression operator expression }}
in
: Supportedis
: Supported- Math (
+
,-
,/
,%
,*
,**
): Supported - Logic (
and
,or
,not
,()
): Supported - Bitwise (
b-and
,b-or
,b-xor
): Supported - Comparisons (
==
,!=
,<
,>
,>=
,<=
,===
): Supported - Others (
..
,|
,~
,.
,[]
,?:
): Supported - Null-coalescing (
??
): Supported