Use macros for creating the intermediate stage.

This is to make it easier to change function signatures by consolidating the places where the signatures exist.
This commit is contained in:
Tom Alexander 2023-10-29 17:29:16 -04:00
parent ba511b7f9e
commit f98a09bc59
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
62 changed files with 565 additions and 972 deletions

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IAngleLink, AngleLink);
#[derive(Debug, Clone)]
pub(crate) struct IAngleLink {}
impl IAngleLink {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::AngleLink<'parse>,
) -> Result<IAngleLink, CustomError> {
Ok(IAngleLink {})
}
}

View File

@ -113,19 +113,19 @@ pub(crate) enum IAstNode {
} }
pub(crate) trait IntoIAstNode { pub(crate) trait IntoIAstNode {
fn into_ast_node<'parse, 'b>( fn into_ast_node<'reg, 'orig, 'parse, 'inp: 'reg + 'orig>(
&'b self, &'orig self,
registry: &'b mut Registry<'parse>, registry: &'reg mut Registry<'orig, 'parse>,
) -> BoxFuture<'b, Result<IAstNode, CustomError>> ) -> BoxFuture<'inp, Result<IAstNode, CustomError>>
where where
Self: 'parse; Self: 'parse;
} }
impl IntoIAstNode for organic::types::DocumentElement<'_> { impl IntoIAstNode for organic::types::DocumentElement<'_> {
fn into_ast_node<'parse, 'b>( fn into_ast_node<'reg, 'orig, 'parse, 'inp: 'reg + 'orig>(
&'b self, &'orig self,
registry: &'b mut Registry<'parse>, registry: &'reg mut Registry<'orig, 'parse>,
) -> BoxFuture<'b, Result<IAstNode, CustomError>> ) -> BoxFuture<'inp, Result<IAstNode, CustomError>>
where where
Self: 'parse, Self: 'parse,
{ {
@ -144,10 +144,10 @@ impl IntoIAstNode for organic::types::DocumentElement<'_> {
} }
impl IntoIAstNode for organic::types::Element<'_> { impl IntoIAstNode for organic::types::Element<'_> {
fn into_ast_node<'parse, 'b>( fn into_ast_node<'reg, 'orig, 'parse, 'inp: 'reg + 'orig>(
&'b self, &'orig self,
registry: &'b mut Registry<'parse>, registry: &'reg mut Registry<'orig, 'parse>,
) -> BoxFuture<'b, Result<IAstNode, CustomError>> ) -> BoxFuture<'inp, Result<IAstNode, CustomError>>
where where
Self: 'parse, Self: 'parse,
{ {
@ -232,10 +232,10 @@ impl IntoIAstNode for organic::types::Element<'_> {
} }
impl IntoIAstNode for organic::types::Object<'_> { impl IntoIAstNode for organic::types::Object<'_> {
fn into_ast_node<'parse, 'b>( fn into_ast_node<'reg, 'orig, 'parse, 'inp: 'reg + 'orig>(
&'b self, &'orig self,
registry: &'b mut Registry<'parse>, registry: &'reg mut Registry<'orig, 'parse>,
) -> BoxFuture<'b, Result<IAstNode, CustomError>> ) -> BoxFuture<'inp, Result<IAstNode, CustomError>>
where where
Self: 'parse, Self: 'parse,
{ {

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IBabelCall, BabelCall);
#[derive(Debug, Clone)]
pub(crate) struct IBabelCall {}
impl IBabelCall {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::BabelCall<'parse>,
) -> Result<IBabelCall, CustomError> {
Ok(IBabelCall {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IBold, Bold);
#[derive(Debug, Clone)]
pub(crate) struct IBold {}
impl IBold {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Bold<'parse>,
) -> Result<IBold, CustomError> {
Ok(IBold {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(ICenterBlock, CenterBlock);
#[derive(Debug, Clone)]
pub(crate) struct ICenterBlock {}
impl ICenterBlock {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::CenterBlock<'parse>,
) -> Result<ICenterBlock, CustomError> {
Ok(ICenterBlock {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(ICitation, Citation);
#[derive(Debug, Clone)]
pub(crate) struct ICitation {}
impl ICitation {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Citation<'parse>,
) -> Result<ICitation, CustomError> {
Ok(ICitation {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(ICitationReference, CitationReference);
#[derive(Debug, Clone)]
pub(crate) struct ICitationReference {}
impl ICitationReference {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::CitationReference<'parse>,
) -> Result<ICitationReference, CustomError> {
Ok(ICitationReference {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IClock, Clock);
#[derive(Debug, Clone)]
pub(crate) struct IClock {}
impl IClock {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Clock<'parse>,
) -> Result<IClock, CustomError> {
Ok(IClock {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(ICode, Code);
#[derive(Debug, Clone)]
pub(crate) struct ICode {}
impl ICode {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Code<'parse>,
) -> Result<ICode, CustomError> {
Ok(ICode {})
}
}

View File

@ -1,16 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IComment, Comment);
/// Essentially a no-op since the comment is not rendered.
#[derive(Debug, Clone)]
pub(crate) struct IComment {}
impl IComment {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
comment: &'b organic::types::Comment<'parse>,
) -> Result<IComment, CustomError> {
Ok(IComment {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(ICommentBlock, CommentBlock);
#[derive(Debug, Clone)]
pub(crate) struct ICommentBlock {}
impl ICommentBlock {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::CommentBlock<'parse>,
) -> Result<ICommentBlock, CustomError> {
Ok(ICommentBlock {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IDiarySexp, DiarySexp);
#[derive(Debug, Clone)]
pub(crate) struct IDiarySexp {}
impl IDiarySexp {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::DiarySexp<'parse>,
) -> Result<IDiarySexp, CustomError> {
Ok(IDiarySexp {})
}
}

View File

@ -1,8 +1,8 @@
use crate::error::CustomError; use super::macros::iselector;
use super::registry::Registry; use super::registry::Registry;
use super::IHeading; use super::IHeading;
use super::ISection; use super::ISection;
use crate::error::CustomError;
use futures::future::{BoxFuture, FutureExt}; use futures::future::{BoxFuture, FutureExt};
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -11,13 +11,11 @@ pub(crate) enum IDocumentElement {
Section(ISection), Section(ISection),
} }
impl IDocumentElement { iselector!(
pub(crate) fn new<'parse, 'b>( IDocumentElement,
registry: &'b mut Registry<'parse>, DocumentElement,
original: &'b organic::types::DocumentElement<'parse>, |registry, original| async {
) -> BoxFuture<'b, Result<IDocumentElement, CustomError>> { match &original {
async move {
match original {
organic::types::DocumentElement::Heading(inner) => Ok(IDocumentElement::Heading( organic::types::DocumentElement::Heading(inner) => Ok(IDocumentElement::Heading(
IHeading::new(registry, inner).await?, IHeading::new(registry, inner).await?,
)), )),
@ -26,6 +24,4 @@ impl IDocumentElement {
)), )),
} }
} }
.boxed() );
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IDrawer, Drawer);
#[derive(Debug, Clone)]
pub(crate) struct IDrawer {}
impl IDrawer {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Drawer<'parse>,
) -> Result<IDrawer, CustomError> {
Ok(IDrawer {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IDynamicBlock, DynamicBlock);
#[derive(Debug, Clone)]
pub(crate) struct IDynamicBlock {}
impl IDynamicBlock {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::DynamicBlock<'parse>,
) -> Result<IDynamicBlock, CustomError> {
Ok(IDynamicBlock {})
}
}

View File

@ -1,7 +1,6 @@
use crate::error::CustomError;
use super::comment::IComment; use super::comment::IComment;
use super::keyword::IKeyword; use super::keyword::IKeyword;
use super::macros::iselector;
use super::registry::Registry; use super::registry::Registry;
use super::IBabelCall; use super::IBabelCall;
use super::ICenterBlock; use super::ICenterBlock;
@ -16,6 +15,7 @@ use super::IFixedWidthArea;
use super::IFootnoteDefinition; use super::IFootnoteDefinition;
use super::IHorizontalRule; use super::IHorizontalRule;
use super::ILatexEnvironment; use super::ILatexEnvironment;
use super::IObject;
use super::IParagraph; use super::IParagraph;
use super::IPlainList; use super::IPlainList;
use super::IPlanning; use super::IPlanning;
@ -25,6 +25,7 @@ use super::ISpecialBlock;
use super::ISrcBlock; use super::ISrcBlock;
use super::ITable; use super::ITable;
use super::IVerseBlock; use super::IVerseBlock;
use crate::error::CustomError;
use futures::future::{BoxFuture, FutureExt}; use futures::future::{BoxFuture, FutureExt};
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -55,12 +56,7 @@ pub(crate) enum IElement {
LatexEnvironment(ILatexEnvironment), LatexEnvironment(ILatexEnvironment),
} }
impl IElement { iselector!(IElement, Element, |registry, elem| async {
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 { match elem {
organic::types::Element::Paragraph(inner) => { organic::types::Element::Paragraph(inner) => {
Ok(IElement::Paragraph(IParagraph::new(registry, inner).await?)) Ok(IElement::Paragraph(IParagraph::new(registry, inner).await?))
@ -80,9 +76,9 @@ impl IElement {
organic::types::Element::DynamicBlock(inner) => Ok(IElement::DynamicBlock( organic::types::Element::DynamicBlock(inner) => Ok(IElement::DynamicBlock(
IDynamicBlock::new(registry, inner).await?, IDynamicBlock::new(registry, inner).await?,
)), )),
organic::types::Element::FootnoteDefinition(inner) => Ok( organic::types::Element::FootnoteDefinition(inner) => Ok(IElement::FootnoteDefinition(
IElement::FootnoteDefinition(IFootnoteDefinition::new(registry, inner).await?), IFootnoteDefinition::new(registry, inner).await?,
), )),
organic::types::Element::Comment(inner) => { organic::types::Element::Comment(inner) => {
Ok(IElement::Comment(IComment::new(registry, inner).await?)) Ok(IElement::Comment(IComment::new(registry, inner).await?))
} }
@ -135,7 +131,4 @@ impl IElement {
ILatexEnvironment::new(registry, inner).await?, ILatexEnvironment::new(registry, inner).await?,
)), )),
} }
} });
.boxed()
}
}

View File

@ -1,19 +1,14 @@
use crate::error::CustomError; use super::macros::intermediate;
use super::registry::Registry; use super::registry::Registry;
use crate::error::CustomError;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct IEntity { pub(crate) struct IEntity {
pub(crate) html: String, pub(crate) html: String,
} }
impl IEntity { intermediate!(IEntity, Entity, |registry, original| async {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Entity<'parse>,
) -> Result<IEntity, CustomError> {
Ok(IEntity { Ok(IEntity {
html: original.html.to_owned(), html: original.html.to_owned(),
}) })
} });
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IExampleBlock, ExampleBlock);
#[derive(Debug, Clone)]
pub(crate) struct IExampleBlock {}
impl IExampleBlock {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::ExampleBlock<'parse>,
) -> Result<IExampleBlock, CustomError> {
Ok(IExampleBlock {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IExportBlock, ExportBlock);
#[derive(Debug, Clone)]
pub(crate) struct IExportBlock {}
impl IExportBlock {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::ExportBlock<'parse>,
) -> Result<IExportBlock, CustomError> {
Ok(IExportBlock {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IExportSnippet, ExportSnippet);
#[derive(Debug, Clone)]
pub(crate) struct IExportSnippet {}
impl IExportSnippet {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::ExportSnippet<'parse>,
) -> Result<IExportSnippet, CustomError> {
Ok(IExportSnippet {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IFixedWidthArea, FixedWidthArea);
#[derive(Debug, Clone)]
pub(crate) struct IFixedWidthArea {}
impl IFixedWidthArea {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::FixedWidthArea<'parse>,
) -> Result<IFixedWidthArea, CustomError> {
Ok(IFixedWidthArea {})
}
}

View File

@ -1,24 +1,21 @@
use crate::error::CustomError; use super::macros::intermediate;
use super::ast_node::IAstNode;
use super::registry::Registry; use super::registry::Registry;
use super::IElement; use super::IAstNode;
use super::IObject; use crate::error::CustomError;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct IFootnoteDefinition {} pub(crate) struct IFootnoteDefinition {}
impl IFootnoteDefinition { intermediate!(
pub(crate) async fn new<'b, 'parse>( IFootnoteDefinition,
registry: &'b mut Registry<'parse>, FootnoteDefinition,
original: &'b organic::types::FootnoteDefinition<'parse>, |registry, original| async {
) -> Result<IFootnoteDefinition, CustomError> {
registry registry
.register_footnote_definition(original.label, &original.children) .register_footnote_definition(original.label, &original.children)
.await?; .await?;
Ok(IFootnoteDefinition {}) Ok(IFootnoteDefinition {})
} }
} );
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct IRealFootnoteDefinition { pub(crate) struct IRealFootnoteDefinition {
@ -27,8 +24,8 @@ pub(crate) struct IRealFootnoteDefinition {
} }
impl IRealFootnoteDefinition { impl IRealFootnoteDefinition {
pub(crate) async fn new<'b, 'parse>( pub(crate) async fn new<'reg, 'orig, 'parse>(
registry: &'b mut Registry<'parse>, registry: &'reg mut Registry<'orig, 'parse>,
footnote_id: usize, footnote_id: usize,
contents: Vec<IAstNode>, contents: Vec<IAstNode>,
) -> Result<IRealFootnoteDefinition, CustomError> { ) -> Result<IRealFootnoteDefinition, CustomError> {

View File

@ -1,6 +1,6 @@
use crate::error::CustomError; use super::macros::intermediate;
use super::registry::Registry; use super::registry::Registry;
use crate::error::CustomError;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct IFootnoteReference { pub(crate) struct IFootnoteReference {
@ -8,11 +8,10 @@ pub(crate) struct IFootnoteReference {
duplicate_offset: usize, duplicate_offset: usize,
} }
impl IFootnoteReference { intermediate!(
pub(crate) async fn new<'b, 'parse>( IFootnoteReference,
registry: &'b mut Registry<'parse>, FootnoteReference,
original: &'b organic::types::FootnoteReference<'parse>, |registry, original| async {
) -> Result<IFootnoteReference, CustomError> {
let footnote_id = registry let footnote_id = registry
.get_footnote_reference_id(original.label, &original.definition) .get_footnote_reference_id(original.label, &original.definition)
.await?; .await?;
@ -21,7 +20,9 @@ impl IFootnoteReference {
duplicate_offset: 0, // TODO duplicate_offset: 0, // TODO
}) })
} }
);
impl IFootnoteReference {
pub(crate) fn get_display_label(&self) -> String { pub(crate) fn get_display_label(&self) -> String {
format!("{}", self.footnote_id + 1) format!("{}", self.footnote_id + 1)
} }

View File

@ -1,8 +1,8 @@
use crate::error::CustomError; use super::macros::intermediate;
use super::registry::Registry; use super::registry::Registry;
use super::IDocumentElement; use super::IDocumentElement;
use super::IObject; use super::IObject;
use crate::error::CustomError;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct IHeading { pub(crate) struct IHeading {
@ -11,11 +11,7 @@ pub(crate) struct IHeading {
pub(crate) children: Vec<IDocumentElement>, pub(crate) children: Vec<IDocumentElement>,
} }
impl IHeading { intermediate!(IHeading, Heading, |registry, original| async {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Heading<'parse>,
) -> Result<IHeading, CustomError> {
let title = { let title = {
let mut ret = Vec::new(); let mut ret = Vec::new();
for obj in original.title.iter() { for obj in original.title.iter() {
@ -35,5 +31,4 @@ impl IHeading {
level: original.level, level: original.level,
children, children,
}) })
} });
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IHorizontalRule, HorizontalRule);
#[derive(Debug, Clone)]
pub(crate) struct IHorizontalRule {}
impl IHorizontalRule {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::HorizontalRule<'parse>,
) -> Result<IHorizontalRule, CustomError> {
Ok(IHorizontalRule {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IInlineBabelCall, InlineBabelCall);
#[derive(Debug, Clone)]
pub(crate) struct IInlineBabelCall {}
impl IInlineBabelCall {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::InlineBabelCall<'parse>,
) -> Result<IInlineBabelCall, CustomError> {
Ok(IInlineBabelCall {})
}
}

View File

@ -1,19 +1,18 @@
use crate::error::CustomError; use super::macros::intermediate;
use super::registry::Registry; use super::registry::Registry;
use crate::error::CustomError;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct IInlineSourceBlock { pub(crate) struct IInlineSourceBlock {
pub(crate) value: String, pub(crate) value: String,
} }
impl IInlineSourceBlock { intermediate!(
pub(crate) async fn new<'b, 'parse>( IInlineSourceBlock,
registry: &'b mut Registry<'parse>, InlineSourceBlock,
original: &'b organic::types::InlineSourceBlock<'parse>, |registry, original| async {
) -> Result<IInlineSourceBlock, CustomError> {
Ok(IInlineSourceBlock { Ok(IInlineSourceBlock {
value: original.value.to_owned(), value: original.value.to_owned(),
}) })
} }
} );

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IItalic, Italic);
#[derive(Debug, Clone)]
pub(crate) struct IItalic {}
impl IItalic {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Italic<'parse>,
) -> Result<IItalic, CustomError> {
Ok(IItalic {})
}
}

View File

@ -1,16 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IKeyword, Keyword);
/// Essentially a no-op since the keyword is not rendered and any relevant impact on other elements is pulled from the parsed form of keyword.
#[derive(Debug, Clone)]
pub(crate) struct IKeyword {}
impl IKeyword {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
keyword: &'b organic::types::Keyword<'parse>,
) -> Result<IKeyword, CustomError> {
Ok(IKeyword {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(ILatexEnvironment, LatexEnvironment);
#[derive(Debug, Clone)]
pub(crate) struct ILatexEnvironment {}
impl ILatexEnvironment {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::LatexEnvironment<'parse>,
) -> Result<ILatexEnvironment, CustomError> {
Ok(ILatexEnvironment {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(ILatexFragment, LatexFragment);
#[derive(Debug, Clone)]
pub(crate) struct ILatexFragment {}
impl ILatexFragment {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::LatexFragment<'parse>,
) -> Result<ILatexFragment, CustomError> {
Ok(ILatexFragment {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(ILineBreak, LineBreak);
#[derive(Debug, Clone)]
pub(crate) struct ILineBreak {}
impl ILineBreak {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::LineBreak<'parse>,
) -> Result<ILineBreak, CustomError> {
Ok(ILineBreak {})
}
}

View File

@ -0,0 +1,56 @@
/// Write the implementation for the intermediate ast node for a type that is a noop or is not yet implemented.
///
/// This exists to make changing the type signature easier.
macro_rules! inoop {
($istruct:ident, $pstruct:ident) => {
#[derive(Debug, Clone)]
pub(crate) struct $istruct {}
impl $istruct {
pub(crate) async fn new<'reg, 'orig, 'parse>(
registry: &'reg mut Registry<'orig, 'parse>,
original: &'orig organic::types::$pstruct<'parse>,
) -> Result<$istruct, CustomError> {
Ok($istruct {})
}
}
};
}
pub(crate) use inoop;
/// Write the implementation for the intermediate ast node.
///
/// This exists to make changing the type signature easier.
macro_rules! intermediate {
($istruct:ident, $pstruct:ident, $fnbody:expr) => {
impl $istruct {
pub(crate) async fn new<'reg, 'orig, 'parse>(
registry: &'reg mut Registry<'orig, 'parse>,
original: &'orig organic::types::$pstruct<'parse>,
) -> Result<$istruct, CustomError> {
$fnbody(registry, original).await
}
}
};
}
pub(crate) use intermediate;
/// Write the implementation for the intermediate ast node.
///
/// This exists to make changing the type signature easier.
macro_rules! iselector {
($istruct:ident, $pstruct:ident, $fnbody:expr) => {
impl $istruct {
pub(crate) fn new<'reg, 'orig, 'parse, 'inp: 'reg + 'orig>(
registry: &'reg mut Registry<'orig, 'parse>,
original: &'orig organic::types::$pstruct<'parse>,
) -> BoxFuture<'inp, Result<$istruct, CustomError>> {
$fnbody(registry, original).boxed()
}
}
};
}
pub(crate) use iselector;

View File

@ -32,6 +32,7 @@ mod keyword;
mod latex_environment; mod latex_environment;
mod latex_fragment; mod latex_fragment;
mod line_break; mod line_break;
mod macros;
mod object; mod object;
mod org_macro; mod org_macro;
mod page; mod page;

View File

@ -13,6 +13,7 @@ use super::inline_source_block::IInlineSourceBlock;
use super::italic::IItalic; use super::italic::IItalic;
use super::latex_fragment::ILatexFragment; use super::latex_fragment::ILatexFragment;
use super::line_break::ILineBreak; use super::line_break::ILineBreak;
use super::macros::iselector;
use super::org_macro::IOrgMacro; use super::org_macro::IOrgMacro;
use super::plain_link::IPlainLink; use super::plain_link::IPlainLink;
use super::plain_text::IPlainText; use super::plain_text::IPlainText;
@ -61,13 +62,8 @@ pub(crate) enum IObject {
Timestamp(ITimestamp), Timestamp(ITimestamp),
} }
impl IObject { iselector!(IObject, Object, |registry, obj| async {
pub(crate) fn new<'parse, 'b>( match &obj {
registry: &'b mut Registry<'parse>,
obj: &'b organic::types::Object<'parse>,
) -> BoxFuture<'b, Result<IObject, CustomError>> {
async move {
match obj {
organic::types::Object::Bold(inner) => { organic::types::Object::Bold(inner) => {
Ok(IObject::Bold(IBold::new(registry, inner).await?)) Ok(IObject::Bold(IBold::new(registry, inner).await?))
} }
@ -150,7 +146,4 @@ impl IObject {
Ok(IObject::Timestamp(ITimestamp::new(registry, inner).await?)) Ok(IObject::Timestamp(ITimestamp::new(registry, inner).await?))
} }
} }
} });
.boxed()
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IOrgMacro, OrgMacro);
#[derive(Debug, Clone)]
pub(crate) struct IOrgMacro {}
impl IOrgMacro {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::OrgMacro<'parse>,
) -> Result<IOrgMacro, CustomError> {
Ok(IOrgMacro {})
}
}

View File

@ -21,9 +21,10 @@ pub(crate) struct BlogPostPage {
} }
impl BlogPostPage { impl BlogPostPage {
pub(crate) async fn new<'b, 'parse, P: Into<PathBuf>>( // TODO: Move path into the registry so I can give this a standard interface like the others.
pub(crate) async fn new<'a, 'b, 'parse, P: Into<PathBuf>>(
path: P, path: P,
registry: &'b mut Registry<'parse>, registry: &'a mut Registry<'b, 'parse>,
document: &'b organic::types::Document<'parse>, document: &'b organic::types::Document<'parse>,
) -> Result<BlogPostPage, CustomError> { ) -> Result<BlogPostPage, CustomError> {
let path = path.into(); let path = path.into();

View File

@ -1,18 +1,14 @@
use crate::error::CustomError; use super::macros::intermediate;
use super::registry::Registry; use super::registry::Registry;
use super::IObject; use super::IObject;
use crate::error::CustomError;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct IParagraph { pub(crate) struct IParagraph {
pub(crate) children: Vec<IObject>, pub(crate) children: Vec<IObject>,
} }
impl IParagraph { intermediate!(IParagraph, Paragraph, |registry, original| async {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Paragraph<'parse>,
) -> Result<IParagraph, CustomError> {
let children = { let children = {
let mut ret = Vec::new(); let mut ret = Vec::new();
for obj in original.children.iter() { for obj in original.children.iter() {
@ -22,5 +18,4 @@ impl IParagraph {
}; };
Ok(IParagraph { children }) Ok(IParagraph { children })
} });
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IPlainLink, PlainLink);
#[derive(Debug, Clone)]
pub(crate) struct IPlainLink {}
impl IPlainLink {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::PlainLink<'parse>,
) -> Result<IPlainLink, CustomError> {
Ok(IPlainLink {})
}
}

View File

@ -1,7 +1,7 @@
use crate::error::CustomError; use super::macros::intermediate;
use super::registry::Registry; use super::registry::Registry;
use super::IPlainListItem; use super::IPlainListItem;
use crate::error::CustomError;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct IPlainList { pub(crate) struct IPlainList {
@ -9,11 +9,7 @@ pub(crate) struct IPlainList {
pub(crate) children: Vec<IPlainListItem>, pub(crate) children: Vec<IPlainListItem>,
} }
impl IPlainList { intermediate!(IPlainList, PlainList, |registry, original| async {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::PlainList<'parse>,
) -> Result<IPlainList, CustomError> {
let children = { let children = {
let mut ret = Vec::new(); let mut ret = Vec::new();
for obj in original.children.iter() { for obj in original.children.iter() {
@ -26,5 +22,4 @@ impl IPlainList {
list_type: original.list_type, list_type: original.list_type,
children, children,
}) })
} });
}

View File

@ -1,8 +1,8 @@
use crate::error::CustomError; use super::macros::intermediate;
use super::registry::Registry; use super::registry::Registry;
use super::IElement; use super::IElement;
use super::IObject; use super::IObject;
use crate::error::CustomError;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct IPlainListItem { pub(crate) struct IPlainListItem {
@ -10,11 +10,7 @@ pub(crate) struct IPlainListItem {
pub(crate) children: Vec<IElement>, pub(crate) children: Vec<IElement>,
} }
impl IPlainListItem { intermediate!(IPlainListItem, PlainListItem, |registry, original| async {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::PlainListItem<'parse>,
) -> Result<IPlainListItem, CustomError> {
let tag = { let tag = {
let mut ret = Vec::new(); let mut ret = Vec::new();
for obj in original.tag.iter() { for obj in original.tag.iter() {
@ -32,5 +28,4 @@ impl IPlainListItem {
}; };
Ok(IPlainListItem { tag, children }) Ok(IPlainListItem { tag, children })
} });
}

View File

@ -1,20 +1,15 @@
use crate::error::CustomError; use super::macros::intermediate;
use crate::intermediate::util::coalesce_whitespace;
use super::registry::Registry; use super::registry::Registry;
use super::util::coalesce_whitespace;
use crate::error::CustomError;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct IPlainText { pub(crate) struct IPlainText {
pub(crate) source: String, pub(crate) source: String,
} }
impl IPlainText { intermediate!(IPlainText, PlainText, |registry, original| async {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
plain_text: &'b organic::types::PlainText<'parse>,
) -> Result<IPlainText, CustomError> {
Ok(IPlainText { Ok(IPlainText {
source: coalesce_whitespace(plain_text.source).into_owned(), source: coalesce_whitespace(original.source).into_owned(),
}) })
} });
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IPlanning, Planning);
#[derive(Debug, Clone)]
pub(crate) struct IPlanning {}
impl IPlanning {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Planning<'parse>,
) -> Result<IPlanning, CustomError> {
Ok(IPlanning {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IPropertyDrawer, PropertyDrawer);
#[derive(Debug, Clone)]
pub(crate) struct IPropertyDrawer {}
impl IPropertyDrawer {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::PropertyDrawer<'parse>,
) -> Result<IPropertyDrawer, CustomError> {
Ok(IPropertyDrawer {})
}
}

View File

@ -1,18 +1,14 @@
use crate::error::CustomError; use super::macros::intermediate;
use super::registry::Registry; use super::registry::Registry;
use super::IElement; use super::IElement;
use crate::error::CustomError;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct IQuoteBlock { pub(crate) struct IQuoteBlock {
pub(crate) children: Vec<IElement>, pub(crate) children: Vec<IElement>,
} }
impl IQuoteBlock { intermediate!(IQuoteBlock, QuoteBlock, |registry, original| async {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::QuoteBlock<'parse>,
) -> Result<IQuoteBlock, CustomError> {
let children = { let children = {
let mut ret = Vec::new(); let mut ret = Vec::new();
for obj in original.children.iter() { for obj in original.children.iter() {
@ -22,5 +18,4 @@ impl IQuoteBlock {
}; };
Ok(IQuoteBlock { children }) Ok(IQuoteBlock { children })
} });
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IRadioLink, RadioLink);
#[derive(Debug, Clone)]
pub(crate) struct IRadioLink {}
impl IRadioLink {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::RadioLink<'parse>,
) -> Result<IRadioLink, CustomError> {
Ok(IRadioLink {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IRadioTarget, RadioTarget);
#[derive(Debug, Clone)]
pub(crate) struct IRadioTarget {}
impl IRadioTarget {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::RadioTarget<'parse>,
) -> Result<IRadioTarget, CustomError> {
Ok(IRadioTarget {})
}
}

View File

@ -9,14 +9,17 @@ use super::ast_node::IAstNode;
type IdCounter = u16; type IdCounter = u16;
pub(crate) struct Registry<'parse> { pub(crate) struct Registry<'orig, 'parse> {
id_counter: IdCounter, id_counter: IdCounter,
targets: HashMap<&'parse str, String>, targets: HashMap<&'parse str, String>,
footnote_ids: Vec<(Option<&'parse str>, Vec<IAstNode>)>, footnote_ids: Vec<(
Option<&'parse str>,
FootnoteDefinitionContents<'orig, 'parse>,
)>,
} }
impl<'parse> Registry<'parse> { impl<'orig, 'parse> Registry<'orig, 'parse> {
pub(crate) fn new() -> Registry<'parse> { pub(crate) fn new() -> Registry<'orig, 'parse> {
Registry { Registry {
id_counter: 0, id_counter: 0,
targets: HashMap::new(), targets: HashMap::new(),
@ -24,7 +27,7 @@ impl<'parse> Registry<'parse> {
} }
} }
pub(crate) fn get_target<'b>(&'b mut self, body: &'parse str) -> &'b String { pub(crate) fn get_target<'reg>(&'reg mut self, body: &'parse str) -> &'reg String {
self.targets.entry(body).or_insert_with(|| { self.targets.entry(body).or_insert_with(|| {
self.id_counter += 1; self.id_counter += 1;
format!("target_{}", self.id_counter) format!("target_{}", self.id_counter)
@ -32,19 +35,21 @@ impl<'parse> Registry<'parse> {
} }
pub(crate) fn get_footnote_ids(&self) -> impl Iterator<Item = (usize, &Vec<IAstNode>)> { pub(crate) fn get_footnote_ids(&self) -> impl Iterator<Item = (usize, &Vec<IAstNode>)> {
self.footnote_ids // TODO
.iter() std::iter::empty()
.map(|(_label, definition)| definition) // self.footnote_ids
.enumerate() // .iter()
// .map(|(_label, definition)| definition)
// .enumerate()
} }
/// Get a 0-indexed ID for a footnote. /// Get a 0-indexed ID for a footnote.
/// ///
/// This needs to be incremented to be 1-indexed for render. /// This needs to be incremented to be 1-indexed for render.
pub(crate) async fn get_footnote_reference_id<'b>( pub(crate) async fn get_footnote_reference_id<'reg>(
&'b mut self, &'reg mut self,
label: Option<&'parse str>, label: Option<&'parse str>,
definition: &'b Vec<Object<'parse>>, definition: &'orig Vec<Object<'parse>>,
) -> Result<usize, CustomError> { ) -> Result<usize, CustomError> {
if let None = label { if let None = label {
// If it has no label then it must always get a new ID. // If it has no label then it must always get a new ID.
@ -75,10 +80,10 @@ impl<'parse> Registry<'parse> {
} }
/// Update the definition to a footnote but do not mark it as referenced. /// Update the definition to a footnote but do not mark it as referenced.
pub(crate) async fn register_footnote_definition<'b>( pub(crate) async fn register_footnote_definition<'reg>(
&'b mut self, &'reg mut self,
label: &'parse str, label: &'parse str,
definition: &'b Vec<Element<'parse>>, definition: &'orig Vec<Element<'parse>>,
) -> Result<(), CustomError> { ) -> Result<(), CustomError> {
let contents = convert_definition_contents(self, definition).await?; let contents = convert_definition_contents(self, definition).await?;
if let Some((_existing_id, existing_definition)) = self if let Some((_existing_id, existing_definition)) = self
@ -92,9 +97,9 @@ impl<'parse> Registry<'parse> {
} }
} }
async fn convert_reference_contents<'b, 'parse>( async fn convert_reference_contents<'reg, 'orig, 'parse>(
registry: &'b mut Registry<'parse>, registry: &'reg mut Registry<'orig, 'parse>,
contents: &'b Vec<Object<'parse>>, contents: &'orig Vec<Object<'parse>>,
) -> Result<Vec<IAstNode>, CustomError> { ) -> Result<Vec<IAstNode>, CustomError> {
let contents = { let contents = {
let mut ret = Vec::new(); let mut ret = Vec::new();
@ -107,9 +112,9 @@ async fn convert_reference_contents<'b, 'parse>(
Ok(contents) Ok(contents)
} }
async fn convert_definition_contents<'b, 'parse>( async fn convert_definition_contents<'reg, 'orig, 'parse>(
registry: &'b mut Registry<'parse>, registry: &'reg mut Registry<'orig, 'parse>,
contents: &'b Vec<Element<'parse>>, contents: &'orig Vec<Element<'parse>>,
) -> Result<Vec<IAstNode>, CustomError> { ) -> Result<Vec<IAstNode>, CustomError> {
let contents = { let contents = {
let mut ret = Vec::new(); let mut ret = Vec::new();
@ -121,3 +126,8 @@ async fn convert_definition_contents<'b, 'parse>(
Ok(contents) Ok(contents)
} }
enum FootnoteDefinitionContents<'orig, 'parse> {
FromReference(&'orig Vec<Object<'parse>>),
FromDefinition(&'orig Vec<Object<'parse>>),
}

View File

@ -1,7 +1,7 @@
use crate::error::CustomError; use super::macros::intermediate;
use super::registry::Registry; use super::registry::Registry;
use super::IObject; use super::IObject;
use crate::error::CustomError;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct IRegularLink { pub(crate) struct IRegularLink {
@ -9,11 +9,7 @@ pub(crate) struct IRegularLink {
pub(crate) children: Vec<IObject>, pub(crate) children: Vec<IObject>,
} }
impl IRegularLink { intermediate!(IRegularLink, RegularLink, |registry, original| async {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::RegularLink<'parse>,
) -> Result<IRegularLink, CustomError> {
let children = { let children = {
let mut ret = Vec::new(); let mut ret = Vec::new();
for obj in original.children.iter() { for obj in original.children.iter() {
@ -25,5 +21,4 @@ impl IRegularLink {
raw_link: original.get_raw_link().into_owned(), raw_link: original.get_raw_link().into_owned(),
children, children,
}) })
} });
}

View File

@ -1,26 +1,21 @@
use crate::error::CustomError; use super::macros::intermediate;
use super::registry::Registry; use super::registry::Registry;
use super::IElement; use super::IElement;
use crate::error::CustomError;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct ISection { pub(crate) struct ISection {
pub(crate) children: Vec<IElement>, pub(crate) children: Vec<IElement>,
} }
impl ISection { intermediate!(ISection, Section, |registry, original| async {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
section: &'b organic::types::Section<'parse>,
) -> Result<ISection, CustomError> {
let children = { let children = {
let mut ret = Vec::new(); let mut ret = Vec::new();
for elem in section.children.iter() { for elem in original.children.iter() {
ret.push(IElement::new(registry, elem).await?); ret.push(IElement::new(registry, elem).await?);
} }
ret ret
}; };
Ok(ISection { children }) Ok(ISection { children })
} });
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(ISpecialBlock, SpecialBlock);
#[derive(Debug, Clone)]
pub(crate) struct ISpecialBlock {}
impl ISpecialBlock {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::SpecialBlock<'parse>,
) -> Result<ISpecialBlock, CustomError> {
Ok(ISpecialBlock {})
}
}

View File

@ -1,22 +1,17 @@
use crate::error::CustomError; use super::macros::intermediate;
use super::registry::Registry; use super::registry::Registry;
use crate::error::CustomError;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct ISrcBlock { pub(crate) struct ISrcBlock {
pub(crate) lines: Vec<String>, pub(crate) lines: Vec<String>,
} }
impl ISrcBlock { intermediate!(ISrcBlock, SrcBlock, |registry, original| async {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::SrcBlock<'parse>,
) -> Result<ISrcBlock, CustomError> {
let lines = original let lines = original
.contents .contents
.split_inclusive('\n') .split_inclusive('\n')
.map(|s| s.to_owned()) .map(|s| s.to_owned())
.collect(); .collect();
Ok(ISrcBlock { lines }) Ok(ISrcBlock { lines })
} });
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IStatisticsCookie, StatisticsCookie);
#[derive(Debug, Clone)]
pub(crate) struct IStatisticsCookie {}
impl IStatisticsCookie {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::StatisticsCookie<'parse>,
) -> Result<IStatisticsCookie, CustomError> {
Ok(IStatisticsCookie {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(IStrikeThrough, StrikeThrough);
#[derive(Debug, Clone)]
pub(crate) struct IStrikeThrough {}
impl IStrikeThrough {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::StrikeThrough<'parse>,
) -> Result<IStrikeThrough, CustomError> {
Ok(IStrikeThrough {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(ISubscript, Subscript);
#[derive(Debug, Clone)]
pub(crate) struct ISubscript {}
impl ISubscript {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Subscript<'parse>,
) -> Result<ISubscript, CustomError> {
Ok(ISubscript {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(ISuperscript, Superscript);
#[derive(Debug, Clone)]
pub(crate) struct ISuperscript {}
impl ISuperscript {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Superscript<'parse>,
) -> Result<ISuperscript, CustomError> {
Ok(ISuperscript {})
}
}

View File

@ -1,15 +1,5 @@
use super::macros::inoop;
use super::registry::Registry;
use crate::error::CustomError; use crate::error::CustomError;
use super::registry::Registry; inoop!(ITable, Table);
#[derive(Debug, Clone)]
pub(crate) struct ITable {}
impl ITable {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Table<'parse>,
) -> Result<ITable, CustomError> {
Ok(ITable {})
}
}

View File

@ -1,7 +1,6 @@
use crate::error::CustomError; use super::macros::intermediate;
use crate::intermediate::util::coalesce_whitespace;
use super::registry::Registry; use super::registry::Registry;
use crate::error::CustomError;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct ITarget { pub(crate) struct ITarget {
@ -9,15 +8,10 @@ pub(crate) struct ITarget {
value: String, value: String,
} }
impl ITarget { intermediate!(ITarget, Target, |registry, original| async {
pub(crate) async fn new<'b, 'parse>( let id = registry.get_target(original.value);
registry: &'b mut Registry<'parse>,
target: &'b organic::types::Target<'parse>,
) -> Result<ITarget, CustomError> {
let id = registry.get_target(target.value);
Ok(ITarget { Ok(ITarget {
id: id.clone(), id: id.clone(),
value: target.value.to_owned(), value: original.value.to_owned(),
}) })
} });
}

View File

@ -1,15 +1,6 @@
use crate::error::CustomError; use crate::error::CustomError;
use super::macros::inoop;
use super::registry::Registry; use super::registry::Registry;
#[derive(Debug, Clone)] inoop!(ITimestamp, Timestamp);
pub(crate) struct ITimestamp {}
impl ITimestamp {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Timestamp<'parse>,
) -> Result<ITimestamp, CustomError> {
Ok(ITimestamp {})
}
}

View File

@ -1,15 +1,6 @@
use crate::error::CustomError; use crate::error::CustomError;
use super::macros::inoop;
use super::registry::Registry; use super::registry::Registry;
#[derive(Debug, Clone)] inoop!(IUnderline, Underline);
pub(crate) struct IUnderline {}
impl IUnderline {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Underline<'parse>,
) -> Result<IUnderline, CustomError> {
Ok(IUnderline {})
}
}

View File

@ -1,15 +1,6 @@
use crate::error::CustomError; use crate::error::CustomError;
use super::macros::inoop;
use super::registry::Registry; use super::registry::Registry;
#[derive(Debug, Clone)] inoop!(IVerbatim, Verbatim);
pub(crate) struct IVerbatim {}
impl IVerbatim {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::Verbatim<'parse>,
) -> Result<IVerbatim, CustomError> {
Ok(IVerbatim {})
}
}

View File

@ -1,15 +1,6 @@
use crate::error::CustomError; use crate::error::CustomError;
use super::macros::inoop;
use super::registry::Registry; use super::registry::Registry;
#[derive(Debug, Clone)] inoop!(IVerseBlock, VerseBlock);
pub(crate) struct IVerseBlock {}
impl IVerseBlock {
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
original: &'b organic::types::VerseBlock<'parse>,
) -> Result<IVerseBlock, CustomError> {
Ok(IVerseBlock {})
}
}