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

TITLE: foreach
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 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 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 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 $_
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 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>
 
