Files
natter/src/intermediate/element.rs

173 lines
4.5 KiB
Rust
Raw Normal View History

2023-10-27 16:13:23 -04:00
use super::comment::IComment;
2023-10-27 16:09:44 -04:00
use super::keyword::IKeyword;
use super::macros::iselector;
2023-10-29 22:31:29 -04:00
2023-10-27 17:08:58 -04:00
use super::IBabelCall;
use super::ICenterBlock;
use super::IClock;
use super::ICommentBlock;
use super::IDiarySexp;
use super::IDrawer;
use super::IDynamicBlock;
use super::IExampleBlock;
use super::IExportBlock;
use super::IFixedWidthArea;
use super::IFootnoteDefinition;
use super::IHorizontalRule;
use super::ILatexEnvironment;
2023-10-27 15:46:16 -04:00
use super::IParagraph;
2023-10-27 17:08:58 -04:00
use super::IPlainList;
use super::IPlanning;
use super::IPropertyDrawer;
use super::IQuoteBlock;
use super::ISpecialBlock;
use super::ISrcBlock;
use super::ITable;
use super::IVerseBlock;
use crate::error::CustomError;
use crate::intermediate::macros::iitem;
2023-10-27 19:53:18 -04:00
use futures::future::{BoxFuture, FutureExt};
2023-10-27 15:32:24 -04:00
2023-10-29 15:36:15 -04:00
#[derive(Debug, Clone)]
2023-10-27 15:46:16 -04:00
pub(crate) enum IElement {
Paragraph(IParagraph),
2023-10-27 17:08:58 -04:00
PlainList(IPlainList),
CenterBlock(ICenterBlock),
QuoteBlock(IQuoteBlock),
SpecialBlock(ISpecialBlock),
DynamicBlock(IDynamicBlock),
FootnoteDefinition(IFootnoteDefinition),
2023-10-27 16:13:23 -04:00
Comment(IComment),
2023-10-27 17:08:58 -04:00
Drawer(IDrawer),
PropertyDrawer(IPropertyDrawer),
Table(ITable),
VerseBlock(IVerseBlock),
CommentBlock(ICommentBlock),
ExampleBlock(IExampleBlock),
ExportBlock(IExportBlock),
SrcBlock(ISrcBlock),
Clock(IClock),
DiarySexp(IDiarySexp),
Planning(IPlanning),
FixedWidthArea(IFixedWidthArea),
HorizontalRule(IHorizontalRule),
Keyword(IKeyword),
BabelCall(IBabelCall),
LatexEnvironment(ILatexEnvironment),
2023-10-27 15:46:16 -04:00
}
2023-10-27 15:32:24 -04:00
iselector!(IElement, Element, original, intermediate_context, {
iitem!(
intermediate_context,
original,
(
organic::types::Element::Paragraph,
IElement::Paragraph,
IParagraph
),
(
organic::types::Element::PlainList,
IElement::PlainList,
IPlainList
),
(
organic::types::Element::CenterBlock,
IElement::CenterBlock,
ICenterBlock
),
(
organic::types::Element::QuoteBlock,
IElement::QuoteBlock,
IQuoteBlock
),
(
organic::types::Element::SpecialBlock,
IElement::SpecialBlock,
ISpecialBlock
),
(
organic::types::Element::DynamicBlock,
IElement::DynamicBlock,
IDynamicBlock
),
(
organic::types::Element::FootnoteDefinition,
IElement::FootnoteDefinition,
IFootnoteDefinition
),
(
organic::types::Element::Comment,
IElement::Comment,
IComment
),
(organic::types::Element::Drawer, IElement::Drawer, IDrawer),
(
organic::types::Element::PropertyDrawer,
IElement::PropertyDrawer,
IPropertyDrawer
),
(organic::types::Element::Table, IElement::Table, ITable),
(
organic::types::Element::VerseBlock,
IElement::VerseBlock,
IVerseBlock
),
(
organic::types::Element::CommentBlock,
IElement::CommentBlock,
ICommentBlock
),
(
organic::types::Element::ExampleBlock,
IElement::ExampleBlock,
IExampleBlock
),
(
organic::types::Element::ExportBlock,
IElement::ExportBlock,
IExportBlock
),
(
organic::types::Element::SrcBlock,
IElement::SrcBlock,
ISrcBlock
),
(organic::types::Element::Clock, IElement::Clock, IClock),
(
organic::types::Element::DiarySexp,
IElement::DiarySexp,
IDiarySexp
),
(
organic::types::Element::Planning,
IElement::Planning,
IPlanning
),
(
organic::types::Element::FixedWidthArea,
IElement::FixedWidthArea,
IFixedWidthArea
),
(
organic::types::Element::HorizontalRule,
IElement::HorizontalRule,
IHorizontalRule
),
(
organic::types::Element::Keyword,
IElement::Keyword,
IKeyword
),
(
organic::types::Element::BabelCall,
IElement::BabelCall,
IBabelCall
),
(
organic::types::Element::LatexEnvironment,
IElement::LatexEnvironment,
ILatexEnvironment
),
)
});