diff --git a/src/command/build/render.rs b/src/command/build/render.rs index 4420ddc..c57a132 100644 --- a/src/command/build/render.rs +++ b/src/command/build/render.rs @@ -89,6 +89,19 @@ impl SiteRenderer { Ok(()) } + pub(crate) async fn render_blog_stream(&self, config: &Config) -> Result<(), CustomError> { + // TODO: Actually render a blog stream to index.html + + // Steps: sort blog posts by date, newest first + // + // Steps: group blog posts based on # of posts per page + // + // Steps: for each group, create a RenderBlogStream + // + // Steps: pass each RenderBlogStream to dust as the context to render index.html and any additional stream pages. + Ok(()) + } + pub(crate) async fn render_stylesheets(&self) -> Result<(), CustomError> { let stylesheet_output_directory = self.output_directory.join("stylesheet"); if !stylesheet_output_directory.exists() { diff --git a/src/command/build/runner.rs b/src/command/build/runner.rs index f41cf74..984dd9b 100644 --- a/src/command/build/runner.rs +++ b/src/command/build/runner.rs @@ -23,6 +23,7 @@ pub(crate) async fn build_site(args: BuildArgs) -> Result<(), CustomError> { stylesheets, ); renderer.render_blog_posts(&config).await?; + renderer.render_blog_stream(&config).await?; renderer.render_stylesheets().await?; Ok(()) diff --git a/src/context/blog_stream.rs b/src/context/blog_stream.rs new file mode 100644 index 0000000..25f21b6 --- /dev/null +++ b/src/context/blog_stream.rs @@ -0,0 +1,46 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::context::RenderDocumentElement; +use crate::context::RenderRealFootnoteDefinition; +use crate::error::CustomError; +use crate::intermediate::BlogPost; + +use super::GlobalSettings; +use super::PageHeader; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "blog_stream")] +pub(crate) struct RenderBlogStream { + global_settings: GlobalSettings, + page_header: Option, + children: Vec, + older_link: Option, + newer_link: Option, +} + +impl RenderBlogStream { + pub(crate) fn new( + config: &Config, + output_directory: &Path, + output_file: &Path, + original: &Vec, + ) -> Result { + todo!() + } +} + +#[derive(Debug, Serialize)] +pub(crate) struct RenderBlogStreamEntry { + /// The title that will be shown visibly on the page. + title: Option, + + self_link: Option, + + children: Vec, + + footnotes: Vec, +} diff --git a/src/context/mod.rs b/src/context/mod.rs index f3a8311..f39cf34 100644 --- a/src/context/mod.rs +++ b/src/context/mod.rs @@ -2,6 +2,7 @@ mod angle_link; mod ast_node; mod babel_call; mod blog_post_page; +mod blog_stream; mod bold; mod center_block; mod citation;