Implement RenderBlogStream::new.
I still need to implement RenderBlogStreamEntry::new.
This commit is contained in:
parent
cbe2010407
commit
53cd55932b
@ -6,6 +6,7 @@ use crate::config::Config;
|
||||
use crate::context::RenderDocumentElement;
|
||||
use crate::context::RenderRealFootnoteDefinition;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::get_web_path;
|
||||
use crate::intermediate::BlogPost;
|
||||
|
||||
use super::GlobalSettings;
|
||||
@ -31,7 +32,45 @@ impl RenderBlogStream {
|
||||
older_link: Option<String>,
|
||||
newer_link: Option<String>,
|
||||
) -> Result<RenderBlogStream, CustomError> {
|
||||
todo!()
|
||||
let css_files = vec![
|
||||
// get_web_path(
|
||||
// config,
|
||||
// output_directory,
|
||||
// output_file,
|
||||
// "stylesheet/reset.css",
|
||||
// )?,
|
||||
get_web_path(config, output_directory, output_file, "stylesheet/main.css")?,
|
||||
];
|
||||
let js_files = vec![get_web_path(
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
"blog_post.js",
|
||||
)?];
|
||||
let global_settings = GlobalSettings::new(
|
||||
config.get_site_title().map(str::to_string),
|
||||
css_files,
|
||||
js_files,
|
||||
);
|
||||
let page_header = PageHeader::new(
|
||||
config.get_site_title().map(str::to_string),
|
||||
Some(get_web_path(config, output_directory, output_file, "")?),
|
||||
);
|
||||
|
||||
let children = original
|
||||
.into_iter()
|
||||
.map(|blog_post| {
|
||||
RenderBlogStreamEntry::new(config, output_directory, output_file, blog_post)
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
Ok(RenderBlogStream {
|
||||
global_settings,
|
||||
page_header: Some(page_header),
|
||||
children,
|
||||
older_link,
|
||||
newer_link,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,3 +85,14 @@ pub(crate) struct RenderBlogStreamEntry {
|
||||
|
||||
footnotes: Vec<RenderRealFootnoteDefinition>,
|
||||
}
|
||||
|
||||
impl RenderBlogStreamEntry {
|
||||
pub(crate) fn new(
|
||||
config: &Config,
|
||||
output_directory: &Path,
|
||||
output_file: &Path,
|
||||
original: &BlogPost,
|
||||
) -> Result<RenderBlogStreamEntry, CustomError> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user