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> {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user