]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/output/template/Template.java
upd: move my Listing to WOT pages ( + testCase)
[gigi.git] / src / org / cacert / gigi / output / template / Template.java
index d49df9ae2c5a4c8600a0f48e631b1ed9caf91f0b..2a2bba6a4329b9146d4742ae6078bcbf66247334 100644 (file)
@@ -9,12 +9,14 @@ import java.io.PrintWriter;
 import java.io.Reader;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.util.Date;
 import java.util.LinkedList;
 import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.cacert.gigi.localisation.Language;
+import org.cacert.gigi.output.DateSelector;
 import org.cacert.gigi.util.HTMLEncoder;
 
 public class Template implements Outputable {
@@ -54,7 +56,7 @@ public class Template implements Outputable {
 
     private File source;
 
-    private static final Pattern CONTROL_PATTERN = Pattern.compile(" ?([a-z]+)\\(\\$([^)]+)\\) ?\\{ ?");
+    private static final Pattern CONTROL_PATTERN = Pattern.compile(" ?([a-zA-Z]+)\\(\\$([^)]+)\\) ?\\{ ?");
 
     private static final Pattern ELSE_PATTERN = Pattern.compile(" ?\\} ?else ?\\{ ?");
 
@@ -187,6 +189,8 @@ public class Template implements Outputable {
         }
         if (s instanceof Outputable) {
             ((Outputable) s).output(out, l, vars);
+        } else if (s instanceof Date) {
+            out.print(DateSelector.getDateFormat().format(s));
         } else {
             out.print(s == null ? "null" : (unescaped ? s.toString() : HTMLEncoder.encodeHTML(s.toString())));
         }