From 2284a6ea89d3bd34476222e939a688a90e333635 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felix=20D=C3=B6rre?= Date: Mon, 14 Jul 2014 19:53:04 +0200 Subject: [PATCH] Enlargen the variety of use cases for the Template if statement. --- doc/TemplateSyntax.txt | 2 +- src/org/cacert/gigi/output/template/IfStatement.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/TemplateSyntax.txt b/doc/TemplateSyntax.txt index 2c6d8a02..40dff59c 100644 --- a/doc/TemplateSyntax.txt +++ b/doc/TemplateSyntax.txt @@ -10,7 +10,7 @@ A template is constructed from a charstream. Everything that is not in " - 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. - If $variable is an "IterableDataset" diff --git a/src/org/cacert/gigi/output/template/IfStatement.java b/src/org/cacert/gigi/output/template/IfStatement.java index 02687630..970cdfd9 100644 --- a/src/org/cacert/gigi/output/template/IfStatement.java +++ b/src/org/cacert/gigi/output/template/IfStatement.java @@ -18,7 +18,7 @@ final class IfStatement implements Outputable { @Override public void output(PrintWriter out, Language l, Map vars) { Object o = vars.get(variable); - if (o instanceof Boolean && o == Boolean.TRUE) { + if (!(o == Boolean.FALSE || o == null)) { body.output(out, l, vars); } } -- 2.39.2