Add that check to the not-equals helper and update the json value implementation to mark all non-scalars as not-equals.

This commit is contained in:
Tom Alexander
2020-05-16 15:30:17 -04:00
parent 41e4874d75
commit 7d4cb14530
2 changed files with 23 additions and 1 deletions

View File

@@ -285,6 +285,20 @@ impl<'a> DustRenderer<'a> {
.iter()
.map(|pair: &KVPair<'a>| (pair.key, &pair.value))
.collect();
// Special case: when comparing two RVPaths, if the
// path is equal then dust assumes the values are
// equal (otherwise, non-scalar values are
// automatically not equal)
if Self::are_paths_identical(&param_map) {
return match &parameterized_block.else_contents {
None => Ok("".to_owned()),
Some(body) => {
let rendered_content = self.render_body(body, breadcrumbs, blocks)?;
Ok(rendered_content)
}
};
}
let left_side: Result<&dyn ContextElement, WalkError> = match param_map.get("key") {
None => return Ok("".to_owned()),
Some(rval) => match rval {