Add RenderPlainText.
This commit is contained in:
parent
744d3e50fb
commit
1ac39c2a6f
@ -15,4 +15,5 @@ pub(crate) use element::Element;
|
|||||||
pub(crate) use heading::Heading;
|
pub(crate) use heading::Heading;
|
||||||
pub(crate) use object::Object;
|
pub(crate) use object::Object;
|
||||||
pub(crate) use page::BlogPostPage;
|
pub(crate) use page::BlogPostPage;
|
||||||
|
pub(crate) use plain_text::PlainText;
|
||||||
pub(crate) use section::Section;
|
pub(crate) use section::Section;
|
||||||
|
@ -4,6 +4,7 @@ mod element;
|
|||||||
mod global_settings;
|
mod global_settings;
|
||||||
mod heading;
|
mod heading;
|
||||||
mod object;
|
mod object;
|
||||||
|
mod plain_text;
|
||||||
mod section;
|
mod section;
|
||||||
|
|
||||||
pub(crate) use blog_post_page::RenderBlogPostPage;
|
pub(crate) use blog_post_page::RenderBlogPostPage;
|
||||||
|
@ -6,17 +6,28 @@ use crate::blog_post::Object;
|
|||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
|
|
||||||
|
use super::plain_text::RenderPlainText;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub(crate) enum RenderObject {}
|
pub(crate) enum RenderObject {
|
||||||
|
PlainText(RenderPlainText),
|
||||||
|
}
|
||||||
|
|
||||||
impl RenderObject {
|
impl RenderObject {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: D,
|
||||||
output_file: F,
|
output_file: F,
|
||||||
section: &Object,
|
object: &Object,
|
||||||
) -> Result<RenderObject, CustomError> {
|
) -> Result<RenderObject, CustomError> {
|
||||||
todo!()
|
match object {
|
||||||
|
Object::PlainText(inner) => Ok(RenderObject::PlainText(RenderPlainText::new(
|
||||||
|
config,
|
||||||
|
output_directory,
|
||||||
|
output_file,
|
||||||
|
inner,
|
||||||
|
)?)),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
src/context/plain_text.rs
Normal file
23
src/context/plain_text.rs
Normal file
@ -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<D: AsRef<Path>, F: AsRef<Path>>(
|
||||||
|
config: &Config,
|
||||||
|
output_directory: D,
|
||||||
|
output_file: F,
|
||||||
|
heading: &PlainText,
|
||||||
|
) -> Result<RenderPlainText, CustomError> {
|
||||||
|
Ok(RenderPlainText {})
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user