Elements are build up as followed:
{{variablename}}
. They can be replaced with any text content. If you want to use it to add additional template elements the template has to be parsed twice.
The quick brown {{animal}} jumps over the lazy {{animal2}}.
To replace variables create a dictionary:
std::map<std::string, std::string=""> vars;
vars["animal"] = "fox";
vars["animal2"] = "dog";
##counterX##
) and the value of the vector (##valueX##
) at the counter.
The X hereby stands for the number of the loop nestings, beginning at 0.
This enables in an inner loop to access the current value of the outer one.
**pangramlist
##counter0##: ##value0##
**/
std::map<std::string, std::vector <std::string=""> > loop;
loop["pangramlist"] = std::vector();
loop["pangramlist"].push_back("Sphinx of black quartz judge my vow.");
loop["pangramlist"].push_back("A quick movement of the enemy will jeopardize six gunboats");
loop["pangramlist"].push_back("Five quacking Zephyrs jolt my wax bed.");
loop["pangramlist"].push_back("Heavy boxes perform waltzes and jigs.");
<<isPangram
Yes, it is.
||
No, it is not a pangram.
<</
std::map<std::string, bool> ifElse;
ifElse["isPangram"] = true;
>>pangram
||first
The five boxing wizards jump quickly.
||second
A quick movement of the enemy will jeopardize six gunboats.
||third
Sphinx of black quartz judge my vow.
||fourth
Five quacking Zephyrs jolt my wax bed.
||default
This is the default case which is chosen when nothing was set.
>>/
std::map<std::string, std::string=""> swith;
swith["pangram"] = "first";
##value1##
, 1 for the inner loop).
In this case, the outer loop contains the pangrams, while the inner loop just repeats the current loop pangram three times.
**pangramlist
**empty
##value0##
**/
<br>
**/
loop["empty"] = std::vector<std::string>();
loop["empty"].push_back("");
loop["empty"].push_back("");
loop["empty"].push_back("");
SimpleTemp::Template html("pangrams.tmpl", true);
html.SetIfElseDictionary(ifElse);
html.SetLoopDictionary(loop);
html.SetSwitchDictionary(swith);
html.SetVariableDictionary(vars);
html.CreateFile("pangrams.html");