Implement the new partial type in the renderer.
This commit is contained in:
@@ -8,6 +8,7 @@ pub use parser::DustTag;
|
||||
pub use parser::Filter;
|
||||
pub use parser::KVPair;
|
||||
pub use parser::OwnedLiteral;
|
||||
pub use parser::PartialNameElement;
|
||||
pub use parser::RValue;
|
||||
pub use parser::Special;
|
||||
pub use parser::Template;
|
||||
|
||||
@@ -193,6 +193,24 @@ impl From<TemplateElement<'_>> for PartialNameElement {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a PartialNameElement> for TemplateElement<'a> {
|
||||
fn from(original: &'a PartialNameElement) -> Self {
|
||||
match original {
|
||||
PartialNameElement::PNSpan { contents } => {
|
||||
TemplateElement::TESpan(Span { contents: contents })
|
||||
}
|
||||
PartialNameElement::PNReference { path, filters } => {
|
||||
TemplateElement::TETag(DustTag::DTReference(Reference {
|
||||
path: Path {
|
||||
keys: path.into_iter().map(|s| s.as_str()).collect(),
|
||||
},
|
||||
filters: filters.into_iter().map(|f| f.clone()).collect(),
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Any element significant to dust that isn't plain text
|
||||
///
|
||||
/// These elements are always wrapped in curly braces
|
||||
|
||||
Reference in New Issue
Block a user