Switch the get_loop_elements implementation to only return populated arrays when its an array-like object.

This commit is contained in:
Tom Alexander
2020-05-24 16:27:13 -04:00
parent 59ee4f508f
commit 966499db76
5 changed files with 14 additions and 50 deletions

View File

@@ -30,13 +30,12 @@ pub trait Renderable {
pub trait Loopable {
/// Return the elements for a Dust section
///
/// Sections in dust are accomplished with the {#path} syntax. A
/// section has a truthiness check performed on it. If that
/// truthiness check fails, then it will render the
/// else-block. Otherwise if its a scalar value it will render
/// once with the context being the element at that path. Finally,
/// if its an array-like value then it will render n-times, once
/// for each element of the array.
/// Sections in dust are accomplished with the {#path} syntax. If
/// its an array-like value then it will render n-times, once for
/// each element of the array. If this is a scalar value, then
/// return an empty array. Sections with scalar values will still
/// be rendered (only once) if their truthiness check comes back
/// true.
fn get_loop_elements(&self) -> Vec<&dyn ContextElement>;
}