mirror of
https://github.com/pantor/inja.git
synced 2026-09-13 09:28:02 +00:00
retain scope when including a template (#118)
* apply documentation changes to single_include * retain scope when including a template * Use data from current scope when rendering an included template. This allows included templates to access loop variables, which was not possible before. * Add test
This commit is contained in:
@@ -454,7 +454,7 @@ class Renderer {
|
||||
break;
|
||||
}
|
||||
case Bytecode::Op::Include:
|
||||
Renderer(m_included_templates, m_callbacks).render_to(os, m_included_templates.find(get_imm(bc)->get_ref<const std::string&>())->second, data);
|
||||
Renderer(m_included_templates, m_callbacks).render_to(os, m_included_templates.find(get_imm(bc)->get_ref<const std::string&>())->second, *m_data);
|
||||
break;
|
||||
case Bytecode::Op::Callback: {
|
||||
auto callback = m_callbacks.find_callback(bc.str, bc.args);
|
||||
|
||||
Reference in New Issue
Block a user