TT3: /home/abw/web/london/tt3/slides/examples/order_items.tt3

Template Source

[% if order.items.size -%] <ul> [% for order.items -%] <li>[% item.quantity %] [% item.description %]</li> [% end -%] </ul> [% end -%] --EOF--

Source Tokens

tag_start@0[%
whitespace@2
command if@4if
whitespace@6
variable@7order
operator dot@12.
word@13items
operator dot@18.
word@19size
whitespace@23
tag_end@24-%]
whitespace@27\n
text@28<ul>\n
tag_start@33[%
whitespace@35
command for@41for
whitespace@44
variable@45order
operator dot@50.
word@51items
whitespace@56
tag_end@57-%]
whitespace@60\n
text@61 <li>
tag_start@67[%
whitespace@69
variable@70item
operator dot@74.
word@75quantity
whitespace@83
tag_end@84%]
text@86
tag_start@87[%
whitespace@89
variable@90item
operator dot@94.
word@95description
whitespace@106
tag_end@107%]
text@109</li>\n
tag_start@115[%
whitespace@117
end@123end
whitespace@126
tag_end@127-%]
whitespace@130\n
text@131</ul>\n
tag_start@137[%
whitespace@139
end@141end
whitespace@144
tag_end@145-%]
whitespace@148\n
eof@149

Parse Tree

if keyword@4if order.items.size { "<ul>\n"; for; "</ul>\n" }
Test
binary expr@18order.items.size
binary expr@12order.items
variable element@7order
.
word element@13items
.
word element@19size
True
text@28<ul>\n
for keyword@41for
List
binary expr@50order.items
variable element@45order
.
word element@51items
Then
text@61 <li>
binary expr@74item.quantity
variable element@70item
.
word element@75quantity
text@86
binary expr@94item.description
variable element@90item
.
word element@95description
text@109</li>\n
text@131</ul>\n

Variables Used

item
Uses
@ line 4 <li>[% item.quantity %] [% item.description %]</li>
@ line 4 <li>[% item.quantity %] [% item.description %]</li>
Vars
description
Uses
@ line 4 <li>[% item.quantity %] [% item.description %]</li>
quantity
Uses
@ line 4 <li>[% item.quantity %] [% item.description %]</li>
order
Uses
@ line 1[% if order.items.size -%]
@ line 3[% for order.items -%]
Vars
items
Uses
@ line 1[% if order.items.size -%]
@ line 3[% for order.items -%]
Vars
size
Uses
@ line 1[% if order.items.size -%]

Generated Output

TT3 undefined data error at line 1 of /home/abw/web/london/tt3/slides/examples/order_items.tt3:
Error: Undefined value in 'order.items': order
Source: [% if order.items.size -%]
^ here