TT3: /home/abw/web/london/tt3/slides/examples/order_items.tt3
Source
Tokens
Tree
Variables
Output
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
@4
if
whitespace
@6
variable
@7
order
operator dot
@12
.
word
@13
items
operator dot
@18
.
word
@19
size
whitespace
@23
tag_end
@24
-%]
whitespace
@27
\n
text
@28
<ul>\n
tag_start
@33
[%
whitespace
@35
command for
@41
for
whitespace
@44
variable
@45
order
operator dot
@50
.
word
@51
items
whitespace
@56
tag_end
@57
-%]
whitespace
@60
\n
text
@61
<li>
tag_start
@67
[%
whitespace
@69
variable
@70
item
operator dot
@74
.
word
@75
quantity
whitespace
@83
tag_end
@84
%]
text
@86
tag_start
@87
[%
whitespace
@89
variable
@90
item
operator dot
@94
.
word
@95
description
whitespace
@106
tag_end
@107
%]
text
@109
</li>\n
tag_start
@115
[%
whitespace
@117
end
@123
end
whitespace
@126
tag_end
@127
-%]
whitespace
@130
\n
text
@131
</ul>\n
tag_start
@137
[%
whitespace
@139
end
@141
end
whitespace
@144
tag_end
@145
-%]
whitespace
@148
\n
eof
@149
Parse Tree
if keyword
@4
if order.items.size { "<ul>\n"; for; "</ul>\n" }
Test
binary expr
@18
order.items.size
binary expr
@12
order.items
variable element
@7
order
.
word element
@13
items
.
word element
@19
size
True
text
@28
<ul>\n
for keyword
@41
for
List
binary expr
@50
order.items
variable element
@45
order
.
word element
@51
items
Then
text
@61
<li>
binary expr
@74
item.quantity
variable element
@70
item
.
word element
@75
quantity
text
@86
binary expr
@94
item.description
variable element
@90
item
.
word element
@95
description
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