diff --git a/src/intermediate/paragraph.rs b/src/intermediate/paragraph.rs index 0b3adac..8254c2d 100644 --- a/src/intermediate/paragraph.rs +++ b/src/intermediate/paragraph.rs @@ -29,3 +29,16 @@ intermediate!( }) } ); + +impl IParagraph { + pub(crate) async fn artificial<'orig, 'parse>( + _intermediate_context: crate::intermediate::IntermediateContext<'orig, 'parse>, + children: Vec, + post_blank: organic::types::PostBlank, + ) -> Result { + Ok(IParagraph { + children, + post_blank, + }) + } +} diff --git a/src/intermediate/registry.rs b/src/intermediate/registry.rs index 64d1800..f1de21d 100644 --- a/src/intermediate/registry.rs +++ b/src/intermediate/registry.rs @@ -5,6 +5,8 @@ use std::collections::HashMap; use super::ast_node::IAstNode; use super::ast_node::IntoIAstNode; +use super::IObject; +use super::IParagraph; use super::IntermediateContext; type IdCounter = u16; @@ -148,13 +150,20 @@ async fn convert_reference_contents<'orig, 'parse>( intermediate_context: IntermediateContext<'orig, 'parse>, contents: &'orig Vec>, ) -> Result, CustomError> { - let contents = { + let children = { let mut ret = Vec::new(); for obj in contents.iter() { - ret.push(obj.into_ast_node(intermediate_context.clone()).await?); + ret.push(IObject::new(intermediate_context.clone(), obj).await?); } ret }; + let containing_paragraph = + IParagraph::artificial(intermediate_context.clone(), children, 0).await?; + let contents = { + let mut ret = Vec::new(); + ret.push(IAstNode::Paragraph(containing_paragraph)); + ret + }; Ok(contents) }