<h1>Tempcode tests</h1>

<h2>Escaping</h2>

<p>
	{$ESCAPE,'Hello',SQ_ESCAPED}
</p>
<p>
	{$ESCAPE,"Hello",DQ_ESCAPED}
</p>
<p>
	{$ESCAPE,Hello
 World,NL_ESCAPED}
</p>
<p>
	{$ESCAPE,Hello
 World,NL2_ESCAPED}
</p>
<p>
	{$ESCAPE,[html][/html],CC_ESCAPED}
</p>
<p>
	{$ESCAPE,foo=bar,UL_ESCAPED}
</p>
<!--
<p>
	{$ESCAPE,<strong>Test</strong>,JSHTML_ESCAPED}</strong>
</p>
-->
<h2>Environmental variables</h2>

<table class="map-table"><tbody>
	<tr>
		<th>$MOBILE</th>
		<td>{$MOBILE}</td>
	</tr>
</tbody></table>

<h2>Computational variables</h2>

<table class="map-table"><tbody>
	<tr>
		<th>$CYCLE,my_cycle,1,2</th>
		<td>{$CYCLE,my_cycle,1,2}</td>
	</tr>
	<tr>
		<th>$CYCLE,my_cycle,1,2</th>
		<td>{$CYCLE,my_cycle,1,2}</td>
	</tr>
	<tr>
		<th>$CYCLE,my_cycle,1,2</th>
		<td>{$CYCLE,my_cycle,1,2}</td>
	</tr>
	<tr>
		<th>$FROM_TIMESTAMP*,Y-m-d,33424322</th>
		<td>{$FROM_TIMESTAMP*,Y-m-d,33424322}</td>
	</tr>
	<tr>
		<th>$IS_NON_EMPTY,</th>
		<td>{$IS_NON_EMPTY,}</td>
	</tr>
	<tr>
		<th>$IS_NON_EMPTY,a</th>
		<td>{$IS_NON_EMPTY,a}</td>
	</tr>
	<tr>
		<th>$IS_EMPTY,</th>
		<td>{$IS_EMPTY,}</td>
	</tr>
	<tr>
		<th>$IS_EMPTY,a</th>
		<td>{$IS_EMPTY,a}</td>
	</tr>
	<tr>
		<th>$NEGATE,3</th>
		<td>{$NEGATE,3}</td>
	</tr>
	<tr>
		<th>$OBFUSCATE,chris@example.com (check HTML source to see if it is obfuscated)</th>
		<td>{$OBFUSCATE,chris@example.com}</td>
	</tr>
	<tr>
		<th>$GET,foobar</th>
		<td>{$GET,foobar}</td>
	</tr>
</tbody></table>

<h2>Array variables</h2>

<table class="map-table"><tbody>
	<tr>
		<th>+START,COUNT,SIMPLE_ARRAY+END</th>
		<td>{+START,COUNT,SIMPLE_ARRAY}{+END}</td>
	</tr>
	<tr>
		<th>+START,IMPLODE, ,SIMPLE_ARRAY+END</th>
		<td>{+START,IMPLODE, ,SIMPLE_ARRAY}{+END}</td>
	</tr>
	<tr>
		<th>+START,OF,SIMPLE_ARRAY,1+END</th>
		<td>{+START,OF,SIMPLE_ARRAY,1}{+END}</td>
	</tr>
</tbody></table>

<h2>String variables</h2>

