duster/src/renderer/inline_partial_tree.rs

34 lines
905 B
Rust
Raw Normal View History

use crate::parser::Body;
use crate::parser::Template;
use std::collections::HashMap;
struct InlinePartialTreeElement<'a> {
parent: Option<&'a InlinePartialTreeElement<'a>>,
blocks: HashMap<&'a str, &'a Option<Body<'a>>>,
}
impl<'a> InlinePartialTreeElement<'a> {
pub fn new(parent: Option<&'a InlinePartialTreeElement<'a>>) -> InlinePartialTreeElement<'a> {
InlinePartialTreeElement {
parent: parent,
blocks: HashMap::new(),
}
}
}
pub fn extract_inline_partials<'a>(
template: &'a Template<'a>,
) -> HashMap<&'a str, &'a Option<Body<'a>>> {
let mut blocks: HashMap<&'a str, &'a Option<Body<'a>>> = HashMap::new();
extract_inline_partials_from_body(&mut blocks, &template.contents);
blocks
}
fn extract_inline_partials_from_body<'a, 'b>(
blocks: &'b mut HashMap<&'a str, &'a Option<Body<'a>>>,
body: &'a Body<'a>,
) {
}