X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Foutput%2Ftemplate%2FTemplate.java;fp=src%2Forg%2Fcacert%2Fgigi%2Foutput%2Ftemplate%2FTemplate.java;h=cc56baf813b8e731c855c71cf0213de912f0651c;hp=1705159514c02846432da50e6e4da76569f41861;hb=7a9b55470434239a3dd260005932e9e6096a9921;hpb=0e926f650b13aba58cece09280ba24901e8fc61d diff --git a/src/org/cacert/gigi/output/template/Template.java b/src/org/cacert/gigi/output/template/Template.java index 17051595..cc56baf8 100644 --- a/src/org/cacert/gigi/output/template/Template.java +++ b/src/org/cacert/gigi/output/template/Template.java @@ -22,6 +22,9 @@ import org.cacert.gigi.output.DateSelector; import org.cacert.gigi.util.DayDate; import org.cacert.gigi.util.HTMLEncoder; +/** + * Represents a loaded template file. + */ public class Template implements Outputable { private static class ParseResult { @@ -63,6 +66,14 @@ public class Template implements Outputable { private static final Pattern ELSE_PATTERN = Pattern.compile(" ?\\} ?else ?\\{ ?"); + /** + * 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, + * {@link File#lastModified()} is monitored for changes of the template. + * + * @param u + * the URL to load the template from. UTF-8 is chosen as charset. + */ public Template(URL u) { try { Reader r = new InputStreamReader(u.openStream(), "UTF-8"); @@ -81,6 +92,13 @@ public class Template implements Outputable { } } + /** + * Creates a new template by parsing the contents from the given reader. + * This constructor will fail on syntax error. + * + * @param r + * the Reader containing the data. + */ public Template(Reader r) { try { data = parse(r).getBlock(null);