]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/output/template/Template.java
Fix templating. Add language to IterableDataset.
[gigi.git] / src / org / cacert / gigi / output / template / Template.java
index 5a82cf7d81151799aa1c29e87a0997a756d62f25..b8dd7424c5248b9f1ca523988d488e9e9d8de637 100644 (file)
@@ -57,24 +57,23 @@ public class Template implements Outputable {
                LinkedList<String> splitted = new LinkedList<String>();
                LinkedList<Outputable> commands = new LinkedList<Outputable>();
                StringBuffer buf = new StringBuffer();
-               int ch = r.read();
                outer: while (true) {
                        while (!endsWith(buf, "<?")) {
+                               int ch = r.read();
                                if (ch == -1) {
                                        break outer;
                                }
                                buf.append((char) ch);
-                               ch = r.read();
                        }
                        buf.delete(buf.length() - 2, buf.length());
                        splitted.add(buf.toString());
                        buf.delete(0, buf.length());
                        while (!endsWith(buf, "?>")) {
-                               buf.append((char) ch);
-                               ch = r.read();
+                               int ch = r.read();
                                if (ch == -1) {
                                        throw new EOFException();
                                }
+                               buf.append((char) ch);
                        }
                        buf.delete(buf.length() - 2, buf.length());
                        String com = buf.toString().replace("\n", "");
@@ -138,7 +137,7 @@ public class Template implements Outputable {
                                try {
                                        System.out.println("Reloading template.... " + source);
                                        InputStreamReader r = new InputStreamReader(new FileInputStream(source), "UTF-8");
-                                       parse(r);
+                                       data = parse(r);
                                        r.close();
                                        lastLoaded = source.lastModified() + 1000;
                                } catch (IOException e) {