X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Fclub%2Fwpia%2Fgigi%2Foutput%2Ftemplate%2FTemplate.java;h=cb0bed02b0fd8019f18e1eddb01ca070505b539e;hp=454c0c5846d4b35df39bf62e44fa8566bc0a7840;hb=e7532e90c74f2fd2559c6afead1748b2f29edf8e;hpb=bccd4cc0dba0f89aa045b113bac46eb8cc1dab4e
diff --git a/src/club/wpia/gigi/output/template/Template.java b/src/club/wpia/gigi/output/template/Template.java
index 454c0c58..cb0bed02 100644
--- a/src/club/wpia/gigi/output/template/Template.java
+++ b/src/club/wpia/gigi/output/template/Template.java
@@ -73,6 +73,8 @@ public class Template implements Outputable {
private static final String UNKOWN_CONTROL_STRUCTURE_MSG = "Unknown control structure \"%s\", did you mean \"%s\"?";
+ public static final String UTC_TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
+
/**
* Creates a new template by parsing the contents from the given URL. This
* constructor will fail on syntax error. When the URL points to a file,
@@ -237,7 +239,7 @@ public class Template implements Outputable {
protected void tryReload() {
if (source != null && lastLoaded < source.lastModified()) {
System.out.println("Reloading template.... " + source);
- try (InputStreamReader r = new InputStreamReader(new FileInputStream(source), "UTF-8")) {
+ try (FileInputStream fis = new FileInputStream(source); InputStreamReader r = new InputStreamReader(fis, "UTF-8")) {
data = parse(r).getBlock(null);
r.close();
lastLoaded = source.lastModified() + 1000;
@@ -264,10 +266,14 @@ public class Template implements Outputable {
out.print(((Boolean) s) ? l.getTranslation("yes") : l.getTranslation("no"));
} else if (s instanceof Date) {
SimpleDateFormat sdfUI = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
- out.print("");
+ if (vars.containsKey(Outputable.OUT_KEY_PLAIN)) {
+ out.print(sdfUI.format(s));
+ } else {
+ SimpleDateFormat sdf = new SimpleDateFormat(UTC_TIMESTAMP_FORMAT);
+ out.print("");
+ }
} else {
out.print(s == null ? "null" : (unescaped ? s.toString() : HTMLEncoder.encodeHTML(s.toString())));
}
@@ -322,7 +328,7 @@ public class Template implements Outputable {
public void merge(ParseContext other) {
line = other.line;
column = other.column;
- parseException.append(other.parseException);
+ append(other);
}
public void append(ParseContext other) {