werc/root/sites/werc.cat-v.org/docs/rc-template-lang.md
Sam Therapy c510a1b05c
template stuff
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2022-07-30 16:33:02 +02:00

993 B

The Rc Template Language

Implemented by Kris, thanks!

Basic syntax:

  • Lines starting with % are executed as rc commands, the resulting output is inserted in the document.
  • use %{ and %} to delimit multi line sections of rc code (note the lack of space between % and { or }!
  • To 'inline' the value of an environment variable use %($my_var%)

That is basically it!

For further documentation on rc see:

Examples

Loops

<ul>
% for(i in a b c) {
%   echo '<li>'$i'</li>'
% }
</uL>

Can also be writen as:

<ul>
%{
for(i in a b c) {
   echo '<li>'$i'</li>'
}
%}
</uL>

and is equivalent to:

<ul>
% for(i in a b c) {
<li>%($i%)</li>
% }
</uL>

All three code examples result in this output:

<ul>
<li>a</li>
<li>b</li>
<li>c</li>
</ul>