mirror of
https://github.com/pantor/inja.git
synced 2026-10-30 06:15:45 +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:
1 parent
b46d92a793
commit
057075b110
3 files changed
+39
-2
No files matched your search
@@ -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