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

Template Source

[? HTML_CMDS ul li a ?] [% ul for 'One Two Three'.split li "Example $item" %] --EOF--

Source Tokens

tag_start@0[?
whitespace@2
control htmlcmds@3HTML_CMDS
whitespace@12
variable@13ul
whitespace@15
variable@16li
whitespace@18
variable@19a
whitespace@20
tag_end@21?]
text@23\n\n
tag_start@25[%
whitespace@27
html ul@28ul
whitespace@30 \n
command for@37for
whitespace@40
squote string@41'One Two Three'
operator dot@56.
word@57split
whitespace@62\n
html li@71li
whitespace@73
dquote@74"Example $item"
whitespace@89 \n
tag_end@91%]
text@93\n
eof@94

Parse Tree

text@23\n\n
html keyword element@28ul
for keyword@37for
List
binary expr@56'One Two Three'.split
squote string element@41'One Two Three'
.
word element@57split
Then
html keyword element@71li
dquote string element@74"Example $item"
text@75Example
variable element@84item
text@93\n

Variables Used

item
Uses
@ line 5 li "Example $item"

Generated Output

<ul><li>Example One</li><li>Example Two</li><li>Example Three</li></ul>