diff --git a/src/blog_post/mod.rs b/src/blog_post/mod.rs index b8ff674..fae23ec 100644 --- a/src/blog_post/mod.rs +++ b/src/blog_post/mod.rs @@ -15,4 +15,5 @@ pub(crate) use element::Element; pub(crate) use heading::Heading; pub(crate) use object::Object; pub(crate) use page::BlogPostPage; +pub(crate) use plain_text::PlainText; pub(crate) use section::Section; diff --git a/src/context/mod.rs b/src/context/mod.rs index 177e2eb..bbfa0fc 100644 --- a/src/context/mod.rs +++ b/src/context/mod.rs @@ -4,6 +4,7 @@ mod element; mod global_settings; mod heading; mod object; +mod plain_text; mod section; pub(crate) use blog_post_page::RenderBlogPostPage; diff --git a/src/context/object.rs b/src/context/object.rs index 724c5d1..558f1d2 100644 --- a/src/context/object.rs +++ b/src/context/object.rs @@ -6,17 +6,28 @@ use crate::blog_post::Object; use crate::config::Config; use crate::error::CustomError; +use super::plain_text::RenderPlainText; + #[derive(Debug, Serialize)] #[serde(untagged)] -pub(crate) enum RenderObject {} +pub(crate) enum RenderObject { + PlainText(RenderPlainText), +} impl RenderObject { pub(crate) fn new, F: AsRef>( config: &Config, output_directory: D, output_file: F, - section: &Object, + object: &Object, ) -> Result { - todo!() + match object { + Object::PlainText(inner) => Ok(RenderObject::PlainText(RenderPlainText::new( + config, + output_directory, + output_file, + inner, + )?)), + } } } diff --git a/src/context/plain_text.rs b/src/context/plain_text.rs new file mode 100644 index 0000000..aae8012 --- /dev/null +++ b/src/context/plain_text.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::blog_post::PlainText; +use crate::config::Config; +use crate::error::CustomError; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "heading")] +pub(crate) struct RenderPlainText {} + +impl RenderPlainText { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + heading: &PlainText, + ) -> Result { + Ok(RenderPlainText {}) + } +}