Inline partials and blocks worked as-is.

This commit is contained in:
Tom Alexander 2020-06-06 23:18:28 -04:00
parent 250d428464
commit c8de395038
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -338,6 +338,30 @@ impl<'a> DustRenderer<'a> {
return Ok(rendered_content); return Ok(rendered_content);
} }
} }
DustTag::DTInlinePartial(_named_block) => {
// Inline partials are blank during rendering (they get injected into blocks)
return Ok("".to_owned());
}
DustTag::DTBlock(named_block) => {
let new_breadcrumbs = self.new_breadcrumbs_partial(
breadcrumbs,
blocks.breadcrumbs,
None,
&named_block.explicit_context,
);
return match blocks.blocks.get_block(named_block.path.keys[0]) {
None => self.render_maybe_body(
&named_block.contents,
new_breadcrumbs.as_ref().unwrap_or(breadcrumbs),
blocks,
),
Some(inline_partial) => self.render_maybe_body(
inline_partial,
new_breadcrumbs.as_ref().unwrap_or(breadcrumbs),
blocks,
),
};
}
_ => panic!("Unsupported tag"), _ => panic!("Unsupported tag"),
} }
Ok("".to_owned()) Ok("".to_owned())