<table class="map-table"><tbody>
	<tr>
		<th>$WCASE,I am a Mushroom</th>
		<td>{$WCASE,I am a Mushroom}</td>
	</tr>
	<tr>
		<th>$LCASE,I am a Mushroom</th>
		<td>{$LCASE,I am a Mushroom}</td>
	</tr>
	<tr>
		<th>$UCASE,I am a Mushroom</th>
		<td>{$UCASE,I am a Mushroom}</td>
	</tr>
	<tr>
		<th>$REPLACE,a,b,apple</th>
		<td>{$REPLACE,a,b,apple}</td>
	</tr>
	<tr>
		<th>$AT,apple,3</th>
		<td>{$AT,apple,3}</td>
	</tr>
	<tr>
		<th>$SUBSTR,apple,1,2</th>
		<td>{$SUBSTR,apple,1,2}</td>
	</tr>
	<tr>
		<th>$LENGTH,apple</th>
		<td>{$LENGTH,apple}</td>
	</tr>
	<tr>
		<th>$WORDWRAP,i love to eat cheese,5</th>
		<td>{$WORDWRAP,i love to eat cheese,5}</td>
	</tr>
	<tr>
		<th>$TRUNCATE_LEFT,i love to eat cheese,5</th>
		<td>{$TRUNCATE_LEFT,i love to eat cheese,5}</td>
	</tr>
	<tr>
		<th>$TRUNCATE_RIGHT,i love to eat cheese,5</th>
		<td>{$TRUNCATE_RIGHT,i love to eat cheese,5}</td>
	</tr>
	<tr>
		<th>$TRUNCATE_SPREAD,i love to eat cheese,5</th>
		<td>{$TRUNCATE_SPREAD,i love to eat cheese,5}</td>
	</tr>
	<tr>
		<th>$ESCAPE,Bill &amp; Julie,ENTITY_ESCAPED</th>
		<td>{$ESCAPE,Bill & Julie,ENTITY_ESCAPED}</td>
	</tr>
</tbody></table>

<h2>Arithmetical variables</h2>

<table class="map-table"><tbody>
	<tr>
		<th>$MULT,2,3</th>
		<td>{$MULT,2,3}</td>
	</tr>
	<tr>
		<th>$ROUND,3.23,1</th>
		<td>{$ROUND,3.23,1}</td>
	</tr>
	<tr>
		<th>$ROUND,3.29,1</th>
		<td>{$ROUND,3.29,1}</td>
	</tr>
	<tr>
		<th>$ROUND,36.66,0</th>
		<td>{$ROUND,36.66,0}</td>
	</tr>
	<tr>
		<th>$MAX,3,2</th>
		<td>{$MAX,3,2}</td>
	</tr>
	<tr>
		<th>$MIN,3,2</th>
		<td>{$MIN,3,2}</td>
	</tr>
	<tr>
		<th>$MOD,-2</th>
		<td>{$MOD,-2}</td>
	</tr>
	<tr>
		<th>$MOD,2</th>
		<td>{$MOD,2}</td>
	</tr>
	<tr>
		<th>$REM,3,2</th>
		<td>{$REM,3,2}</td>
	</tr>
	<tr>
		<th>$DIV,7,2</th>
		<td>{$DIV,7,2}</td>
	</tr>
	<tr>
		<th>$SUBTRACT,3,2</th>
		<td>{$SUBTRACT,3,2}</td>
	</tr>
	<tr>
		<th>$ADD,3,2</th>
		<td>{$ADD,3,2}</td>
	</tr>
</tbody></table>

<h2>Logical variables</h2>

<table class="map-table"><tbody>
	<tr>
		<th>$NOT,1</th>
		<td>{$NOT,1}</td>
	</tr>
	<tr>
		<th>$OR,1,0</th>
		<td>{$OR,1,0}</td>
	</tr>
	<tr>
		<th>$OR,0,0</th>
		<td>{$OR,0,0}</td>
	</tr>
	<tr>
		<th>$AND,1,0</th>
		<td>{$AND,1,0}</td>
	</tr>
	<tr>
		<th>$AND,1,1</th>
		<td>{$AND,1,1}</td>
	</tr>
	<tr>
		<th>$EQ,3,3</th>
		<td>{$EQ,3,3}</td>
	</tr>
	<tr>
		<th>$EQ,3,2</th>
		<td>{$EQ,3,2}</td>
	</tr>
	<tr>
		<th>$NEQ,3,3</th>
		<td>{$NEQ,3,3}</td>
	</tr>
	<tr>
		<th>$NEQ,3,2</th>
		<td>{$NEQ,3,2}</td>
	</tr>
	<tr>
		<th>$LT,1,2</th>
		<td>{$LT,1,2}</td>
	</tr>
	<tr>
		<th>$LT,2,1</th>
		<td>{$LT,2,1}</td>
	</tr>
	<tr>
		<th>$GT,1,2</th>
		<td>{$GT,1,2}</td>
	</tr>
	<tr>
		<th>$GT,2,1</th>
		<td>{$GT,2,1}</td>
	</tr>
