Add keyword and as no-op.

This commit is contained in:
Tom Alexander
2023-10-27 16:09:44 -04:00
parent f9377d7609
commit 5891ac7fb7
8 changed files with 58 additions and 3 deletions

View File

@@ -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
View 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 {})
}
}

View File

@@ -3,6 +3,7 @@ mod document_element;
mod element;
mod global_settings;
mod heading;
mod keyword;
mod object;
mod paragraph;
mod plain_text;

View File

@@ -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>,
}

View File

@@ -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 {