/** * There is actually a subtle but essential point in the code below. * A macro operates in the context in which it's defined. However, * a nested block within a macro instruction is defined in the * context in which the macro was invoked. So, we actually need to * temporarily switch the namespace and macro context back to * what it was before macro invocation to implement this properly. * I (JR) realized this thanks to some incisive comments from Daniel Dekany. */ @Override TemplateElement[] accept(Environment env) throws IOException, TemplateException { Context bodyContext = new Context(env); env.invokeNestedContent(bodyContext); return null; }
/** * There is actually a subtle but essential point in the code below. * A macro operates in the context in which it's defined. However, * a nested block within a macro instruction is defined in the * context in which the macro was invoked. So, we actually need to * temporarily switch the namespace and macro context back to * what it was before macro invocation to implement this properly. * I (JR) realized this thanks to some incisive comments from Daniel Dekany. */ @Override TemplateElement[] accept(Environment env) throws IOException, TemplateException { Context bodyContext = new Context(env); env.invokeNestedContent(bodyContext); return null; }
/** * There is actually a subtle but essential point in the code below. * A macro operates in the context in which it's defined. However, * a nested block within a macro instruction is defined in the * context in which the macro was invoked. So, we actually need to * temporarily switch the namespace and macro context back to * what it was before macro invocation to implement this properly. * I (JR) realized this thanks to some incisive comments from Daniel Dekany. */ @Override TemplateElement[] accept(Environment env) throws IOException, TemplateException { Context bodyContext = new Context(env); env.invokeNestedContent(bodyContext); return null; }