Introduce an array of document elements.
This commit is contained in:
parent
3cfcae25a9
commit
77f8375d7a
@ -39,7 +39,12 @@ pub(crate) fn convert_blog_post_page_to_render_context<D: AsRef<Path>, F: AsRef<
|
|||||||
output_file.strip_prefix(output_directory)?,
|
output_file.strip_prefix(output_directory)?,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let ret = RenderBlogPostPage::new(global_settings, page.title.clone(), Some(link_to_blog_post));
|
let ret = RenderBlogPostPage::new(
|
||||||
|
global_settings,
|
||||||
|
page.title.clone(),
|
||||||
|
Some(link_to_blog_post),
|
||||||
|
Vec::new(),
|
||||||
|
);
|
||||||
Ok(ret)
|
Ok(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use super::GlobalSettings;
|
use super::GlobalSettings;
|
||||||
|
use super::RenderDocumentElement;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
@ -12,6 +13,8 @@ pub(crate) struct RenderBlogPostPage {
|
|||||||
title: Option<String>,
|
title: Option<String>,
|
||||||
|
|
||||||
self_link: Option<String>,
|
self_link: Option<String>,
|
||||||
|
|
||||||
|
children: Vec<RenderDocumentElement>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RenderBlogPostPage {
|
impl RenderBlogPostPage {
|
||||||
@ -19,11 +22,13 @@ impl RenderBlogPostPage {
|
|||||||
global_settings: GlobalSettings,
|
global_settings: GlobalSettings,
|
||||||
title: Option<String>,
|
title: Option<String>,
|
||||||
self_link: Option<String>,
|
self_link: Option<String>,
|
||||||
|
children: Vec<RenderDocumentElement>,
|
||||||
) -> RenderBlogPostPage {
|
) -> RenderBlogPostPage {
|
||||||
RenderBlogPostPage {
|
RenderBlogPostPage {
|
||||||
global_settings,
|
global_settings,
|
||||||
title,
|
title,
|
||||||
self_link,
|
self_link,
|
||||||
|
children,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
src/types/document_element.rs
Normal file
11
src/types/document_element.rs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
use serde::Serialize;
|
||||||
|
|
||||||
|
use super::RenderHeading;
|
||||||
|
use super::RenderSection;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub(crate) enum RenderDocumentElement {
|
||||||
|
Heading(RenderHeading),
|
||||||
|
Section(RenderSection),
|
||||||
|
}
|
6
src/types/heading.rs
Normal file
6
src/types/heading.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
use serde::Serialize;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
#[serde(tag = "type")]
|
||||||
|
#[serde(rename = "heading")]
|
||||||
|
pub(crate) struct RenderHeading {}
|
@ -1,5 +1,11 @@
|
|||||||
mod blog_post_page;
|
mod blog_post_page;
|
||||||
|
mod document_element;
|
||||||
mod global_settings;
|
mod global_settings;
|
||||||
|
mod heading;
|
||||||
|
mod section;
|
||||||
|
|
||||||
pub(crate) use blog_post_page::RenderBlogPostPage;
|
pub(crate) use blog_post_page::RenderBlogPostPage;
|
||||||
|
pub(crate) use document_element::RenderDocumentElement;
|
||||||
pub(crate) use global_settings::GlobalSettings;
|
pub(crate) use global_settings::GlobalSettings;
|
||||||
|
pub(crate) use heading::RenderHeading;
|
||||||
|
pub(crate) use section::RenderSection;
|
||||||
|
6
src/types/section.rs
Normal file
6
src/types/section.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
use serde::Serialize;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
#[serde(tag = "type")]
|
||||||
|
#[serde(rename = "section")]
|
||||||
|
pub(crate) struct RenderSection {}
|
Loading…
x
Reference in New Issue
Block a user