Rename blog_post module to intermediate.
This module is mostly the intermediate representation of the AST, so the renaming is to make that more clear. The three forms are parsed => intermediate => render. Parsed comes from Organic and is a direct translation of the org-mode text. Intermediate converts the parsed data into owned values and does any calculations that are needed on the data (for example: assigning numbers to footnotes.) Render takes intermediate and translates it into the format expected by the dust templates. The processing in this step should be minimal since all the logic should be in the intermediate step.
This commit is contained in:
44
src/intermediate/object.rs
Normal file
44
src/intermediate/object.rs
Normal file
@@ -0,0 +1,44 @@
|
||||
use crate::error::CustomError;
|
||||
|
||||
use super::plain_text::IPlainText;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum IObject {
|
||||
PlainText(IPlainText),
|
||||
}
|
||||
|
||||
impl IObject {
|
||||
pub(crate) fn new(obj: &organic::types::Object<'_>) -> Result<IObject, CustomError> {
|
||||
match obj {
|
||||
organic::types::Object::Bold(_) => todo!(),
|
||||
organic::types::Object::Italic(_) => todo!(),
|
||||
organic::types::Object::Underline(_) => todo!(),
|
||||
organic::types::Object::StrikeThrough(_) => todo!(),
|
||||
organic::types::Object::Code(_) => todo!(),
|
||||
organic::types::Object::Verbatim(_) => todo!(),
|
||||
organic::types::Object::PlainText(plain_text) => {
|
||||
Ok(IObject::PlainText(IPlainText::new(plain_text)?))
|
||||
}
|
||||
organic::types::Object::RegularLink(_) => todo!(),
|
||||
organic::types::Object::RadioLink(_) => todo!(),
|
||||
organic::types::Object::RadioTarget(_) => todo!(),
|
||||
organic::types::Object::PlainLink(_) => todo!(),
|
||||
organic::types::Object::AngleLink(_) => todo!(),
|
||||
organic::types::Object::OrgMacro(_) => todo!(),
|
||||
organic::types::Object::Entity(_) => todo!(),
|
||||
organic::types::Object::LatexFragment(_) => todo!(),
|
||||
organic::types::Object::ExportSnippet(_) => todo!(),
|
||||
organic::types::Object::FootnoteReference(_) => todo!(),
|
||||
organic::types::Object::Citation(_) => todo!(),
|
||||
organic::types::Object::CitationReference(_) => todo!(),
|
||||
organic::types::Object::InlineBabelCall(_) => todo!(),
|
||||
organic::types::Object::InlineSourceBlock(_) => todo!(),
|
||||
organic::types::Object::LineBreak(_) => todo!(),
|
||||
organic::types::Object::Target(_) => todo!(),
|
||||
organic::types::Object::StatisticsCookie(_) => todo!(),
|
||||
organic::types::Object::Subscript(_) => todo!(),
|
||||
organic::types::Object::Superscript(_) => todo!(),
|
||||
organic::types::Object::Timestamp(_) => todo!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user