Getting the left and right sides.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
use crate::parser::template;
|
||||
use crate::parser::Body;
|
||||
use crate::parser::DustTag;
|
||||
use crate::parser::KVPair;
|
||||
use crate::parser::RValue;
|
||||
use crate::parser::Special;
|
||||
use crate::parser::Template;
|
||||
use crate::parser::TemplateElement;
|
||||
@@ -222,6 +224,28 @@ impl<'a> DustRenderer<'a> {
|
||||
},
|
||||
};
|
||||
}
|
||||
DustTag::DTHelperEquals(parameterized_block) => {
|
||||
let param_map: HashMap<&'a str, &'a RValue<'a>> = parameterized_block
|
||||
.params
|
||||
.iter()
|
||||
.map(|pair: &KVPair<'a>| (pair.key, &pair.value))
|
||||
.collect();
|
||||
let left_side: Result<&dyn ContextElement, WalkError> = match param_map.get("key") {
|
||||
None => return Ok("".to_owned()),
|
||||
Some(rval) => match rval {
|
||||
RValue::RVString(text) => Ok(text),
|
||||
RValue::RVPath(path) => walk_path(breadcrumbs, &path.keys),
|
||||
},
|
||||
};
|
||||
let right_side: Result<&dyn ContextElement, WalkError> =
|
||||
match param_map.get("value") {
|
||||
None => Err(WalkError::CantWalk),
|
||||
Some(rval) => match rval {
|
||||
RValue::RVString(text) => Ok(text),
|
||||
RValue::RVPath(path) => walk_path(breadcrumbs, &path.keys),
|
||||
},
|
||||
};
|
||||
}
|
||||
_ => (), // TODO: Implement the rest
|
||||
}
|
||||
Ok("".to_owned())
|
||||
|
||||
Reference in New Issue
Block a user