Context(Environment env) throws TemplateException { invokingMacroContext = env.getCurrentMacroContext(); List bodyParameterNames = invokingMacroContext.nestedContentParameterNames; if (bodyParameters != null) { for (int i = 0; i < bodyParameters.size(); i++) { Expression exp = (Expression) bodyParameters.get(i); TemplateModel tm = exp.eval(env); if (bodyParameterNames != null && i < bodyParameterNames.size()) { String bodyParameterName = (String) bodyParameterNames.get(i); if (bodyVars == null) { bodyVars = env.new Namespace(); } bodyVars.put(bodyParameterName, tm); } } } }
public TemplateModel getLocalVariable(String name) throws TemplateModelException { return bodyVars == null ? null : bodyVars.get(name); }