# -*- coding: utf-8 -*-

TITLE: foreach my=i "1..3"
IN:
 <ul>
 <yatt:foreach my=i "1..3"><li>&yatt:i;</li>
 </yatt:foreach></ul>
PARAM[
[
- 1
- 2
- 3
]
]
OUT:
 <ul>
 <li>1</li>
 <li>2</li>
 <li>3</li>
 </ul>


TITLE: foreach my=i list=x pass through
IN:
 <!yatt:args x=list>
 <ul>
 <yatt:foreach my=i list=x><li>&yatt:i;</li>
 </yatt:foreach></ul>
PARAM[
[
- 1
- 2
- 3
]
]
OUT:
 <ul>
 <li>1</li>
 <li>2</li>
 <li>3</li>
 </ul>


TITLE: foreach my=i list pass through
IN:
 <!yatt:args list=list>
 <ul>
 <yatt:foreach my=i list><li>&yatt:i;</li>
 </yatt:foreach></ul>
PARAM[
[
- 1
- 2
- 3
]
]
OUT:
 <ul>
 <li>1</li>
 <li>2</li>
 <li>3</li>
 </ul>


TITLE: foreach my=i list pass through, type mismatch.
IN:
 <!yatt:args x>
 <ul>
 <yatt:foreach my=i list=x><li>&yatt:i;</li>
 </yatt:foreach></ul>
ERROR: ^yatt:foreach - x should be list type

TITLE: foreach my=i list pass through, unknown variable.
IN:
 <ul>
 <yatt:foreach my=i list=x><li>&yatt:i;</li>
 </yatt:foreach></ul>
ERROR: ^Unknown variable for foreach list: 'x'

TITLE: foreach $_
IN:
 <!yatt:args list=list>
 <ul>
 <yatt:foreach list><li>&yatt:_;</li>
 </yatt:foreach></ul>
PARAM[
[
- 1
- 2
- 3
]
]
OUT:
 <ul>
 <li>1</li>
 <li>2</li>
 <li>3</li>
 </ul>


TITLE: foreach my=val nth=i
IN:
 <!yatt:args list=list>
 <yatt:foreach my=val nth=i list><li>&yatt:i; = &yatt:val;</li>
 </yatt:foreach>
PARAM[
[
- a
- b1
- b2
- c
]
]
OUT:
 <li>1 = a</li>
 <li>2 = b1</li>
 <li>3 = b2</li>
 <li>4 = c</li>
 

TITLE: foreach varname=typename nth=i list
IN:
 <!yatt:args list=list>
 <yatt:foreach val=text nth=i list><li>&yatt:i; = &yatt:val;</li>
 </yatt:foreach>
PARAM[
[
- a
- b1
- b2
- c
]
]
OUT:
 <li>1 = a</li>
 <li>2 = b1</li>
 <li>3 = b2</li>
 <li>4 = c</li>
 

TITLE: foreach varname:typename nth=i list
IN:
 <!yatt:args list=list>
 <yatt:foreach val:text nth=i list><li>&yatt:i; = &yatt:val;</li>
 </yatt:foreach>
PARAM[
[
- a
- b1
- b2
- c
]
]
OUT:
 <li>1 = a</li>
 <li>2 = b1</li>
 <li>3 = b2</li>
 <li>4 = c</li>
 

TITLE: foreach varname nth=i list
IN:
 <!yatt:args list=list>
 <yatt:foreach val nth=i list><li>&yatt:i; = &yatt:val;</li>
 </yatt:foreach>
PARAM[
[
- a
- b1
- b2
- c
]
]
OUT:
 <li>1 = a</li>
 <li>2 = b1</li>
 <li>3 = b2</li>
 <li>4 = c</li>
 
