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,
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;
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("<time datetime=\"" + sdf.format(s) + "\">");
- out.print(sdfUI.format(s));
- out.print(" UTC</time>");
+ if (vars.containsKey(Outputable.OUT_KEY_PLAIN)) {
+ out.print(sdfUI.format(s));
+ } else {
+ SimpleDateFormat sdf = new SimpleDateFormat(UTC_TIMESTAMP_FORMAT);
+ out.print("<time datetime=\"" + sdf.format(s) + "\">");
+ out.print(sdfUI.format(s));
+ out.print(" UTC</time>");
+ }
} else {
out.print(s == null ? "null" : (unescaped ? s.toString() : HTMLEncoder.encodeHTML(s.toString())));
}
public void merge(ParseContext other) {
line = other.line;
column = other.column;
- parseException.append(other.parseException);
+ append(other);
}
public void append(ParseContext other) {