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:
Tom
2019-09-14 11:35:06 +02:00
committed by pantor
parent b46d92a793
commit 057075b110
3 changed files with 39 additions and 2 deletions
+1 -1
View File
@@ -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);