Add keyword and as no-op.
This commit is contained in:
parent
f9377d7609
commit
5891ac7fb7
@ -6,12 +6,14 @@ use crate::config::Config;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::IElement;
|
||||
|
||||
use super::keyword::RenderKeyword;
|
||||
use super::paragraph::RenderParagraph;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub(crate) enum RenderElement {
|
||||
Paragraph(RenderParagraph),
|
||||
Keyword(RenderKeyword),
|
||||
}
|
||||
|
||||
impl RenderElement {
|
||||
@ -28,6 +30,12 @@ impl RenderElement {
|
||||
output_file,
|
||||
inner,
|
||||
)?)),
|
||||
IElement::Keyword(inner) => Ok(RenderElement::Keyword(RenderKeyword::new(
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
inner,
|
||||
)?)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
23
src/context/keyword.rs
Normal file
23
src/context/keyword.rs
Normal file
@ -0,0 +1,23 @@
|
||||
use std::path::Path;
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::IKeyword;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "keyword")]
|
||||
pub(crate) struct RenderKeyword {}
|
||||
|
||||
impl RenderKeyword {
|
||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
||||
config: &Config,
|
||||
output_directory: D,
|
||||
output_file: F,
|
||||
keyword: &IKeyword,
|
||||
) -> Result<RenderKeyword, CustomError> {
|
||||
Ok(RenderKeyword {})
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ mod document_element;
|
||||
mod element;
|
||||
mod global_settings;
|
||||
mod heading;
|
||||
mod keyword;
|
||||
mod object;
|
||||
mod paragraph;
|
||||
mod plain_text;
|
||||
|
@ -10,7 +10,7 @@ use super::RenderObject;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "heading")]
|
||||
#[serde(rename = "paragraph")]
|
||||
pub(crate) struct RenderParagraph {
|
||||
children: Vec<RenderObject>,
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ use crate::intermediate::IPlainText;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "heading")]
|
||||
#[serde(rename = "plain_text")]
|
||||
pub(crate) struct RenderPlainText {}
|
||||
|
||||
impl RenderPlainText {
|
||||
|
@ -1,11 +1,13 @@
|
||||
use crate::error::CustomError;
|
||||
|
||||
use super::keyword::IKeyword;
|
||||
use super::registry::Registry;
|
||||
use super::IParagraph;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum IElement {
|
||||
Paragraph(IParagraph),
|
||||
Keyword(IKeyword),
|
||||
}
|
||||
|
||||
impl IElement {
|
||||
@ -37,7 +39,9 @@ impl IElement {
|
||||
organic::types::Element::Planning(_) => todo!(),
|
||||
organic::types::Element::FixedWidthArea(_) => todo!(),
|
||||
organic::types::Element::HorizontalRule(_) => todo!(),
|
||||
organic::types::Element::Keyword(_) => todo!(),
|
||||
organic::types::Element::Keyword(inner) => {
|
||||
Ok(IElement::Keyword(IKeyword::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::BabelCall(_) => todo!(),
|
||||
organic::types::Element::LatexEnvironment(_) => todo!(),
|
||||
}
|
||||
|
17
src/intermediate/keyword.rs
Normal file
17
src/intermediate/keyword.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use crate::error::CustomError;
|
||||
|
||||
use super::registry::Registry;
|
||||
use super::IObject;
|
||||
|
||||
/// Essentially a no-op since the keyword is not rendered and any relevant impact on other elements is pulled from the parsed form of keyword.
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct IKeyword {}
|
||||
|
||||
impl IKeyword {
|
||||
pub(crate) async fn new<'parse>(
|
||||
registry: &mut Registry<'parse>,
|
||||
keyword: &organic::types::Keyword<'parse>,
|
||||
) -> Result<IKeyword, CustomError> {
|
||||
Ok(IKeyword {})
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ mod definition;
|
||||
mod document_element;
|
||||
mod element;
|
||||
mod heading;
|
||||
mod keyword;
|
||||
mod object;
|
||||
mod page;
|
||||
mod paragraph;
|
||||
@ -16,6 +17,7 @@ pub(crate) use definition::BlogPost;
|
||||
pub(crate) use document_element::IDocumentElement;
|
||||
pub(crate) use element::IElement;
|
||||
pub(crate) use heading::IHeading;
|
||||
pub(crate) use keyword::IKeyword;
|
||||
pub(crate) use object::IObject;
|
||||
pub(crate) use page::BlogPostPage;
|
||||
pub(crate) use paragraph::IParagraph;
|
||||
|
Loading…
Reference in New Issue
Block a user