diff --git a/src/intermediate/definition.rs b/src/intermediate/definition.rs index 897b49a..2f62ca7 100644 --- a/src/intermediate/definition.rs +++ b/src/intermediate/definition.rs @@ -61,11 +61,14 @@ impl BlogPost { let mut ret = Vec::new(); for (real_path, _contents, parsed_document) in parsed_org_files.iter() { let relative_to_post_dir_path = real_path.strip_prefix(post_dir)?; - ret.push(BlogPostPage::new( - relative_to_post_dir_path, - &mut registry, - parsed_document, - )?); + ret.push( + BlogPostPage::new( + relative_to_post_dir_path, + &mut registry, + parsed_document, + ) + .await?, + ); } ret }; diff --git a/src/intermediate/element.rs b/src/intermediate/element.rs index 1b1370c..c891a1a 100644 --- a/src/intermediate/element.rs +++ b/src/intermediate/element.rs @@ -9,13 +9,13 @@ pub(crate) enum IElement { } impl IElement { - pub(crate) fn new<'parse>( + 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)?)) + Ok(IElement::Paragraph(IParagraph::new(registry, inner).await?)) } organic::types::Element::PlainList(_) => todo!(), organic::types::Element::CenterBlock(_) => todo!(), diff --git a/src/intermediate/heading.rs b/src/intermediate/heading.rs index a12f550..17cc680 100644 --- a/src/intermediate/heading.rs +++ b/src/intermediate/heading.rs @@ -10,15 +10,17 @@ pub(crate) struct IHeading { } impl IHeading { - pub(crate) fn new<'parse>( + pub(crate) async fn new<'parse>( registry: &mut Registry<'parse>, heading: &organic::types::Heading<'parse>, ) -> Result { - let title = heading - .title - .iter() - .map(|obj| IObject::new(registry, obj)) - .collect::, _>>()?; + let title = { + let mut ret = Vec::new(); + for obj in heading.title.iter() { + ret.push(IObject::new(registry, obj).await?); + } + ret + }; Ok(IHeading { title, level: heading.level, diff --git a/src/intermediate/object.rs b/src/intermediate/object.rs index 5b74111..3506a00 100644 --- a/src/intermediate/object.rs +++ b/src/intermediate/object.rs @@ -11,7 +11,7 @@ pub(crate) enum IObject { } impl IObject { - pub(crate) fn new<'parse>( + pub(crate) async fn new<'parse>( registry: &mut Registry<'parse>, obj: &organic::types::Object<'parse>, ) -> Result { @@ -23,7 +23,7 @@ impl IObject { organic::types::Object::Code(_) => todo!(), organic::types::Object::Verbatim(_) => todo!(), organic::types::Object::PlainText(inner) => { - Ok(IObject::PlainText(IPlainText::new(registry, inner)?)) + Ok(IObject::PlainText(IPlainText::new(registry, inner).await?)) } organic::types::Object::RegularLink(_) => todo!(), organic::types::Object::RadioLink(_) => todo!(), @@ -41,7 +41,7 @@ impl IObject { organic::types::Object::InlineSourceBlock(_) => todo!(), organic::types::Object::LineBreak(_) => todo!(), organic::types::Object::Target(inner) => { - Ok(IObject::Target(ITarget::new(registry, inner)?)) + Ok(IObject::Target(ITarget::new(registry, inner).await?)) } organic::types::Object::StatisticsCookie(_) => todo!(), organic::types::Object::Subscript(_) => todo!(), diff --git a/src/intermediate/page.rs b/src/intermediate/page.rs index a4e9532..c512d46 100644 --- a/src/intermediate/page.rs +++ b/src/intermediate/page.rs @@ -18,7 +18,7 @@ pub(crate) struct BlogPostPage { } impl BlogPostPage { - pub(crate) fn new<'parse, P: Into>( + pub(crate) async fn new<'parse, P: Into>( path: P, registry: &mut Registry<'parse>, document: &organic::types::Document<'parse>, @@ -26,10 +26,14 @@ impl BlogPostPage { let path = path.into(); let mut children = Vec::new(); if let Some(section) = document.zeroth_section.as_ref() { - children.push(IDocumentElement::Section(ISection::new(registry, section)?)); + children.push(IDocumentElement::Section( + ISection::new(registry, section).await?, + )); } for heading in document.children.iter() { - children.push(IDocumentElement::Heading(IHeading::new(registry, heading)?)); + children.push(IDocumentElement::Heading( + IHeading::new(registry, heading).await?, + )); } Ok(BlogPostPage { diff --git a/src/intermediate/paragraph.rs b/src/intermediate/paragraph.rs index e40a47f..09cf1be 100644 --- a/src/intermediate/paragraph.rs +++ b/src/intermediate/paragraph.rs @@ -9,15 +9,17 @@ pub(crate) struct IParagraph { } impl IParagraph { - pub(crate) fn new<'parse>( + pub(crate) async fn new<'parse>( registry: &mut Registry<'parse>, paragraph: &organic::types::Paragraph<'parse>, ) -> Result { - let children = paragraph - .children - .iter() - .map(|obj| IObject::new(registry, obj)) - .collect::, _>>()?; + let children = { + let mut ret = Vec::new(); + for obj in paragraph.children.iter() { + ret.push(IObject::new(registry, obj).await?); + } + ret + }; Ok(IParagraph { children }) } diff --git a/src/intermediate/plain_text.rs b/src/intermediate/plain_text.rs index f794680..490c843 100644 --- a/src/intermediate/plain_text.rs +++ b/src/intermediate/plain_text.rs @@ -9,9 +9,9 @@ pub(crate) struct IPlainText { } impl IPlainText { - pub(crate) fn new( - registry: &mut Registry<'_>, - plain_text: &organic::types::PlainText<'_>, + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + plain_text: &organic::types::PlainText<'parse>, ) -> Result { Ok(IPlainText { source: coalesce_whitespace(plain_text.source).into_owned(), diff --git a/src/intermediate/section.rs b/src/intermediate/section.rs index 5e129e9..c9426e6 100644 --- a/src/intermediate/section.rs +++ b/src/intermediate/section.rs @@ -9,15 +9,17 @@ pub(crate) struct ISection { } impl ISection { - pub(crate) fn new<'parse>( + pub(crate) async fn new<'parse>( registry: &mut Registry<'parse>, section: &organic::types::Section<'parse>, ) -> Result { - let children = section - .children - .iter() - .map(|obj| IElement::new(registry, obj)) - .collect::, _>>()?; + let children = { + let mut ret = Vec::new(); + for elem in section.children.iter() { + ret.push(IElement::new(registry, elem).await?); + } + ret + }; Ok(ISection { children }) } diff --git a/src/intermediate/target.rs b/src/intermediate/target.rs index a62124b..1a594de 100644 --- a/src/intermediate/target.rs +++ b/src/intermediate/target.rs @@ -10,7 +10,7 @@ pub(crate) struct ITarget { } impl ITarget { - pub(crate) fn new<'parse>( + pub(crate) async fn new<'parse>( registry: &mut Registry<'parse>, target: &organic::types::Target<'parse>, ) -> Result {