]> WPIA git - gigi.git/commitdiff
Enlargen the variety of use cases for the Template if statement.
authorFelix Dörre <felix@dogcraft.de>
Mon, 14 Jul 2014 17:53:04 +0000 (19:53 +0200)
committerFelix Dörre <felix@dogcraft.de>
Mon, 14 Jul 2014 17:53:04 +0000 (19:53 +0200)
doc/TemplateSyntax.txt
src/org/cacert/gigi/output/template/IfStatement.java

index 2c6d8a0265d0e61eeca4820d6cb7b2012ac5fff2..40dff59cf7ac770ec26caaeef28b6fcbe0e81735 100644 (file)
@@ -10,7 +10,7 @@ A template is constructed from a charstream. Everything that is not in "<?" to "
   Translate the last string. Output $var1,...,$varn replaced into the %s positions in the translated string.
   
 - <? if($variable) { ?>
-  Output/execute the text until "<? } ?>" only if $variable is boolean and true.
+  Output/execute the text until "<? } ?>" only if $variable not null or Boolean.FALSE.
   
 - <? foreach($variable) { ?>
   If $variable is an "IterableDataset"
index 02687630b8ab84757944ddae45c1103927b92905..970cdfd96d0e6dfbb5e67771d0efefa10079eb8a 100644 (file)
@@ -18,7 +18,7 @@ final class IfStatement implements Outputable {
        @Override
        public void output(PrintWriter out, Language l, Map<String, Object> vars) {
                Object o = vars.get(variable);
-               if (o instanceof Boolean && o == Boolean.TRUE) {
+               if (!(o == Boolean.FALSE || o == null)) {
                        body.output(out, l, vars);
                }
        }