]> 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 08f261afce3dc64c9c07d2e42d90544a2fa56b3c..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", "");