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

Template Source

[% if add_header fill site/header with title='Hello World' %] [% fill menu/item with link = item.link title = item.text.ucfirst for item in site.menu if add_menu %] --EOF--

Source Tokens

tag_start@0[%
whitespace@2
command if@4if
whitespace@6
variable@9add_header
whitespace@19\n
command fill@24fill
whitespace@28
filename@29site
filename@33/
filename@34header
whitespace@40\n
command with@45with
whitespace@49
variable@50title
operator assign@55=
squote string@56'Hello World'
whitespace@69\n
tag_end@70%]
text@72\n\n
tag_start@74[%
whitespace@76
command fill@78fill
whitespace@82
filename@83menu
filename@87/
filename@88item
whitespace@92\n
command with@97with
whitespace@101
variable@102link
whitespace@106
operator assign@108=
whitespace@109
variable@110item
operator dot@114.
word@115link
whitespace@119\n
variable@129title
whitespace@134
operator assign@135=
whitespace@136
variable@137item
operator dot@141.
word@142text
operator dot@146.
word@147ucfirst
whitespace@154\n
command for@159for
whitespace@162
variable@164item
whitespace@168
terminator@169in
whitespace@171
variable@172site
operator dot@176.
word@177menu
whitespace@181\n
command if@186if
whitespace@188
variable@191add_menu
whitespace@199\n
tag_end@200%]
text@202\n
eof@203

Parse Tree

with keyword@45with
Data
binary expr@55title = 'Hello World'
variable element@50title
=
squote string element@56'Hello World'
Block
if keyword@4if add_header { fill }
Test
variable element@9add_header
True
fill keyword@24fill
Template
filename element@29site/header
text@72\n\n
if keyword@186if add_menu { for }
Test
variable element@191add_menu
True
for keyword@159for
Item
variable element@164item
List
binary expr@176site.menu
variable element@172site
.
word element@177menu
Then
with keyword@97with
Data
binary expr@108link = item.link
variable element@102link
=
binary expr@114item.link
variable element@110item
.
word element@115link
binary expr@135title = item.text.ucfirst
variable element@129title
=
binary expr@146item.text.ucfirst
binary expr@141item.text
variable element@137item
.
word element@142text
.
word element@147ucfirst
Block
fill keyword@78fill
Template
filename element@83menu/item
text@202\n

Variables Used

add_header
Uses
@ line 1[% if add_header
add_menu
Uses
@ line 10 if add_menu
item
Uses
@ line 7 with link = item.link
@ line 8 title = item.text.ucfirst
@ line 9 for item in site.menu
Vars
link
Uses
@ line 7 with link = item.link
text
Uses
@ line 8 title = item.text.ucfirst
Vars
ucfirst
Uses
@ line 8 title = item.text.ucfirst
link
Uses
@ line 7 with link = item.link
site
Uses
@ line 9 for item in site.menu
Vars
menu
Uses
@ line 9 for item in site.menu
title
Uses
@ line 3 with title='Hello World'
@ line 8 title = item.text.ucfirst

Generated Output

TT3 undefined data error at line 1 of /home/abw/web/london/tt3/slides/examples/side_effect_multi.tt3:
Error: Undefined value returned by expression: add_header
Source: [% if add_header
^ here