|
|
|
@ -260,6 +260,52 @@ impl<'a> DustRenderer<'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
DustTag::DTExists(container) => {
|
|
|
|
|
let new_breadcrumbs = self.new_breadcrumbs_partial(
|
|
|
|
|
breadcrumbs,
|
|
|
|
|
breadcrumbs,
|
|
|
|
|
None,
|
|
|
|
|
&container.explicit_context,
|
|
|
|
|
);
|
|
|
|
|
let val = walk_path(breadcrumbs, &container.path.keys)
|
|
|
|
|
.map(|ice| ice.into_context_element(self, breadcrumbs));
|
|
|
|
|
return match val {
|
|
|
|
|
Ok(Some(v)) if v.get_context_element_reference().is_truthy() => self
|
|
|
|
|
.render_maybe_body(
|
|
|
|
|
&container.contents,
|
|
|
|
|
new_breadcrumbs.as_ref().unwrap_or(breadcrumbs),
|
|
|
|
|
blocks,
|
|
|
|
|
),
|
|
|
|
|
_ => self.render_maybe_body(
|
|
|
|
|
&container.else_contents,
|
|
|
|
|
new_breadcrumbs.as_ref().unwrap_or(breadcrumbs),
|
|
|
|
|
blocks,
|
|
|
|
|
),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
DustTag::DTNotExists(container) => {
|
|
|
|
|
let new_breadcrumbs = self.new_breadcrumbs_partial(
|
|
|
|
|
breadcrumbs,
|
|
|
|
|
breadcrumbs,
|
|
|
|
|
None,
|
|
|
|
|
&container.explicit_context,
|
|
|
|
|
);
|
|
|
|
|
let val = walk_path(breadcrumbs, &container.path.keys)
|
|
|
|
|
.map(|ice| ice.into_context_element(self, breadcrumbs));
|
|
|
|
|
return match val {
|
|
|
|
|
Ok(Some(v)) if v.get_context_element_reference().is_truthy() => self
|
|
|
|
|
.render_maybe_body(
|
|
|
|
|
&container.else_contents,
|
|
|
|
|
new_breadcrumbs.as_ref().unwrap_or(breadcrumbs),
|
|
|
|
|
blocks,
|
|
|
|
|
),
|
|
|
|
|
_ => self.render_maybe_body(
|
|
|
|
|
&container.contents,
|
|
|
|
|
new_breadcrumbs.as_ref().unwrap_or(breadcrumbs),
|
|
|
|
|
blocks,
|
|
|
|
|
),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
_ => panic!("Unsupported tag"),
|
|
|
|
|
}
|
|
|
|
|
Ok("".to_owned())
|
|
|
|
|