diff --git a/default_environment/templates/html/quote_block.dust b/default_environment/templates/html/quote_block.dust
index f3e1d19..4e30b27 100644
--- a/default_environment/templates/html/quote_block.dust
+++ b/default_environment/templates/html/quote_block.dust
@@ -1 +1,3 @@
-quote_block
+
{#.children}
+ {>element/}
+{/.children}
diff --git a/src/context/quote_block.rs b/src/context/quote_block.rs
index 9603f44..8a5d7f0 100644
--- a/src/context/quote_block.rs
+++ b/src/context/quote_block.rs
@@ -6,10 +6,14 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IQuoteBlock;
+use super::RenderElement;
+
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "quote_block")]
-pub(crate) struct RenderQuoteBlock {}
+pub(crate) struct RenderQuoteBlock {
+ children: Vec,
+}
impl RenderQuoteBlock {
pub(crate) fn new(
@@ -18,6 +22,19 @@ impl RenderQuoteBlock {
output_file: &Path,
original: &IQuoteBlock,
) -> Result {
- Ok(RenderQuoteBlock {})
+ let children = {
+ let mut ret = Vec::new();
+ for obj in original.children.iter() {
+ ret.push(RenderElement::new(
+ config,
+ &output_directory,
+ &output_file,
+ obj,
+ )?);
+ }
+ ret
+ };
+
+ Ok(RenderQuoteBlock { children })
}
}
diff --git a/src/intermediate/element.rs b/src/intermediate/element.rs
index 255afd2..1fe3360 100644
--- a/src/intermediate/element.rs
+++ b/src/intermediate/element.rs
@@ -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 {
- 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> {
+ 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()
}
}
diff --git a/src/intermediate/object.rs b/src/intermediate/object.rs
index 7eb9f8f..c51584a 100644
--- a/src/intermediate/object.rs
+++ b/src/intermediate/object.rs
@@ -28,6 +28,7 @@ use super::timestamp::ITimestamp;
use super::underline::IUnderline;
use super::verbatim::IVerbatim;
use super::ITarget;
+use futures::future::{BoxFuture, FutureExt};
#[derive(Debug)]
pub(crate) enum IObject {
@@ -61,92 +62,95 @@ pub(crate) enum IObject {
}
impl IObject {
- pub(crate) async fn new<'parse>(
- registry: &mut Registry<'parse>,
- obj: &organic::types::Object<'parse>,
- ) -> Result {
- match obj {
- organic::types::Object::Bold(inner) => {
- Ok(IObject::Bold(IBold::new(registry, inner).await?))
- }
- organic::types::Object::Italic(inner) => {
- Ok(IObject::Italic(IItalic::new(registry, inner).await?))
- }
- organic::types::Object::Underline(inner) => {
- Ok(IObject::Underline(IUnderline::new(registry, inner).await?))
- }
- organic::types::Object::StrikeThrough(inner) => Ok(IObject::StrikeThrough(
- IStrikeThrough::new(registry, inner).await?,
- )),
- organic::types::Object::Code(inner) => {
- Ok(IObject::Code(ICode::new(registry, inner).await?))
- }
- organic::types::Object::Verbatim(inner) => {
- Ok(IObject::Verbatim(IVerbatim::new(registry, inner).await?))
- }
- organic::types::Object::PlainText(inner) => {
- Ok(IObject::PlainText(IPlainText::new(registry, inner).await?))
- }
- organic::types::Object::RegularLink(inner) => Ok(IObject::RegularLink(
- IRegularLink::new(registry, inner).await?,
- )),
- organic::types::Object::RadioLink(inner) => {
- Ok(IObject::RadioLink(IRadioLink::new(registry, inner).await?))
- }
- organic::types::Object::RadioTarget(inner) => Ok(IObject::RadioTarget(
- IRadioTarget::new(registry, inner).await?,
- )),
- organic::types::Object::PlainLink(inner) => {
- Ok(IObject::PlainLink(IPlainLink::new(registry, inner).await?))
- }
- organic::types::Object::AngleLink(inner) => {
- Ok(IObject::AngleLink(IAngleLink::new(registry, inner).await?))
- }
- organic::types::Object::OrgMacro(inner) => {
- Ok(IObject::OrgMacro(IOrgMacro::new(registry, inner).await?))
- }
- organic::types::Object::Entity(inner) => {
- Ok(IObject::Entity(IEntity::new(registry, inner).await?))
- }
- organic::types::Object::LatexFragment(inner) => Ok(IObject::LatexFragment(
- ILatexFragment::new(registry, inner).await?,
- )),
- organic::types::Object::ExportSnippet(inner) => Ok(IObject::ExportSnippet(
- IExportSnippet::new(registry, inner).await?,
- )),
- organic::types::Object::FootnoteReference(inner) => Ok(IObject::FootnoteReference(
- IFootnoteReference::new(registry, inner).await?,
- )),
- organic::types::Object::Citation(inner) => {
- Ok(IObject::Citation(ICitation::new(registry, inner).await?))
- }
- organic::types::Object::CitationReference(inner) => Ok(IObject::CitationReference(
- ICitationReference::new(registry, inner).await?,
- )),
- organic::types::Object::InlineBabelCall(inner) => Ok(IObject::InlineBabelCall(
- IInlineBabelCall::new(registry, inner).await?,
- )),
- organic::types::Object::InlineSourceBlock(inner) => Ok(IObject::InlineSourceBlock(
- IInlineSourceBlock::new(registry, inner).await?,
- )),
- organic::types::Object::LineBreak(inner) => {
- Ok(IObject::LineBreak(ILineBreak::new(registry, inner).await?))
- }
- organic::types::Object::Target(inner) => {
- Ok(IObject::Target(ITarget::new(registry, inner).await?))
- }
- organic::types::Object::StatisticsCookie(inner) => Ok(IObject::StatisticsCookie(
- IStatisticsCookie::new(registry, inner).await?,
- )),
- organic::types::Object::Subscript(inner) => {
- Ok(IObject::Subscript(ISubscript::new(registry, inner).await?))
- }
- organic::types::Object::Superscript(inner) => Ok(IObject::Superscript(
- ISuperscript::new(registry, inner).await?,
- )),
- organic::types::Object::Timestamp(inner) => {
- Ok(IObject::Timestamp(ITimestamp::new(registry, inner).await?))
+ pub(crate) fn new<'parse, 'b>(
+ registry: &'b mut Registry<'parse>,
+ obj: &'b organic::types::Object<'parse>,
+ ) -> BoxFuture<'b, Result> {
+ async move {
+ match obj {
+ organic::types::Object::Bold(inner) => {
+ Ok(IObject::Bold(IBold::new(registry, inner).await?))
+ }
+ organic::types::Object::Italic(inner) => {
+ Ok(IObject::Italic(IItalic::new(registry, inner).await?))
+ }
+ organic::types::Object::Underline(inner) => {
+ Ok(IObject::Underline(IUnderline::new(registry, inner).await?))
+ }
+ organic::types::Object::StrikeThrough(inner) => Ok(IObject::StrikeThrough(
+ IStrikeThrough::new(registry, inner).await?,
+ )),
+ organic::types::Object::Code(inner) => {
+ Ok(IObject::Code(ICode::new(registry, inner).await?))
+ }
+ organic::types::Object::Verbatim(inner) => {
+ Ok(IObject::Verbatim(IVerbatim::new(registry, inner).await?))
+ }
+ organic::types::Object::PlainText(inner) => {
+ Ok(IObject::PlainText(IPlainText::new(registry, inner).await?))
+ }
+ organic::types::Object::RegularLink(inner) => Ok(IObject::RegularLink(
+ IRegularLink::new(registry, inner).await?,
+ )),
+ organic::types::Object::RadioLink(inner) => {
+ Ok(IObject::RadioLink(IRadioLink::new(registry, inner).await?))
+ }
+ organic::types::Object::RadioTarget(inner) => Ok(IObject::RadioTarget(
+ IRadioTarget::new(registry, inner).await?,
+ )),
+ organic::types::Object::PlainLink(inner) => {
+ Ok(IObject::PlainLink(IPlainLink::new(registry, inner).await?))
+ }
+ organic::types::Object::AngleLink(inner) => {
+ Ok(IObject::AngleLink(IAngleLink::new(registry, inner).await?))
+ }
+ organic::types::Object::OrgMacro(inner) => {
+ Ok(IObject::OrgMacro(IOrgMacro::new(registry, inner).await?))
+ }
+ organic::types::Object::Entity(inner) => {
+ Ok(IObject::Entity(IEntity::new(registry, inner).await?))
+ }
+ organic::types::Object::LatexFragment(inner) => Ok(IObject::LatexFragment(
+ ILatexFragment::new(registry, inner).await?,
+ )),
+ organic::types::Object::ExportSnippet(inner) => Ok(IObject::ExportSnippet(
+ IExportSnippet::new(registry, inner).await?,
+ )),
+ organic::types::Object::FootnoteReference(inner) => Ok(IObject::FootnoteReference(
+ IFootnoteReference::new(registry, inner).await?,
+ )),
+ organic::types::Object::Citation(inner) => {
+ Ok(IObject::Citation(ICitation::new(registry, inner).await?))
+ }
+ organic::types::Object::CitationReference(inner) => Ok(IObject::CitationReference(
+ ICitationReference::new(registry, inner).await?,
+ )),
+ organic::types::Object::InlineBabelCall(inner) => Ok(IObject::InlineBabelCall(
+ IInlineBabelCall::new(registry, inner).await?,
+ )),
+ organic::types::Object::InlineSourceBlock(inner) => Ok(IObject::InlineSourceBlock(
+ IInlineSourceBlock::new(registry, inner).await?,
+ )),
+ organic::types::Object::LineBreak(inner) => {
+ Ok(IObject::LineBreak(ILineBreak::new(registry, inner).await?))
+ }
+ organic::types::Object::Target(inner) => {
+ Ok(IObject::Target(ITarget::new(registry, inner).await?))
+ }
+ organic::types::Object::StatisticsCookie(inner) => Ok(IObject::StatisticsCookie(
+ IStatisticsCookie::new(registry, inner).await?,
+ )),
+ organic::types::Object::Subscript(inner) => {
+ Ok(IObject::Subscript(ISubscript::new(registry, inner).await?))
+ }
+ organic::types::Object::Superscript(inner) => Ok(IObject::Superscript(
+ ISuperscript::new(registry, inner).await?,
+ )),
+ organic::types::Object::Timestamp(inner) => {
+ Ok(IObject::Timestamp(ITimestamp::new(registry, inner).await?))
+ }
}
}
+ .boxed()
}
}
diff --git a/src/intermediate/quote_block.rs b/src/intermediate/quote_block.rs
index d28f7ed..7d471b2 100644
--- a/src/intermediate/quote_block.rs
+++ b/src/intermediate/quote_block.rs
@@ -1,15 +1,26 @@
use crate::error::CustomError;
use super::registry::Registry;
+use super::IElement;
#[derive(Debug)]
-pub(crate) struct IQuoteBlock {}
+pub(crate) struct IQuoteBlock {
+ pub(crate) children: Vec,
+}
impl IQuoteBlock {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::QuoteBlock<'parse>,
) -> Result {
- Ok(IQuoteBlock {})
+ let children = {
+ let mut ret = Vec::new();
+ for obj in original.children.iter() {
+ ret.push(IElement::new(registry, obj).await?);
+ }
+ ret
+ };
+
+ Ok(IQuoteBlock { children })
}
}