Implemented none and any, but I need to implement early termination.
This commit is contained in:
parent
f1b868ce33
commit
0fac063c8d
@ -100,3 +100,11 @@ Early termination stand-alone comparison{~n}
|
||||
If your pet was a {type} we'd name it {pet_name}{~n}
|
||||
{/pet_names}
|
||||
{/select}{~n}
|
||||
|
||||
@any alone{~n}
|
||||
=========={~n}
|
||||
{@any}{person} has a pet!{~n}{/any}
|
||||
|
||||
@none alone{~n}
|
||||
==========={~n}
|
||||
{@none}I don't know what to name {person}'s pet...{~n}{/none}
|
||||
|
@ -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,
|
||||
¶meterized_block.explicit_context,
|
||||
);
|
||||
return self.render_maybe_body(
|
||||
¶meterized_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,
|
||||
¶meterized_block.explicit_context,
|
||||
);
|
||||
return self.render_maybe_body(
|
||||
¶meterized_block.contents,
|
||||
new_breadcrumbs.as_ref().unwrap_or(breadcrumbs),
|
||||
blocks,
|
||||
None,
|
||||
);
|
||||
}
|
||||
_ => return Ok("".to_owned()),
|
||||
},
|
||||
}
|
||||
|
||||
Ok("".to_owned())
|
||||
|
Loading…
x
Reference in New Issue
Block a user