|
|
@ -730,17 +730,37 @@ impl<'a> DustRenderer<'a> {
|
|
|
|
maybe_ice
|
|
|
|
maybe_ice
|
|
|
|
.as_ref()
|
|
|
|
.as_ref()
|
|
|
|
.map(|ice| ice.get_context_element_reference())
|
|
|
|
.map(|ice| ice.get_context_element_reference())
|
|
|
|
.map(|ce| ce.get_size())
|
|
|
|
// .map(|ce| ce.get_size())
|
|
|
|
});
|
|
|
|
});
|
|
|
|
match value_ce {
|
|
|
|
match value_ce {
|
|
|
|
// If we found the key but could not get the size from it, render nothing.
|
|
|
|
|
|
|
|
Some(Ok(None)) => return Ok("".to_owned()),
|
|
|
|
|
|
|
|
// If "key" is not on the @size tag at all, render 0.
|
|
|
|
// If "key" is not on the @size tag at all, render 0.
|
|
|
|
None => return Ok("0".to_owned()),
|
|
|
|
None => return Ok("0".to_owned()),
|
|
|
|
// If the key value could not be found in the context, render 0.
|
|
|
|
// If the key value could not be found in the context, render 0.
|
|
|
|
Some(Err(_)) => return Ok("0".to_owned()),
|
|
|
|
Some(Err(_)) => return Ok("0".to_owned()),
|
|
|
|
Some(Ok(Some(ce_size))) => {
|
|
|
|
Some(Ok(ce)) => {
|
|
|
|
return ce_size.get_context_element_reference().render(&Vec::new())
|
|
|
|
// The @size helper attempts to cast values to
|
|
|
|
|
|
|
|
// numbers, and if that succeeds it uses the
|
|
|
|
|
|
|
|
// number, otherwise we'll get the size of the
|
|
|
|
|
|
|
|
// original type.
|
|
|
|
|
|
|
|
match ce.cast_to_type("number") {
|
|
|
|
|
|
|
|
Some(ice) => {
|
|
|
|
|
|
|
|
return ice
|
|
|
|
|
|
|
|
.get_context_element_reference()
|
|
|
|
|
|
|
|
.get_size()
|
|
|
|
|
|
|
|
.map(|ce_size| {
|
|
|
|
|
|
|
|
ce_size.get_context_element_reference().render(&Vec::new())
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.unwrap_or(Ok("".to_owned()))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
None => {
|
|
|
|
|
|
|
|
return ce
|
|
|
|
|
|
|
|
.get_size()
|
|
|
|
|
|
|
|
.map(|ce_size| {
|
|
|
|
|
|
|
|
ce_size.get_context_element_reference().render(&Vec::new())
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.unwrap_or(Ok("".to_owned()))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|