Add post_blank to the rust types.

This commit is contained in:
Tom Alexander
2023-12-21 14:56:58 -05:00
parent 8b85c02ef1
commit 72952adb6b
108 changed files with 318 additions and 109 deletions

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IAngleLink, AngleLink);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IBabelCall, BabelCall);

View File

@@ -1,3 +1,5 @@
use organic::types::StandardProperties;
use super::macros::intermediate;
use super::IObject;
@@ -6,6 +8,7 @@ use crate::error::CustomError;
#[derive(Debug, Clone)]
pub(crate) struct IBold {
pub(crate) children: Vec<IObject>,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -22,6 +25,9 @@ intermediate!(
ret
};
Ok(IBold { children })
Ok(IBold {
children,
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(ICenterBlock, CenterBlock);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(ICitation, Citation);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(ICitationReference, CitationReference);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IClock, Clock);

View File

@@ -1,3 +1,5 @@
use organic::types::StandardProperties;
use super::macros::intermediate;
use crate::error::CustomError;
@@ -5,6 +7,7 @@ use crate::error::CustomError;
#[derive(Debug, Clone)]
pub(crate) struct ICode {
pub(crate) contents: String,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -16,6 +19,7 @@ intermediate!(
Ok(ICode {
// TODO: Should this coalesce whitespace like PlainText?
contents: original.contents.to_owned(),
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IComment, Comment);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(ICommentBlock, CommentBlock);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IDiarySexp, DiarySexp);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IDrawer, Drawer);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IDynamicBlock, DynamicBlock);

View File

@@ -1,10 +1,11 @@
use super::macros::intermediate;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct IEntity {
pub(crate) html: String,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -15,6 +16,7 @@ intermediate!(
{
Ok(IEntity {
html: original.html.to_owned(),
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IExampleBlock, ExampleBlock);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IExportBlock, ExportBlock);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IExportSnippet, ExportSnippet);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IFixedWidthArea, FixedWidthArea);

View File

@@ -1,12 +1,14 @@
use super::macros::intermediate;
use super::registry::register_footnote_definition;
use super::IntermediateContext;
use super::IAstNode;
use super::IntermediateContext;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct IFootnoteDefinition {}
pub(crate) struct IFootnoteDefinition {
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
IFootnoteDefinition,
@@ -16,12 +18,15 @@ intermediate!(
{
register_footnote_definition(intermediate_context, original.label, &original.children)
.await?;
Ok(IFootnoteDefinition {})
Ok(IFootnoteDefinition {
post_blank: original.get_post_blank(),
})
}
);
#[derive(Debug)]
pub(crate) struct IRealFootnoteDefinition {
// TODO: Do I need post_blank for the real footnote definitions?
pub(crate) footnote_id: usize,
pub(crate) contents: Vec<IAstNode>,
}

View File

@@ -1,12 +1,13 @@
use super::macros::intermediate;
use super::registry::get_footnote_reference_id;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct IFootnoteReference {
footnote_id: usize,
duplicate_offset: usize,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -21,6 +22,7 @@ intermediate!(
Ok(IFootnoteReference {
footnote_id,
duplicate_offset: reference_count,
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,14 +1,15 @@
use super::macros::intermediate;
use super::IDocumentElement;
use super::IObject;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct IHeading {
pub(crate) level: organic::types::HeadlineLevel,
pub(crate) title: Vec<IObject>,
pub(crate) children: Vec<IDocumentElement>,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -35,6 +36,7 @@ intermediate!(
title,
level: original.level,
children,
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IHorizontalRule, HorizontalRule);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IInlineBabelCall, InlineBabelCall);

View File

@@ -1,10 +1,11 @@
use super::macros::intermediate;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct IInlineSourceBlock {
pub(crate) value: String,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -15,6 +16,7 @@ intermediate!(
{
Ok(IInlineSourceBlock {
value: original.value.to_owned(),
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,3 +1,5 @@
use organic::types::StandardProperties;
use super::macros::intermediate;
use super::IObject;
@@ -6,6 +8,7 @@ use crate::error::CustomError;
#[derive(Debug, Clone)]
pub(crate) struct IItalic {
pub(crate) children: Vec<IObject>,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -22,6 +25,9 @@ intermediate!(
ret
};
Ok(IItalic { children })
Ok(IItalic {
children,
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IKeyword, Keyword);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(ILatexEnvironment, LatexEnvironment);

View File

@@ -1,10 +1,11 @@
use super::macros::intermediate;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct ILatexFragment {
pub(crate) value: String,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -20,6 +21,9 @@ intermediate!(
} else {
original.value.to_owned()
};
Ok(ILatexFragment { value })
Ok(ILatexFragment {
value,
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(ILineBreak, LineBreak);

View File

@@ -4,14 +4,18 @@
macro_rules! inoop {
($istruct:ident, $pstruct:ident) => {
#[derive(Debug, Clone)]
pub(crate) struct $istruct {}
pub(crate) struct $istruct {
pub(crate) post_blank: organic::types::PostBlank,
}
impl $istruct {
pub(crate) async fn new<'reg, 'orig, 'parse>(
_intermediate_context: crate::intermediate::IntermediateContext<'orig, 'parse>,
_original: &'orig organic::types::$pstruct<'parse>,
original: &'orig organic::types::$pstruct<'parse>,
) -> Result<$istruct, CustomError> {
Ok($istruct {})
Ok($istruct {
post_blank: original.get_post_blank(),
})
}
}
};

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IOrgMacro, OrgMacro);

View File

@@ -1,11 +1,12 @@
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!(
@@ -22,6 +23,9 @@ intermediate!(
ret
};
Ok(IParagraph { children })
Ok(IParagraph {
children,
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IPlainLink, PlainLink);

View File

@@ -1,12 +1,13 @@
use super::macros::intermediate;
use super::IPlainListItem;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct IPlainList {
pub(crate) list_type: organic::types::PlainListType,
pub(crate) children: Vec<IPlainListItem>,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -26,6 +27,7 @@ intermediate!(
Ok(IPlainList {
list_type: original.list_type,
children,
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,3 +1,5 @@
use organic::types::StandardProperties;
use super::macros::intermediate;
use super::util::coalesce_whitespace;
@@ -6,6 +8,7 @@ use crate::error::CustomError;
#[derive(Debug, Clone)]
pub(crate) struct IPlainText {
pub(crate) source: String,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -16,6 +19,7 @@ intermediate!(
{
Ok(IPlainText {
source: coalesce_whitespace(original.source).into_owned(),
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IPlanning, Planning);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IPropertyDrawer, PropertyDrawer);

View File

@@ -1,11 +1,12 @@
use super::macros::intermediate;
use super::IElement;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct IQuoteBlock {
pub(crate) children: Vec<IElement>,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -22,6 +23,9 @@ intermediate!(
ret
};
Ok(IQuoteBlock { children })
Ok(IQuoteBlock {
children,
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IRadioLink, RadioLink);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IRadioTarget, RadioTarget);

View File

@@ -1,3 +1,5 @@
use organic::types::StandardProperties;
use super::macros::intermediate;
use super::IObject;
@@ -7,6 +9,7 @@ use crate::error::CustomError;
pub(crate) struct IRegularLink {
pub(crate) raw_link: String,
pub(crate) children: Vec<IObject>,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -25,6 +28,7 @@ intermediate!(
Ok(IRegularLink {
raw_link: original.get_raw_link().into_owned(),
children,
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,11 +1,12 @@
use super::macros::intermediate;
use super::IElement;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct ISection {
pub(crate) children: Vec<IElement>,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -22,6 +23,9 @@ intermediate!(
ret
};
Ok(ISection { children })
Ok(ISection {
children,
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(ISpecialBlock, SpecialBlock);

View File

@@ -1,11 +1,12 @@
use super::macros::intermediate;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct ISrcBlock {
pub(crate) lines: Vec<String>,
pub(crate) language: Option<String>,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -58,7 +59,11 @@ intermediate!(
})
.collect();
let language = original.language.map(str::to_owned);
Ok(ISrcBlock { lines, language })
Ok(ISrcBlock {
lines,
language,
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IStatisticsCookie, StatisticsCookie);

View File

@@ -1,3 +1,5 @@
use organic::types::StandardProperties;
use super::macros::intermediate;
use super::IObject;
@@ -6,6 +8,7 @@ use crate::error::CustomError;
#[derive(Debug, Clone)]
pub(crate) struct IStrikeThrough {
pub(crate) children: Vec<IObject>,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -22,6 +25,9 @@ intermediate!(
ret
};
Ok(IStrikeThrough { children })
Ok(IStrikeThrough {
children,
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(ISubscript, Subscript);

View File

@@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(ISuperscript, Superscript);

View File

@@ -1,11 +1,12 @@
use super::macros::intermediate;
use super::table_row::ITableRow;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct ITable {
pub(crate) children: Vec<ITableRow>,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -22,6 +23,9 @@ intermediate!(
ret
};
Ok(ITable { children })
Ok(ITable {
children,
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,11 +1,12 @@
use super::macros::intermediate;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct ITarget {
pub(crate) id: String,
value: String,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -19,6 +20,7 @@ intermediate!(
Ok(ITarget {
id: id.clone(),
value: original.value.to_owned(),
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,6 +1,5 @@
use crate::error::CustomError;
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(ITimestamp, Timestamp);

View File

@@ -1,3 +1,5 @@
use organic::types::StandardProperties;
use super::macros::intermediate;
use super::IObject;
@@ -6,6 +8,7 @@ use crate::error::CustomError;
#[derive(Debug, Clone)]
pub(crate) struct IUnderline {
pub(crate) children: Vec<IObject>,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -22,6 +25,9 @@ intermediate!(
ret
};
Ok(IUnderline { children })
Ok(IUnderline {
children,
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,3 +1,5 @@
use organic::types::StandardProperties;
use super::macros::intermediate;
use crate::error::CustomError;
@@ -5,6 +7,7 @@ use crate::error::CustomError;
#[derive(Debug, Clone)]
pub(crate) struct IVerbatim {
pub(crate) contents: String,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
@@ -16,6 +19,7 @@ intermediate!(
Ok(IVerbatim {
// TODO: Should this coalesce whitespace like PlainText?
contents: original.contents.to_owned(),
post_blank: original.get_post_blank(),
})
}
);

View File

@@ -1,6 +1,5 @@
use crate::error::CustomError;
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IVerseBlock, VerseBlock);