Mercurial > hg > tema
changeset 23:55fe63bb7858
Fix error reporting.
author | Mikhail Kryshen <mikhail@kryshen.net> |
---|---|
date | Wed, 22 Apr 2009 03:30:59 +0400 |
parents | 1bd3a6740cfb |
children | 665309ccd5e6 584c2f18bb48 |
files | src/kryshen/tema/Tema.java src/kryshen/tema/TemplateParser.java src/kryshen/tema/functions/Control.java src/kryshen/tema/functions/IO.java |
diffstat | 4 files changed, 19 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/kryshen/tema/Tema.java Wed Apr 22 03:04:30 2009 +0400 +++ b/src/kryshen/tema/Tema.java Wed Apr 22 03:30:59 2009 +0400 @@ -74,11 +74,7 @@ throws IOException, SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException { - - boolean demo = false; - boolean version = false; - boolean help = false; - + Options options = new Options(); options.addOption(null, "demo", false, "demo mode");
--- a/src/kryshen/tema/TemplateParser.java Wed Apr 22 03:04:30 2009 +0400 +++ b/src/kryshen/tema/TemplateParser.java Wed Apr 22 03:30:59 2009 +0400 @@ -419,24 +419,28 @@ } public int invoke(String name, FunctionDataParser fdp, Writer out) - throws IOException, TemplateException { + throws IOException, TemplateException { + Object value = context.get(name); - + if (value instanceof Function) { return ((Function) value).invoke(fdp, out); } - + if (value instanceof Context) { String code = fdp.getData(); - - if (fdp.getLastReturnCode() == 0) + + if (fdp.getLastReturnCode() == 0) { return 0; - + } + TemplateParser parser = new TemplateParser((Context) value); return parser.parse( - new TemplateReader(new StringReader(code)), out); + new TemplateReader(new StringReader(code), + fdp.getTemplateReader()), + out); } - + return parseValue(value, out); }
--- a/src/kryshen/tema/functions/Control.java Wed Apr 22 03:04:30 2009 +0400 +++ b/src/kryshen/tema/functions/Control.java Wed Apr 22 03:30:59 2009 +0400 @@ -179,7 +179,10 @@ while (true) { StringWriter sw = new StringWriter(); - e = parser.parse(new TemplateReader(dataReader), sw); + e = parser.parse( + new TemplateReader(dataReader, + fdp.getTemplateReader()), + sw); if (e == 0) break;
--- a/src/kryshen/tema/functions/IO.java Wed Apr 22 03:04:30 2009 +0400 +++ b/src/kryshen/tema/functions/IO.java Wed Apr 22 03:30:59 2009 +0400 @@ -103,14 +103,14 @@ throws IOException, TemplateException { String filename = fdp.getData(); - String file; try { readFile(fdp.createFile(filename), out); } catch (IOException e) { fdp.warning(e.getMessage()); //System.err.println(e); - //throw new TemplateException(e.getMessage(), e, in); + //throw new TemplateException(e.getMessage(), e, + // fdp.getTemplateReader()); return 0; }