Implemented none and any, but I need to implement early termination.

This commit is contained in:
Tom Alexander
2020-06-07 18:52:09 -04:00
parent f1b868ce33
commit 0fac063c8d
2 changed files with 42 additions and 2 deletions

View File

@@ -601,8 +601,40 @@ impl<'a> DustRenderer<'a> {
}
}
}
DustTag::DTHelperAny(parameterized_block) => todo!(),
DustTag::DTHelperNone(parameterized_block) => todo!(),
DustTag::DTHelperAny(parameterized_block) => match select_context {
Some(sc) if sc.were_any_true => {
let new_breadcrumbs = self.new_breadcrumbs_partial(
breadcrumbs,
breadcrumbs,
None,
&parameterized_block.explicit_context,
);
return self.render_maybe_body(
&parameterized_block.contents,
new_breadcrumbs.as_ref().unwrap_or(breadcrumbs),
blocks,
None,
);
}
_ => return Ok("".to_owned()),
},
DustTag::DTHelperNone(parameterized_block) => match select_context {
Some(sc) if !sc.were_any_true => {
let new_breadcrumbs = self.new_breadcrumbs_partial(
breadcrumbs,
breadcrumbs,
None,
&parameterized_block.explicit_context,
);
return self.render_maybe_body(
&parameterized_block.contents,
new_breadcrumbs.as_ref().unwrap_or(breadcrumbs),
blocks,
None,
);
}
_ => return Ok("".to_owned()),
},
}
Ok("".to_owned())