</tbody></table>

<h2>Variable variables</h2>

<table class="map-table"><tbody>
	<tr>
		<th>$ISSET,test</th>
		<td>{$ISSET,test}</td>
	</tr>
	<tr>
		<th>$INIT,test,2</th>
		<td>{$INIT,test,2}</td>
	</tr>
	<tr>
		<th>$GET,test</th>
		<td>{$GET,test}</td>
	</tr>
	<tr>
		<th>$INIT,test,3</th>
		<td>{$INIT,test,3}</td>
	</tr>
	<tr>
		<th>$GET,test</th>
		<td>{$GET,test}</td>
	</tr>
	<tr>
		<th>$SET,test,3</th>
		<td>{$SET,test,3}</td>
	</tr>
	<tr>
		<th>$GET,test</th>
		<td>{$GET,test}</td>
	</tr>
	<tr>
		<th>$INC,test</th>
		<td>{$INC,test}</td>
	</tr>
	<tr>
		<th>$GET,test</th>
		<td>{$GET,test}</td>
	</tr>
	<tr>
		<th>$DEC,test</th>
		<td>{$DEC,test}</td>
	</tr>
	<tr>
		<th>$GET,test</th>
		<td>{$GET,test}</td>
	</tr>
	<tr>
		<th>$ISSET,test</th>
		<td>{$ISSET,test}</td>
	</tr>
</tbody></table>

<p>
	Putting #anchor onto URL should cause jump to here.{$ANCHOR,anchor}
</p>

<h2>Directives</h2>

{+START,IF_PASSED,PASSED}
	<p>
		IF_PASSED true positive (good)
	</p>
{+END}
{+START,IF_PASSED,PASSED_FAKE}
	<p>
		IF_PASSED false positive (bad)
	</p>
{+END}
{+START,IF_NON_PASSED,PASSED}
	<p>
		IF_PASSED false negative (bad)
	</p>
{+END}
{+START,IF_NON_PASSED,PASSED_FAKE}
	<p>
		IF_PASSED true negative (good)
	</p>
{+END}

{+START,IF_EMPTY,{EMPTY1}}
	<p>
		IF_EMPTY true positive (string) (good)
	</p>
{+END}
{+START,IF_EMPTY,{PASSED}}
	<p>
		IF_EMPTY false positive (string) (bad)
	</p>
{+END}
{+START,IF_NON_EMPTY,{EMPTY2}}
	<p>
		IF_EMPTY true negative (tempcode) (bad)
	</p>
{+END}
{+START,IF_NON_EMPTY,{NONEMPTY}}
	<p>
		IF_EMPTY false negative (tempcode) (good)
	</p>
{+END}

{+START,SET,foo}bar{+END}{$GET,foo}

{+START,IF,1}
	<p>
		IF true positive (good)
	</p>
{+END}
{+START,IF,0}
	<p>
		IF false positive (bad)
	</p>
{+END}

\{$BASE_URL}

{+START,IF,{$IN_STR,x,<a }}
{+END}

{+START,SET,foobar}
	Move contents towards end of first template showing.
{+END}

{$INIT,i,0}
{+START,WHILE,{$NEQ,{$GET,i},3}}
	<p>
		Should see this text 3 times.
{$INC,i}
	</p>
{+END}

<table class="layout-table"><tbody>
{+START,LOOP,ARRAY,2,<tr>,</tr>,A,DESC}
	<td>Blah</td>
	<td>
		{a} {b} {c}
	</td>
{+END}
</tbody></table>
