natter/src/intermediate/paragraph.rs
Tom Alexander 4fb08bc7d0
Wrap inline footnote definitions in a paragraph tag.
This is to match the behavior of the upstream org html exporter.
2023-12-21 18:09:43 -05:00

45 lines
1.1 KiB
Rust

use super::macros::intermediate;
use super::IObject;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct IParagraph {
pub(crate) children: Vec<IObject>,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
IParagraph,
&'orig organic::types::Paragraph<'parse>,
original,
intermediate_context,
{
let children = {
let mut ret = Vec::new();
for obj in original.children.iter() {
ret.push(IObject::new(intermediate_context.clone(), obj).await?);
}
ret
};
Ok(IParagraph {
children,
post_blank: original.get_post_blank(),
})
}
);
impl IParagraph {
pub(crate) async fn artificial<'orig, 'parse>(
_intermediate_context: crate::intermediate::IntermediateContext<'orig, 'parse>,
children: Vec<IObject>,
post_blank: organic::types::PostBlank,
) -> Result<IParagraph, CustomError> {
Ok(IParagraph {
children,
post_blank,
})
}
}