@Override public void executeTemplate (Template tmpl, Writer out) { tmpl.executeSegs(currentCtx, out); } @Override public Object context () {
@Override public void execute (Template tmpl, Template.Context ctx, Writer out) { // we must take care to preserve our context rather than creating a new one, which // would happen if we just called execute() with ctx.data getTemplate().executeSegs(ctx, out); } @Override public void decompile (Delims delims, StringBuilder into) {
/** * Executes this template with the given context, writing the results to the supplied writer. * @throws MustacheException if an error occurs while executing or writing the template. */ public void execute (Object context, Writer out) throws MustacheException { executeSegs(new Context(context, null, 0, false, false), out); }
/** * Executes this template with the supplied context and parent context, writing the results to * the supplied writer. The parent context will be searched for variables that cannot be found * in the main context, in the same way the main context becomes a parent context when entering * a block. * @throws MustacheException if an error occurs while executing or writing the template. */ public void execute (Object context, Object parentContext, Writer out) throws MustacheException { Context pctx = new Context(parentContext, null, 0, false, false); executeSegs(new Context(context, pctx, 0, false, false), out); }
@Override public void executeTemplate (Template tmpl, Writer out) { tmpl.executeSegs(currentCtx, out); } @Override public Object context () {
/** * Executes this template with the given context, writing the results to the supplied writer. * @throws MustacheException if an error occurs while executing or writing the template. */ public void execute (Object context, Writer out) throws MustacheException { executeSegs(new Context(context, null, 0, false, false), out); }
/** * Executes this template with the supplied context and parent context, writing the results to * the supplied writer. The parent context will be searched for variables that cannot be found * in the main context, in the same way the main context becomes a parent context when entering * a block. * @throws MustacheException if an error occurs while executing or writing the template. */ public void execute (Object context, Object parentContext, Writer out) throws MustacheException { Context pctx = new Context(parentContext, null, 0, false, false); executeSegs(new Context(context, pctx, 0, false, false), out); }
@Override public void execute (Template tmpl, Template.Context ctx, Writer out) { // we compile our template lazily to avoid infinie recursion if a template includes // itself (see issue #13) if (_template == null) { Reader tin = null; try { tin = _comp.loader.getTemplate(_name); _template = _comp.compile(tin); } catch (Exception e) { if (e instanceof RuntimeException) { throw (RuntimeException)e; } else { throw new MustacheException("Unable to load template: " + _name, e); } } finally { if (tin != null) try { tin.close(); } catch (IOException ioe) { throw new RuntimeException(ioe); } } } // we must take care to preserve our context rather than creating a new one, which // would happen if we just called execute() with ctx.data _template.executeSegs(ctx, out); } @Override public void decompile (Delims delims, StringBuilder into) {