Add original field name to wasm macro.

This commit is contained in:
Tom Alexander 2023-12-25 12:32:35 -05:00
parent bbb9ec637a
commit eb51bdfe2f
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
59 changed files with 96 additions and 15 deletions

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmAngleLink<'s> {
to_wasm!( to_wasm!(
WasmAngleLink<'s>, WasmAngleLink<'s>,
AngleLink<'s>, AngleLink<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmBabelCall<'s> {
to_wasm!( to_wasm!(
WasmBabelCall<'s>, WasmBabelCall<'s>,
BabelCall<'s>, BabelCall<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -18,10 +18,17 @@ pub(crate) struct WasmBold<'s> {
phantom: PhantomData<&'s ()>, phantom: PhantomData<&'s ()>,
} }
to_wasm!(WasmBold<'s>, Bold<'s>, wasm_context, standard_properties, { to_wasm!(
Ok(WasmBold { WasmBold<'s>,
standard_properties, Bold<'s>,
children: Vec::new(), original,
phantom: PhantomData, wasm_context,
}) standard_properties,
}); {
Ok(WasmBold {
standard_properties,
children: Vec::new(),
phantom: PhantomData,
})
}
);

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmCenterBlock<'s> {
to_wasm!( to_wasm!(
WasmCenterBlock<'s>, WasmCenterBlock<'s>,
CenterBlock<'s>, CenterBlock<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmCitation<'s> {
to_wasm!( to_wasm!(
WasmCitation<'s>, WasmCitation<'s>,
Citation<'s>, Citation<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmCitationReference<'s> {
to_wasm!( to_wasm!(
WasmCitationReference<'s>, WasmCitationReference<'s>,
CitationReference<'s>, CitationReference<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmClock<'s> {
to_wasm!( to_wasm!(
WasmClock<'s>, WasmClock<'s>,
Clock<'s>, Clock<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -18,10 +18,17 @@ pub(crate) struct WasmCode<'s> {
phantom: PhantomData<&'s ()>, phantom: PhantomData<&'s ()>,
} }
to_wasm!(WasmCode<'s>, Code<'s>, wasm_context, standard_properties, { to_wasm!(
Ok(WasmCode { WasmCode<'s>,
standard_properties, Code<'s>,
children: Vec::new(), original,
phantom: PhantomData, wasm_context,
}) standard_properties,
}); {
Ok(WasmCode {
standard_properties,
children: Vec::new(),
phantom: PhantomData,
})
}
);

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmComment<'s> {
to_wasm!( to_wasm!(
WasmComment<'s>, WasmComment<'s>,
Comment<'s>, Comment<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmCommentBlock<'s> {
to_wasm!( to_wasm!(
WasmCommentBlock<'s>, WasmCommentBlock<'s>,
CommentBlock<'s>, CommentBlock<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmDiarySexp<'s> {
to_wasm!( to_wasm!(
WasmDiarySexp<'s>, WasmDiarySexp<'s>,
DiarySexp<'s>, DiarySexp<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -23,9 +23,20 @@ pub(crate) struct WasmDocument<'s> {
to_wasm!( to_wasm!(
WasmDocument<'s>, WasmDocument<'s>,
Document<'s>, Document<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {
let additional_properties: Vec<(String, &str)> = original
.get_additional_properties()
.map(|node_property| {
(
format!(":{}", node_property.property_name.to_uppercase()),
node_property.value.unwrap_or(""),
)
})
.collect();
Ok(WasmDocument { Ok(WasmDocument {
standard_properties, standard_properties,
additional_properties: Vec::new(), additional_properties: Vec::new(),

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmDrawer<'s> {
to_wasm!( to_wasm!(
WasmDrawer<'s>, WasmDrawer<'s>,
Drawer<'s>, Drawer<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmDynamicBlock<'s> {
to_wasm!( to_wasm!(
WasmDynamicBlock<'s>, WasmDynamicBlock<'s>,
DynamicBlock<'s>, DynamicBlock<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmEntity<'s> {
to_wasm!( to_wasm!(
WasmEntity<'s>, WasmEntity<'s>,
Entity<'s>, Entity<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmExampleBlock<'s> {
to_wasm!( to_wasm!(
WasmExampleBlock<'s>, WasmExampleBlock<'s>,
ExampleBlock<'s>, ExampleBlock<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmExportBlock<'s> {
to_wasm!( to_wasm!(
WasmExportBlock<'s>, WasmExportBlock<'s>,
ExportBlock<'s>, ExportBlock<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmExportSnippet<'s> {
to_wasm!( to_wasm!(
WasmExportSnippet<'s>, WasmExportSnippet<'s>,
ExportSnippet<'s>, ExportSnippet<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmFixedWidthArea<'s> {
to_wasm!( to_wasm!(
WasmFixedWidthArea<'s>, WasmFixedWidthArea<'s>,
FixedWidthArea<'s>, FixedWidthArea<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmFootnoteDefinition<'s> {
to_wasm!( to_wasm!(
WasmFootnoteDefinition<'s>, WasmFootnoteDefinition<'s>,
FootnoteDefinition<'s>, FootnoteDefinition<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmFootnoteReference<'s> {
to_wasm!( to_wasm!(
WasmFootnoteReference<'s>, WasmFootnoteReference<'s>,
FootnoteReference<'s>, FootnoteReference<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmHeadline<'s> {
to_wasm!( to_wasm!(
WasmHeadline<'s>, WasmHeadline<'s>,
Heading<'s>, Heading<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmHorizontalRule<'s> {
to_wasm!( to_wasm!(
WasmHorizontalRule<'s>, WasmHorizontalRule<'s>,
HorizontalRule<'s>, HorizontalRule<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmInlineBabelCall<'s> {
to_wasm!( to_wasm!(
WasmInlineBabelCall<'s>, WasmInlineBabelCall<'s>,
InlineBabelCall<'s>, InlineBabelCall<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmInlineSourceBlock<'s> {
to_wasm!( to_wasm!(
WasmInlineSourceBlock<'s>, WasmInlineSourceBlock<'s>,
InlineSourceBlock<'s>, InlineSourceBlock<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmItalic<'s> {
to_wasm!( to_wasm!(
WasmItalic<'s>, WasmItalic<'s>,
Italic<'s>, Italic<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmKeyword<'s> {
to_wasm!( to_wasm!(
WasmKeyword<'s>, WasmKeyword<'s>,
Keyword<'s>, Keyword<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmLatexEnvironment<'s> {
to_wasm!( to_wasm!(
WasmLatexEnvironment<'s>, WasmLatexEnvironment<'s>,
LatexEnvironment<'s>, LatexEnvironment<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmLatexFragment<'s> {
to_wasm!( to_wasm!(
WasmLatexFragment<'s>, WasmLatexFragment<'s>,
LatexFragment<'s>, LatexFragment<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmLineBreak<'s> {
to_wasm!( to_wasm!(
WasmLineBreak<'s>, WasmLineBreak<'s>,
LineBreak<'s>, LineBreak<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -2,7 +2,7 @@
/// ///
/// This exists to make changing the type signature easier. /// This exists to make changing the type signature easier.
macro_rules! to_wasm { macro_rules! to_wasm {
($ostruct:ty, $istruct:ty, $wasm_context:ident, $standard_properties:ident, $fnbody:tt) => { ($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $standard_properties:ident, $fnbody:tt) => {
impl<'s> ToWasm for $istruct { impl<'s> ToWasm for $istruct {
type Output = $ostruct; type Output = $ostruct;
@ -10,6 +10,7 @@ macro_rules! to_wasm {
&self, &self,
$wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>, $wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>,
) -> Result<Self::Output, crate::error::CustomError> { ) -> Result<Self::Output, crate::error::CustomError> {
let $original = self;
let $standard_properties = self.to_wasm_standard_properties($wasm_context)?; let $standard_properties = self.to_wasm_standard_properties($wasm_context)?;
$fnbody $fnbody
} }

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmNodeProperty<'s> {
to_wasm!( to_wasm!(
WasmNodeProperty<'s>, WasmNodeProperty<'s>,
NodeProperty<'s>, NodeProperty<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmOrgMacro<'s> {
to_wasm!( to_wasm!(
WasmOrgMacro<'s>, WasmOrgMacro<'s>,
OrgMacro<'s>, OrgMacro<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmParagraph<'s> {
to_wasm!( to_wasm!(
WasmParagraph<'s>, WasmParagraph<'s>,
Paragraph<'s>, Paragraph<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmPlainLink<'s> {
to_wasm!( to_wasm!(
WasmPlainLink<'s>, WasmPlainLink<'s>,
PlainLink<'s>, PlainLink<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmPlainList<'s> {
to_wasm!( to_wasm!(
WasmPlainList<'s>, WasmPlainList<'s>,
PlainList<'s>, PlainList<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmPlainListItem<'s> {
to_wasm!( to_wasm!(
WasmPlainListItem<'s>, WasmPlainListItem<'s>,
PlainListItem<'s>, PlainListItem<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmPlainText<'s> {
to_wasm!( to_wasm!(
WasmPlainText<'s>, WasmPlainText<'s>,
PlainText<'s>, PlainText<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmPlanning<'s> {
to_wasm!( to_wasm!(
WasmPlanning<'s>, WasmPlanning<'s>,
Planning<'s>, Planning<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmPropertyDrawer<'s> {
to_wasm!( to_wasm!(
WasmPropertyDrawer<'s>, WasmPropertyDrawer<'s>,
PropertyDrawer<'s>, PropertyDrawer<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmQuoteBlock<'s> {
to_wasm!( to_wasm!(
WasmQuoteBlock<'s>, WasmQuoteBlock<'s>,
QuoteBlock<'s>, QuoteBlock<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmRadioLink<'s> {
to_wasm!( to_wasm!(
WasmRadioLink<'s>, WasmRadioLink<'s>,
RadioLink<'s>, RadioLink<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmRadioTarget<'s> {
to_wasm!( to_wasm!(
WasmRadioTarget<'s>, WasmRadioTarget<'s>,
RadioTarget<'s>, RadioTarget<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmRegularLink<'s> {
to_wasm!( to_wasm!(
WasmRegularLink<'s>, WasmRegularLink<'s>,
RegularLink<'s>, RegularLink<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmSection<'s> {
to_wasm!( to_wasm!(
WasmSection<'s>, WasmSection<'s>,
Section<'s>, Section<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmSpecialBlock<'s> {
to_wasm!( to_wasm!(
WasmSpecialBlock<'s>, WasmSpecialBlock<'s>,
SpecialBlock<'s>, SpecialBlock<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmSrcBlock<'s> {
to_wasm!( to_wasm!(
WasmSrcBlock<'s>, WasmSrcBlock<'s>,
SrcBlock<'s>, SrcBlock<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmStatisticsCookie<'s> {
to_wasm!( to_wasm!(
WasmStatisticsCookie<'s>, WasmStatisticsCookie<'s>,
StatisticsCookie<'s>, StatisticsCookie<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmStrikeThrough<'s> {
to_wasm!( to_wasm!(
WasmStrikeThrough<'s>, WasmStrikeThrough<'s>,
StrikeThrough<'s>, StrikeThrough<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmSubscript<'s> {
to_wasm!( to_wasm!(
WasmSubscript<'s>, WasmSubscript<'s>,
Subscript<'s>, Subscript<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmSuperscript<'s> {
to_wasm!( to_wasm!(
WasmSuperscript<'s>, WasmSuperscript<'s>,
Superscript<'s>, Superscript<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmTable<'s> {
to_wasm!( to_wasm!(
WasmTable<'s>, WasmTable<'s>,
Table<'s>, Table<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmTableCell<'s> {
to_wasm!( to_wasm!(
WasmTableCell<'s>, WasmTableCell<'s>,
TableCell<'s>, TableCell<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmTableRow<'s> {
to_wasm!( to_wasm!(
WasmTableRow<'s>, WasmTableRow<'s>,
TableRow<'s>, TableRow<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmTarget<'s> {
to_wasm!( to_wasm!(
WasmTarget<'s>, WasmTarget<'s>,
Target<'s>, Target<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmTimestamp<'s> {
to_wasm!( to_wasm!(
WasmTimestamp<'s>, WasmTimestamp<'s>,
Timestamp<'s>, Timestamp<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmUnderline<'s> {
to_wasm!( to_wasm!(
WasmUnderline<'s>, WasmUnderline<'s>,
Underline<'s>, Underline<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmVerbatim<'s> {
to_wasm!( to_wasm!(
WasmVerbatim<'s>, WasmVerbatim<'s>,
Verbatim<'s>, Verbatim<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {

View File

@ -21,6 +21,7 @@ pub(crate) struct WasmVerseBlock<'s> {
to_wasm!( to_wasm!(
WasmVerseBlock<'s>, WasmVerseBlock<'s>,
VerseBlock<'s>, VerseBlock<'s>,
original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {