natter/src/context/blog_post_page.rs
Tom Alexander ae933b491e
Use macros for the intermediate to render step.
This is largely to make changing the type signature of these functions easier by significantly reducing the amount of places that duplicates the signature.
2023-10-31 19:48:05 -04:00

41 lines
1.1 KiB
Rust

use serde::Serialize;
use super::footnote_definition::RenderRealFootnoteDefinition;
use super::GlobalSettings;
use super::RenderDocumentElement;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "blog_post_page")]
pub(crate) struct RenderBlogPostPage {
global_settings: GlobalSettings,
/// The title that will be shown visibly on the page.
title: Option<String>,
self_link: Option<String>,
children: Vec<RenderDocumentElement>,
footnotes: Vec<RenderRealFootnoteDefinition>,
}
impl RenderBlogPostPage {
// TODO: Maybe these settings should be moved into a common struct so this can have the same type signature as the others.
pub(crate) fn new(
global_settings: GlobalSettings,
title: Option<String>,
self_link: Option<String>,
children: Vec<RenderDocumentElement>,
footnotes: Vec<RenderRealFootnoteDefinition>,
) -> RenderBlogPostPage {
RenderBlogPostPage {
global_settings,
title,
self_link,
children,
footnotes,
}
}
}