I did it backwards, I needed to use the explicit context from the block, not the inline partial.

This commit is contained in:
Tom Alexander
2020-05-25 19:22:20 -04:00
parent 6845df7f96
commit 25eb9b10a0
3 changed files with 20 additions and 56 deletions

View File

@@ -343,27 +343,21 @@ impl<'a> DustRenderer<'a> {
return Ok("".to_owned());
}
DustTag::DTBlock(named_block) => {
let new_breadcrumbs = blocks
.blocks
.get_explicit_context(named_block.name)
.map(|explicit_context| {
Self::new_breadcrumbs(
breadcrumbs,
blocks.breadcrumbs,
None,
explicit_context,
None,
)
})
.flatten();
let new_breadcrumbs = Self::new_breadcrumbs(
breadcrumbs,
blocks.breadcrumbs,
None,
&named_block.explicit_context,
None,
);
return match blocks.blocks.get_block(named_block.name) {
None => self.render_maybe_body(
&named_block.contents,
new_breadcrumbs.as_ref().unwrap_or(breadcrumbs),
blocks,
),
Some(interior) => self.render_maybe_body(
interior,
Some(inline_partial) => self.render_maybe_body(
inline_partial,
new_breadcrumbs.as_ref().unwrap_or(breadcrumbs),
blocks,
),