Remove the separation of the main template.
I don't think this is necessary, and it certainly isn't necessary at this level.
This commit is contained in:
parent
586fd8a066
commit
199621b6f1
@ -30,21 +30,22 @@ impl SiteRenderer {
|
|||||||
pub(crate) async fn render_blog_posts(&self) -> Result<(), CustomError> {
|
pub(crate) async fn render_blog_posts(&self) -> Result<(), CustomError> {
|
||||||
let mut renderer_integration = DusterRenderer::new();
|
let mut renderer_integration = DusterRenderer::new();
|
||||||
|
|
||||||
let (main_template, other_templates): (Vec<_>, Vec<_>) = MAIN_TEMPLATES
|
let sources: Vec<_> = MAIN_TEMPLATES
|
||||||
.files()
|
.files()
|
||||||
.filter(|f| f.path().extension() == Some(OsStr::new("dust")))
|
.filter(|f| f.path().extension() == Some(OsStr::new("dust")))
|
||||||
.partition(|f| f.path().file_stem() == Some(OsStr::new("main")));
|
.collect();
|
||||||
if main_template.len() != 1 {
|
if sources
|
||||||
|
.iter()
|
||||||
|
.filter(|f| f.path().file_stem() == Some(OsStr::new("main")))
|
||||||
|
.count()
|
||||||
|
!= 1
|
||||||
|
{
|
||||||
return Err("Expect exactly 1 main.dust template file.".into());
|
return Err("Expect exactly 1 main.dust template file.".into());
|
||||||
}
|
}
|
||||||
|
|
||||||
let decoded_templates = {
|
let decoded_templates = {
|
||||||
let mut decoded_templates =
|
let mut decoded_templates = Vec::with_capacity(sources.len());
|
||||||
Vec::with_capacity(main_template.len() + other_templates.len());
|
for entry in sources {
|
||||||
for entry in main_template {
|
|
||||||
decoded_templates.push(build_name_contents_pairs(entry)?);
|
|
||||||
}
|
|
||||||
for entry in other_templates {
|
|
||||||
decoded_templates.push(build_name_contents_pairs(entry)?);
|
decoded_templates.push(build_name_contents_pairs(entry)?);
|
||||||
}
|
}
|
||||||
decoded_templates
|
decoded_templates
|
||||||
|
Loading…
x
Reference in New Issue
Block a user