Add original field name to wasm macro.
This commit is contained in:
		
							parent
							
								
									bbb9ec637a
								
							
						
					
					
						commit
						eb51bdfe2f
					
				| @ -21,6 +21,7 @@ pub(crate) struct WasmAngleLink<'s> { | ||||
| to_wasm!( | ||||
|     WasmAngleLink<'s>, | ||||
|     AngleLink<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmBabelCall<'s> { | ||||
| to_wasm!( | ||||
|     WasmBabelCall<'s>, | ||||
|     BabelCall<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -18,10 +18,17 @@ pub(crate) struct WasmBold<'s> { | ||||
|     phantom: PhantomData<&'s ()>, | ||||
| } | ||||
| 
 | ||||
| to_wasm!(WasmBold<'s>, Bold<'s>, wasm_context, standard_properties, { | ||||
|     Ok(WasmBold { | ||||
|         standard_properties, | ||||
|         children: Vec::new(), | ||||
|         phantom: PhantomData, | ||||
|     }) | ||||
| }); | ||||
| to_wasm!( | ||||
|     WasmBold<'s>, | ||||
|     Bold<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|         Ok(WasmBold { | ||||
|             standard_properties, | ||||
|             children: Vec::new(), | ||||
|             phantom: PhantomData, | ||||
|         }) | ||||
|     } | ||||
| ); | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmCenterBlock<'s> { | ||||
| to_wasm!( | ||||
|     WasmCenterBlock<'s>, | ||||
|     CenterBlock<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmCitation<'s> { | ||||
| to_wasm!( | ||||
|     WasmCitation<'s>, | ||||
|     Citation<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmCitationReference<'s> { | ||||
| to_wasm!( | ||||
|     WasmCitationReference<'s>, | ||||
|     CitationReference<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmClock<'s> { | ||||
| to_wasm!( | ||||
|     WasmClock<'s>, | ||||
|     Clock<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -18,10 +18,17 @@ pub(crate) struct WasmCode<'s> { | ||||
|     phantom: PhantomData<&'s ()>, | ||||
| } | ||||
| 
 | ||||
| to_wasm!(WasmCode<'s>, Code<'s>, wasm_context, standard_properties, { | ||||
|     Ok(WasmCode { | ||||
|         standard_properties, | ||||
|         children: Vec::new(), | ||||
|         phantom: PhantomData, | ||||
|     }) | ||||
| }); | ||||
| to_wasm!( | ||||
|     WasmCode<'s>, | ||||
|     Code<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|         Ok(WasmCode { | ||||
|             standard_properties, | ||||
|             children: Vec::new(), | ||||
|             phantom: PhantomData, | ||||
|         }) | ||||
|     } | ||||
| ); | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmComment<'s> { | ||||
| to_wasm!( | ||||
|     WasmComment<'s>, | ||||
|     Comment<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmCommentBlock<'s> { | ||||
| to_wasm!( | ||||
|     WasmCommentBlock<'s>, | ||||
|     CommentBlock<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmDiarySexp<'s> { | ||||
| to_wasm!( | ||||
|     WasmDiarySexp<'s>, | ||||
|     DiarySexp<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -23,9 +23,20 @@ pub(crate) struct WasmDocument<'s> { | ||||
| to_wasm!( | ||||
|     WasmDocument<'s>, | ||||
|     Document<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     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 { | ||||
|             standard_properties, | ||||
|             additional_properties: Vec::new(), | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmDrawer<'s> { | ||||
| to_wasm!( | ||||
|     WasmDrawer<'s>, | ||||
|     Drawer<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmDynamicBlock<'s> { | ||||
| to_wasm!( | ||||
|     WasmDynamicBlock<'s>, | ||||
|     DynamicBlock<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmEntity<'s> { | ||||
| to_wasm!( | ||||
|     WasmEntity<'s>, | ||||
|     Entity<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmExampleBlock<'s> { | ||||
| to_wasm!( | ||||
|     WasmExampleBlock<'s>, | ||||
|     ExampleBlock<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmExportBlock<'s> { | ||||
| to_wasm!( | ||||
|     WasmExportBlock<'s>, | ||||
|     ExportBlock<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmExportSnippet<'s> { | ||||
| to_wasm!( | ||||
|     WasmExportSnippet<'s>, | ||||
|     ExportSnippet<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmFixedWidthArea<'s> { | ||||
| to_wasm!( | ||||
|     WasmFixedWidthArea<'s>, | ||||
|     FixedWidthArea<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmFootnoteDefinition<'s> { | ||||
| to_wasm!( | ||||
|     WasmFootnoteDefinition<'s>, | ||||
|     FootnoteDefinition<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmFootnoteReference<'s> { | ||||
| to_wasm!( | ||||
|     WasmFootnoteReference<'s>, | ||||
|     FootnoteReference<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmHeadline<'s> { | ||||
| to_wasm!( | ||||
|     WasmHeadline<'s>, | ||||
|     Heading<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmHorizontalRule<'s> { | ||||
| to_wasm!( | ||||
|     WasmHorizontalRule<'s>, | ||||
|     HorizontalRule<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmInlineBabelCall<'s> { | ||||
| to_wasm!( | ||||
|     WasmInlineBabelCall<'s>, | ||||
|     InlineBabelCall<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmInlineSourceBlock<'s> { | ||||
| to_wasm!( | ||||
|     WasmInlineSourceBlock<'s>, | ||||
|     InlineSourceBlock<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmItalic<'s> { | ||||
| to_wasm!( | ||||
|     WasmItalic<'s>, | ||||
|     Italic<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmKeyword<'s> { | ||||
| to_wasm!( | ||||
|     WasmKeyword<'s>, | ||||
|     Keyword<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmLatexEnvironment<'s> { | ||||
| to_wasm!( | ||||
|     WasmLatexEnvironment<'s>, | ||||
|     LatexEnvironment<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmLatexFragment<'s> { | ||||
| to_wasm!( | ||||
|     WasmLatexFragment<'s>, | ||||
|     LatexFragment<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmLineBreak<'s> { | ||||
| to_wasm!( | ||||
|     WasmLineBreak<'s>, | ||||
|     LineBreak<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| ///
 | ||||
| /// This exists to make changing the type signature easier.
 | ||||
| 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 { | ||||
|             type Output = $ostruct; | ||||
| 
 | ||||
| @ -10,6 +10,7 @@ macro_rules! to_wasm { | ||||
|                 &self, | ||||
|                 $wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>, | ||||
|             ) -> Result<Self::Output, crate::error::CustomError> { | ||||
|                 let $original = self; | ||||
|                 let $standard_properties = self.to_wasm_standard_properties($wasm_context)?; | ||||
|                 $fnbody | ||||
|             } | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmNodeProperty<'s> { | ||||
| to_wasm!( | ||||
|     WasmNodeProperty<'s>, | ||||
|     NodeProperty<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmOrgMacro<'s> { | ||||
| to_wasm!( | ||||
|     WasmOrgMacro<'s>, | ||||
|     OrgMacro<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmParagraph<'s> { | ||||
| to_wasm!( | ||||
|     WasmParagraph<'s>, | ||||
|     Paragraph<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmPlainLink<'s> { | ||||
| to_wasm!( | ||||
|     WasmPlainLink<'s>, | ||||
|     PlainLink<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmPlainList<'s> { | ||||
| to_wasm!( | ||||
|     WasmPlainList<'s>, | ||||
|     PlainList<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmPlainListItem<'s> { | ||||
| to_wasm!( | ||||
|     WasmPlainListItem<'s>, | ||||
|     PlainListItem<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmPlainText<'s> { | ||||
| to_wasm!( | ||||
|     WasmPlainText<'s>, | ||||
|     PlainText<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmPlanning<'s> { | ||||
| to_wasm!( | ||||
|     WasmPlanning<'s>, | ||||
|     Planning<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmPropertyDrawer<'s> { | ||||
| to_wasm!( | ||||
|     WasmPropertyDrawer<'s>, | ||||
|     PropertyDrawer<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmQuoteBlock<'s> { | ||||
| to_wasm!( | ||||
|     WasmQuoteBlock<'s>, | ||||
|     QuoteBlock<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmRadioLink<'s> { | ||||
| to_wasm!( | ||||
|     WasmRadioLink<'s>, | ||||
|     RadioLink<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmRadioTarget<'s> { | ||||
| to_wasm!( | ||||
|     WasmRadioTarget<'s>, | ||||
|     RadioTarget<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmRegularLink<'s> { | ||||
| to_wasm!( | ||||
|     WasmRegularLink<'s>, | ||||
|     RegularLink<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmSection<'s> { | ||||
| to_wasm!( | ||||
|     WasmSection<'s>, | ||||
|     Section<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmSpecialBlock<'s> { | ||||
| to_wasm!( | ||||
|     WasmSpecialBlock<'s>, | ||||
|     SpecialBlock<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmSrcBlock<'s> { | ||||
| to_wasm!( | ||||
|     WasmSrcBlock<'s>, | ||||
|     SrcBlock<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmStatisticsCookie<'s> { | ||||
| to_wasm!( | ||||
|     WasmStatisticsCookie<'s>, | ||||
|     StatisticsCookie<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmStrikeThrough<'s> { | ||||
| to_wasm!( | ||||
|     WasmStrikeThrough<'s>, | ||||
|     StrikeThrough<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmSubscript<'s> { | ||||
| to_wasm!( | ||||
|     WasmSubscript<'s>, | ||||
|     Subscript<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmSuperscript<'s> { | ||||
| to_wasm!( | ||||
|     WasmSuperscript<'s>, | ||||
|     Superscript<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmTable<'s> { | ||||
| to_wasm!( | ||||
|     WasmTable<'s>, | ||||
|     Table<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmTableCell<'s> { | ||||
| to_wasm!( | ||||
|     WasmTableCell<'s>, | ||||
|     TableCell<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmTableRow<'s> { | ||||
| to_wasm!( | ||||
|     WasmTableRow<'s>, | ||||
|     TableRow<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmTarget<'s> { | ||||
| to_wasm!( | ||||
|     WasmTarget<'s>, | ||||
|     Target<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmTimestamp<'s> { | ||||
| to_wasm!( | ||||
|     WasmTimestamp<'s>, | ||||
|     Timestamp<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmUnderline<'s> { | ||||
| to_wasm!( | ||||
|     WasmUnderline<'s>, | ||||
|     Underline<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmVerbatim<'s> { | ||||
| to_wasm!( | ||||
|     WasmVerbatim<'s>, | ||||
|     Verbatim<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
| @ -21,6 +21,7 @@ pub(crate) struct WasmVerseBlock<'s> { | ||||
| to_wasm!( | ||||
|     WasmVerseBlock<'s>, | ||||
|     VerseBlock<'s>, | ||||
|     original, | ||||
|     wasm_context, | ||||
|     standard_properties, | ||||
|     { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander