2023-10-27 19:32:24 +00:00
|
|
|
use crate::error::CustomError;
|
|
|
|
|
2023-10-27 20:09:44 +00:00
|
|
|
use super::keyword::IKeyword;
|
2023-10-27 19:32:24 +00:00
|
|
|
use super::registry::Registry;
|
2023-10-27 19:46:16 +00:00
|
|
|
use super::IParagraph;
|
2023-10-27 19:32:24 +00:00
|
|
|
|
2023-10-27 17:05:34 +00:00
|
|
|
#[derive(Debug)]
|
2023-10-27 19:46:16 +00:00
|
|
|
pub(crate) enum IElement {
|
|
|
|
Paragraph(IParagraph),
|
2023-10-27 20:09:44 +00:00
|
|
|
Keyword(IKeyword),
|
2023-10-27 19:46:16 +00:00
|
|
|
}
|
2023-10-27 19:32:24 +00:00
|
|
|
|
|
|
|
impl IElement {
|
2023-10-27 19:55:19 +00:00
|
|
|
pub(crate) async fn new<'parse>(
|
2023-10-27 19:32:24 +00:00
|
|
|
registry: &mut Registry<'parse>,
|
|
|
|
elem: &organic::types::Element<'parse>,
|
|
|
|
) -> Result<IElement, CustomError> {
|
|
|
|
match elem {
|
2023-10-27 19:46:16 +00:00
|
|
|
organic::types::Element::Paragraph(inner) => {
|
2023-10-27 19:55:19 +00:00
|
|
|
Ok(IElement::Paragraph(IParagraph::new(registry, inner).await?))
|
2023-10-27 19:46:16 +00:00
|
|
|
}
|
2023-10-27 19:32:24 +00:00
|
|
|
organic::types::Element::PlainList(_) => todo!(),
|
|
|
|
organic::types::Element::CenterBlock(_) => todo!(),
|
|
|
|
organic::types::Element::QuoteBlock(_) => todo!(),
|
|
|
|
organic::types::Element::SpecialBlock(_) => todo!(),
|
|
|
|
organic::types::Element::DynamicBlock(_) => todo!(),
|
|
|
|
organic::types::Element::FootnoteDefinition(_) => todo!(),
|
|
|
|
organic::types::Element::Comment(_) => todo!(),
|
|
|
|
organic::types::Element::Drawer(_) => todo!(),
|
|
|
|
organic::types::Element::PropertyDrawer(_) => todo!(),
|
|
|
|
organic::types::Element::Table(_) => todo!(),
|
|
|
|
organic::types::Element::VerseBlock(_) => todo!(),
|
|
|
|
organic::types::Element::CommentBlock(_) => todo!(),
|
|
|
|
organic::types::Element::ExampleBlock(_) => todo!(),
|
|
|
|
organic::types::Element::ExportBlock(_) => todo!(),
|
|
|
|
organic::types::Element::SrcBlock(_) => todo!(),
|
|
|
|
organic::types::Element::Clock(_) => todo!(),
|
|
|
|
organic::types::Element::DiarySexp(_) => todo!(),
|
|
|
|
organic::types::Element::Planning(_) => todo!(),
|
|
|
|
organic::types::Element::FixedWidthArea(_) => todo!(),
|
|
|
|
organic::types::Element::HorizontalRule(_) => todo!(),
|
2023-10-27 20:09:44 +00:00
|
|
|
organic::types::Element::Keyword(inner) => {
|
|
|
|
Ok(IElement::Keyword(IKeyword::new(registry, inner).await?))
|
|
|
|
}
|
2023-10-27 19:32:24 +00:00
|
|
|
organic::types::Element::BabelCall(_) => todo!(),
|
|
|
|
organic::types::Element::LatexEnvironment(_) => todo!(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|