[% DEFAULT chars = 30; # optional var IF str.length > chars; %] [% str | truncate(chars) | html %] [% ELSE; str | html; END; %]