++ed by:
HIDEAKIO EMAZEP HERNAN FUKAI CJFIELDS

29 PAUSE user(s)
16 non-PAUSE user(s).

藤 吾郎
and 1 contributors

NAME

Text::Xslate::Syntax::TTerse - An alternative syntax like Template-Toolkit 2

SYNOPSIS

    use Text::Xslate;
    my $tx = Text::Xslate->new(
        syntax => 'TTerse',
        string => 'Hello, [% dialect %] world!',
    );

    print $tx->render({ dialect => 'TTerse' });

DESCRIPTION

TTerse is a subset of the Template-Toolkit 2 syntax, using [% ... %] tags.

EXAMPLES

Variable access

Scalar access:

    [%  var %]
    [% $var %]

Field acces:

    [% var.0 %]
    [% var.field %]
    [% var.accessor %]

Variables may be HASH references, ARRAY references, or objects.

Loops

    [% FOREACH item IN arrayref %]
        * [% item %]
    [% END %]

Conditional statements

    [% IF expression %]
        This is true
    [% ELSE %]
        Tis is false
    [% END %]

    [% IF expression %]
        Case 1
    [% ELSIF expression %]
        Case 2
    [% ELSE %]
        Case 3
    [% END %]

Expressions

(TODO)

Functions and filters

Not supported.

Template inclusion

    [% INCLUDE "file.tt" %]
    [% INCLUDE $var %]

Template cascading

Not supported.

Macro blocks

Not supported.

SEE ALSO

Text::Xslate

Template::Toolkit

Template::Tiny