natter/src/context/blog_stream.rs
Tom Alexander cbe2010407
Invoke dust to render the stream pages.
At this point the render_blog_stream function is done, but RenderBlogStream::new needs to be implemented to actually generate the render context. The body of this function should be similar to convert_blog_post_page_to_render_context.
2023-12-17 17:26:15 -05:00

49 lines
1.2 KiB
Rust

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: &[&BlogPost],
older_link: Option<String>,
newer_link: Option<String>,
) -> 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>,
}