Initial structure for rendering a blog post stream.
This commit is contained in:
parent
60555999db
commit
e8ed4a4f4a
@ -89,6 +89,19 @@ impl SiteRenderer {
|
|||||||
Ok(())
|
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> {
|
pub(crate) async fn render_stylesheets(&self) -> Result<(), CustomError> {
|
||||||
let stylesheet_output_directory = self.output_directory.join("stylesheet");
|
let stylesheet_output_directory = self.output_directory.join("stylesheet");
|
||||||
if !stylesheet_output_directory.exists() {
|
if !stylesheet_output_directory.exists() {
|
||||||
|
@ -23,6 +23,7 @@ pub(crate) async fn build_site(args: BuildArgs) -> Result<(), CustomError> {
|
|||||||
stylesheets,
|
stylesheets,
|
||||||
);
|
);
|
||||||
renderer.render_blog_posts(&config).await?;
|
renderer.render_blog_posts(&config).await?;
|
||||||
|
renderer.render_blog_stream(&config).await?;
|
||||||
renderer.render_stylesheets().await?;
|
renderer.render_stylesheets().await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
46
src/context/blog_stream.rs
Normal file
46
src/context/blog_stream.rs
Normal file
@ -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<PageHeader>,
|
||||||
|
children: Vec<RenderBlogStreamEntry>,
|
||||||
|
older_link: Option<String>,
|
||||||
|
newer_link: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RenderBlogStream {
|
||||||
|
pub(crate) fn new(
|
||||||
|
config: &Config,
|
||||||
|
output_directory: &Path,
|
||||||
|
output_file: &Path,
|
||||||
|
original: &Vec<BlogPost>,
|
||||||
|
) -> Result<RenderBlogStream, CustomError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
pub(crate) struct RenderBlogStreamEntry {
|
||||||
|
/// The title that will be shown visibly on the page.
|
||||||
|
title: Option<String>,
|
||||||
|
|
||||||
|
self_link: Option<String>,
|
||||||
|
|
||||||
|
children: Vec<RenderDocumentElement>,
|
||||||
|
|
||||||
|
footnotes: Vec<RenderRealFootnoteDefinition>,
|
||||||
|
}
|
@ -2,6 +2,7 @@ mod angle_link;
|
|||||||
mod ast_node;
|
mod ast_node;
|
||||||
mod babel_call;
|
mod babel_call;
|
||||||
mod blog_post_page;
|
mod blog_post_page;
|
||||||
|
mod blog_stream;
|
||||||
mod bold;
|
mod bold;
|
||||||
mod center_block;
|
mod center_block;
|
||||||
mod citation;
|
mod citation;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user