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:
Tom Alexander 2023-10-22 18:39:05 -04:00
parent 586fd8a066
commit 199621b6f1
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 10 additions and 9 deletions

View File

@ -30,21 +30,22 @@ impl SiteRenderer {
pub(crate) async fn render_blog_posts(&self) -> Result<(), CustomError> {
let mut renderer_integration = DusterRenderer::new();
let (main_template, other_templates): (Vec<_>, Vec<_>) = MAIN_TEMPLATES
let sources: Vec<_> = MAIN_TEMPLATES
.files()
.filter(|f| f.path().extension() == Some(OsStr::new("dust")))
.partition(|f| f.path().file_stem() == Some(OsStr::new("main")));
if main_template.len() != 1 {
.collect();
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());
}
let decoded_templates = {
let mut decoded_templates =
Vec::with_capacity(main_template.len() + other_templates.len());
for entry in main_template {
decoded_templates.push(build_name_contents_pairs(entry)?);
}
for entry in other_templates {
let mut decoded_templates = Vec::with_capacity(sources.len());
for entry in sources {
decoded_templates.push(build_name_contents_pairs(entry)?);
}
decoded_templates