]> WPIA git - gigi.git/blob - src/org/cacert/gigi/output/template/OutputVariableCommand.java
fix: ResultSet.getDate is often wrong as it fetches day-precision times
[gigi.git] / src / org / cacert / gigi / output / template / OutputVariableCommand.java
1 package org.cacert.gigi.output.template;
2
3 import java.io.PrintWriter;
4 import java.util.Collection;
5 import java.util.Map;
6
7 import org.cacert.gigi.localisation.Language;
8
9 /**
10  * Emits a variable.
11  */
12 public final class OutputVariableCommand implements Translatable {
13
14     private final String raw;
15
16     private final boolean unescaped;
17
18     /**
19      * Creates a new OutputVariableCommand.
20      * 
21      * @param raw
22      *            the variable to emit. If starting with <code>!</code> the
23      *            variable is emitted non-HTML-escaped.
24      */
25     public OutputVariableCommand(String raw) {
26         if (raw.charAt(0) == '!') {
27             unescaped = true;
28             this.raw = raw.substring(1);
29         } else {
30             unescaped = false;
31             this.raw = raw;
32         }
33     }
34
35     @Override
36     public void output(PrintWriter out, Language l, Map<String, Object> vars) {
37         Template.outputVar(out, l, vars, raw, unescaped);
38     }
39
40     @Override
41     public void addTranslations(Collection<String> s) {}
42 }