Start of structure for extracting inline partials from a template.

This commit is contained in:
Tom Alexander 2020-05-09 21:01:37 -04:00
parent 12d8b58961
commit 97e806a968
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,33 @@
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>,
) {
}

View File

@ -2,6 +2,7 @@
mod context_element;
mod errors;
mod inline_partial_tree;
mod parameters_context;
mod renderer;
mod walking;