Add template for quote blocks.
This commit is contained in:
@@ -25,6 +25,7 @@ use super::ISpecialBlock;
|
||||
use super::ISrcBlock;
|
||||
use super::ITable;
|
||||
use super::IVerseBlock;
|
||||
use futures::future::{BoxFuture, FutureExt};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum IElement {
|
||||
@@ -55,83 +56,86 @@ pub(crate) enum IElement {
|
||||
}
|
||||
|
||||
impl IElement {
|
||||
pub(crate) async fn new<'parse>(
|
||||
registry: &mut Registry<'parse>,
|
||||
elem: &organic::types::Element<'parse>,
|
||||
) -> Result<IElement, CustomError> {
|
||||
match elem {
|
||||
organic::types::Element::Paragraph(inner) => {
|
||||
Ok(IElement::Paragraph(IParagraph::new(registry, inner).await?))
|
||||
pub(crate) fn new<'parse, 'b>(
|
||||
registry: &'b mut Registry<'parse>,
|
||||
elem: &'b organic::types::Element<'parse>,
|
||||
) -> BoxFuture<'b, Result<IElement, CustomError>> {
|
||||
async move {
|
||||
match elem {
|
||||
organic::types::Element::Paragraph(inner) => {
|
||||
Ok(IElement::Paragraph(IParagraph::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::PlainList(inner) => {
|
||||
Ok(IElement::PlainList(IPlainList::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::CenterBlock(inner) => Ok(IElement::CenterBlock(
|
||||
ICenterBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::QuoteBlock(inner) => Ok(IElement::QuoteBlock(
|
||||
IQuoteBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::SpecialBlock(inner) => Ok(IElement::SpecialBlock(
|
||||
ISpecialBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::DynamicBlock(inner) => Ok(IElement::DynamicBlock(
|
||||
IDynamicBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::FootnoteDefinition(inner) => Ok(
|
||||
IElement::FootnoteDefinition(IFootnoteDefinition::new(registry, inner).await?),
|
||||
),
|
||||
organic::types::Element::Comment(inner) => {
|
||||
Ok(IElement::Comment(IComment::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::Drawer(inner) => {
|
||||
Ok(IElement::Drawer(IDrawer::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::PropertyDrawer(inner) => Ok(IElement::PropertyDrawer(
|
||||
IPropertyDrawer::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::Table(inner) => {
|
||||
Ok(IElement::Table(ITable::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::VerseBlock(inner) => Ok(IElement::VerseBlock(
|
||||
IVerseBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::CommentBlock(inner) => Ok(IElement::CommentBlock(
|
||||
ICommentBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::ExampleBlock(inner) => Ok(IElement::ExampleBlock(
|
||||
IExampleBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::ExportBlock(inner) => Ok(IElement::ExportBlock(
|
||||
IExportBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::SrcBlock(inner) => {
|
||||
Ok(IElement::SrcBlock(ISrcBlock::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::Clock(inner) => {
|
||||
Ok(IElement::Clock(IClock::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::DiarySexp(inner) => {
|
||||
Ok(IElement::DiarySexp(IDiarySexp::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::Planning(inner) => {
|
||||
Ok(IElement::Planning(IPlanning::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::FixedWidthArea(inner) => Ok(IElement::FixedWidthArea(
|
||||
IFixedWidthArea::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::HorizontalRule(inner) => Ok(IElement::HorizontalRule(
|
||||
IHorizontalRule::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::Keyword(inner) => {
|
||||
Ok(IElement::Keyword(IKeyword::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::BabelCall(inner) => {
|
||||
Ok(IElement::BabelCall(IBabelCall::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::LatexEnvironment(inner) => Ok(IElement::LatexEnvironment(
|
||||
ILatexEnvironment::new(registry, inner).await?,
|
||||
)),
|
||||
}
|
||||
organic::types::Element::PlainList(inner) => {
|
||||
Ok(IElement::PlainList(IPlainList::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::CenterBlock(inner) => Ok(IElement::CenterBlock(
|
||||
ICenterBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::QuoteBlock(inner) => Ok(IElement::QuoteBlock(
|
||||
IQuoteBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::SpecialBlock(inner) => Ok(IElement::SpecialBlock(
|
||||
ISpecialBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::DynamicBlock(inner) => Ok(IElement::DynamicBlock(
|
||||
IDynamicBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::FootnoteDefinition(inner) => Ok(IElement::FootnoteDefinition(
|
||||
IFootnoteDefinition::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::Comment(inner) => {
|
||||
Ok(IElement::Comment(IComment::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::Drawer(inner) => {
|
||||
Ok(IElement::Drawer(IDrawer::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::PropertyDrawer(inner) => Ok(IElement::PropertyDrawer(
|
||||
IPropertyDrawer::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::Table(inner) => {
|
||||
Ok(IElement::Table(ITable::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::VerseBlock(inner) => Ok(IElement::VerseBlock(
|
||||
IVerseBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::CommentBlock(inner) => Ok(IElement::CommentBlock(
|
||||
ICommentBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::ExampleBlock(inner) => Ok(IElement::ExampleBlock(
|
||||
IExampleBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::ExportBlock(inner) => Ok(IElement::ExportBlock(
|
||||
IExportBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::SrcBlock(inner) => {
|
||||
Ok(IElement::SrcBlock(ISrcBlock::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::Clock(inner) => {
|
||||
Ok(IElement::Clock(IClock::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::DiarySexp(inner) => {
|
||||
Ok(IElement::DiarySexp(IDiarySexp::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::Planning(inner) => {
|
||||
Ok(IElement::Planning(IPlanning::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::FixedWidthArea(inner) => Ok(IElement::FixedWidthArea(
|
||||
IFixedWidthArea::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::HorizontalRule(inner) => Ok(IElement::HorizontalRule(
|
||||
IHorizontalRule::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Element::Keyword(inner) => {
|
||||
Ok(IElement::Keyword(IKeyword::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::BabelCall(inner) => {
|
||||
Ok(IElement::BabelCall(IBabelCall::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Element::LatexEnvironment(inner) => Ok(IElement::LatexEnvironment(
|
||||
ILatexEnvironment::new(registry, inner).await?,
|
||||
)),
|
||||
}
|
||||
.boxed()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user