|
|
|
@ -114,9 +114,6 @@ impl<'a> DustRenderer<'a> {
|
|
|
|
|
// an empty array or null), Dust uses the
|
|
|
|
|
// original context before walking the path as
|
|
|
|
|
// the context for rendering the else block
|
|
|
|
|
//
|
|
|
|
|
// TODO: do filters apply? I don't think so
|
|
|
|
|
// but I should test
|
|
|
|
|
return match &container.else_contents {
|
|
|
|
|
Some(body) => self.render_body(&body, breadcrumbs),
|
|
|
|
|
None => Ok("".to_owned()),
|
|
|
|
@ -139,6 +136,21 @@ impl<'a> DustRenderer<'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
DustTag::DTExists(container) => {
|
|
|
|
|
let val = walk_path(breadcrumbs, &container.path.keys);
|
|
|
|
|
let loop_elements: Vec<&dyn ContextElement> = self.get_loop_elements(val)?;
|
|
|
|
|
if loop_elements.is_empty() {
|
|
|
|
|
return match &container.else_contents {
|
|
|
|
|
Some(body) => self.render_body(&body, breadcrumbs),
|
|
|
|
|
None => Ok("".to_owned()),
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
return match &container.contents {
|
|
|
|
|
None => Ok("".to_owned()),
|
|
|
|
|
Some(body) => self.render_body(&body, breadcrumbs),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_ => (), // TODO: Implement the rest
|
|
|
|
|
}
|
|
|
|
|
Ok("".to_owned())
|
|
|
|
|