c_simple_http/example_config/example.config
Stephen Seo 20f413c8d9
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 37s
Impl. nested FOREACH expressions
IF/ELSEIF/ELSE/ENDIF and FOREACH/ENDFOREACH can now be nested in each
other in HTML templates.

TODO: Cleanup/refactorings, properly set up "files_map".
2024-11-20 16:12:58 +09:00

164 lines
3 KiB
Text

PATH=/
HTML='''
<html>
<head>
<style>
body {
color: #FFF;
background-color: #333;
}
a {
color: #AAF;
}
a:link {
color: #AAF;
}
a:visited {
color: #88B;
}
a:focus a:hover {
color: #DDF;
}
a:active {
color: #FFF;
}
</style>
</head>
<body>
<h2>Test IF/FOREACH Expr</h2>
Outer IF<br>
<pre>
{{{!IF ThisValue==true}}}
ThisValue is <b>true</b>.<br>
{{{!FOREACH ArrayValue}}}
{{{!IF ThisOtherValue==true}}}
{{{ArrayValue}}}<br>
ThisOtherValue is <b>true</b>.<br>
{{{Var}}}<br>
{{{!ELSE}}}
{{{ArrayValue}}}<br>
ThisOtherValue is <b>NOT true</b>.<br>
{{{Var}}}<br>
{{{!ENDIF}}}
{{{!ENDFOREACH}}}
{{{!ELSE}}}
ThisValue is <b>NOT true</b>.<br>
{{{!FOREACH ArrayValueSecond}}}
{{{!IF ThisOtherValue==true}}}
{{{ArrayValueSecond}}}<br>
ThisOtherValue is <b>true</b>.<br>
{{{Var}}}<br>
{{{!ELSE}}}
{{{ArrayValueSecond}}}<br>
ThisOtherValue is <b>NOT true</b>.<br>
{{{Var}}}<br>
{{{!ENDIF}}}
{{{!ENDFOREACH}}}
{{{!ENDIF}}}
</pre><br>
Outer FOREACH<br>
<pre>
{{{!FOREACH ArrayValue}}}
{{{ArrayValue}}}<br>
{{{!IF ThisValue==true}}}
ThisValue is <b>true</b>.<br>
{{{!FOREACH ArrayValueSecond}}}
{{{ArrayValueSecond}}}<br>
{{{!IF ThisOtherValue==true}}}
ThisOtherValue is <b>true</b>.<br>
{{{Var}}}<br>
{{{!ELSE}}}
ThisOtherValue is <b>NOT true</b>.<br>
{{{Var}}}<br>
{{{!ENDIF}}}
{{{!ENDFOREACH}}}
{{{!ELSE}}}
ThisValue is <b>NOT true</b>.<br>
{{{!FOREACH ArrayValueSecond}}}
{{{ArrayValueSecond}}}<br>
{{{!IF ThisOtherValue==true}}}
ThisOtherValue is <b>true</b>.<br>
{{{Var}}}<br>
{{{!ELSE}}}
ThisOtherValue is <b>NOT true</b>.<br>
{{{Var}}}<br>
{{{!ENDIF}}}
{{{!ENDFOREACH}}}
{{{!ENDIF}}}
{{{!ENDFOREACH}}}
</pre>
<br>
<a href="/inner">inner</a>
</body>
</html>
'''
Var='''Test var value'''
ThisValue=true
ThisOtherValue=true
ArrayValue=1_IDX_Zero
ArrayValue=1_IDX_One
ArrayValue=1_IDX_Two
ArrayValueSecond=2_IDX_Zero
ArrayValueSecond=2_IDX_One
ArrayValueSecond=2_IDX_Two
EachTestHead='''First Entry Head'''
EachTestMid='''First Entry Mid'''
EachTestTail='''First Entry Tail'''
EachTestHead='''Second Entry Head'''
EachTestMid='''Second Entry Mid'''
EachTestTail='''Second Entry Tail'''
EachTestHead='''Third Entry Head'''
EachTestMid='''Third Entry Mid'''
EachTestTail='''Third Entry Tail'''
PATH=/inner
HTML_FILE='''example_config/inner.html'''
VAR_FILE='''example_config/var.html'''
PATH=/error
PATH=/inner/further
HTML='''
<html>
<head>
<style>
body {
color: #FFF;
background-color: #333;
}
a {
color: #AAF;
}
a:link {
color: #AAF;
}
a:visited {
color: #88B;
}
a:focus a:hover {
color: #DDF;
}
a:active {
color: #FFF;
}
</style>
</head>
<body>
<h1>Nested inner: further<h1>
{{{VAR}}}
<br>
<img src="/silly.jpg" />
<br>
<a href="/inner">back</a>
</body>
</html>
'''
VAR='''yep'''