]> WPIA git - gigi.git/blobdiff - doc/TemplateSyntax.txt
upd: move logout button to toplevel
[gigi.git] / doc / TemplateSyntax.txt
index 2ed1e546074493495a2012a4fced4118ea3d2cde..ad8e09ae170f0e9f82326af1f60b06199f37f890 100644 (file)
@@ -1,23 +1,26 @@
 A template is constructed from a charstream. Everything that is not in "<?" to "?>" will be outputted directly. Text in these markers will be interpreted is template scripting syntax. The following strings are valid:
 
-- <?=$variblename?> will output "variablename".
+General remarks:
+- $variablename: a variablename matches the regex [a-zA-Z0-9_-]
+Syntax:
+- <?=$variablename?> will output "variablename".
    if "variablename" is an Outputable output this thing recursively.
    else turn it into a String (Object.toString()) and output it.
+
+- <?=$!variablename?> will output the variable "variablename" but not HTML-escaped
    
 - <?=_This is free Text.?> will translate "This is free Text." into the users language, (escaped) and output it.
-   
-- <?=s,$var1,$var2,$var3,...,$varn,This %s is, %s free.?>
-  Translate the last string. Output $var1,...,$varn replaced into the %s positions in the translated string.
+       Text may not contain "?>".
+       If the text contains "$" or "!'" it is interpreted as "advanced replacement".
+          - ${variablename} is interpreted as "output this variable at this point"
+          - !'literal content' output "literal content" here and do not translate or escape. (literal content may not contain any of: {}'$   )
+       Then the whole text than also may not contain "{" and "}".
 
-- <?=$!variablename?> will output the variable "variablename" but not HTML-escaped
-- <?=s,$!variablename,My %s text?> will insert the variable "variablename" into the translated text but not HTML-escaped
-- <?=s,"some data",My %s text?> will insert "some data" into the translated text
-- <?=s,!"some data",My %s text?> will insert "some data" into the translated text literally (not HTML-escaped)
-  
-- <? if($variable) { ?>
-  Output/execute the text until "<? } ?>" only if $variable not null or Boolean.FALSE.
-  
-- <? foreach($variable) { ?>
+- <? if($variable) { ?> ... <? } ?>
+  Output/execute the text until "<? } ?>" only if $variable is Boolean.TRUE (<=> !Boolean.FALSE) or not null. 
+- <? if(...) { ?> ... <? } else { ?> ... <? } ?>
+
+- <? foreach($variable) { ?> ... <? } ?>
   If $variable is an "IterableDataset"
   Output/execute the text until "<? } ?>" repeated as $variable suggests. 
   Special variables that $variable defines can be used in the inner text.