Jinja2-TT2

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

### Loops

```jinja2
{% for item in items %}    →  [% FOREACH item IN items %]
{{ loop.index }}           →  [% loop.count %]
{{ loop.first }}           →  [% loop.first %]
{{ loop.last }}            →  [% loop.last %]
{% endfor %}               →  [% END %]
```

### Blocks and Macros

```jinja2
{% block content %}        →  [% BLOCK content %]
{% endblock %}             →  [% END %]

{% macro btn(text) %}      →  [% MACRO btn(text) BLOCK %]
{% endmacro %}             →  [% END %]
```

### Comments

bin/jinja2tt2  view on Meta::CPAN

=item * Filters (most common ones)

=item * for loops (including else clause)

=item * if/elif/else conditionals

=item * Blocks and inheritance (partial)

=item * Includes

=item * Macros

=item * Comments

=item * Whitespace control (-% tags)

=back

=head1 LIMITATIONS

=over 4

t/03-emitter.t  view on Meta::CPAN

};

subtest 'Set statement' => sub {
    is(
        transpile('{% set x = 42 %}'),
        '[% x = 42 %]',
        'Set variable'
    );
};

subtest 'Macro' => sub {
    my $result = transpile('{% macro greet(name) %}Hello {{ name }}{% endmacro %}');
    like($result, qr/MACRO greet\(name\) BLOCK/, 'Macro definition');
    like($result, qr/\[% name %\]/, 'Macro body');
};

subtest 'Whitespace control' => sub {
    like(transpile('{{- name -}}'), qr/\[%-.*-%\]/, 'Whitespace control markers');
};

subtest 'String concatenation' => sub {
    like(transpile('{{ a ~ b }}'), qr/\(a _ b\)/, 'Tilde becomes underscore');
};



( run in 1.487 second using v1.01-cache-2.11-cpan-483215c6ad5 )