Switch everything over to the new to_wasm macro.

This commit is contained in:
Tom Alexander 2023-12-29 15:03:36 -05:00
parent cad2be43bf
commit 579cbb5d11
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
66 changed files with 1258 additions and 1252 deletions

View File

@ -1,6 +1,7 @@
use std::borrow::Cow; use std::borrow::Cow;
use std::collections::HashMap; use std::collections::HashMap;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
@ -9,7 +10,7 @@ use super::WasmAstNode;
use crate::types::AffiliatedKeywordValue; use crate::types::AffiliatedKeywordValue;
use crate::types::AffiliatedKeywords; use crate::types::AffiliatedKeywords;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum AdditionalPropertyValue { pub enum AdditionalPropertyValue {
SingleString(String), SingleString(String),
@ -18,7 +19,7 @@ pub enum AdditionalPropertyValue {
ObjectTree(Vec<(Option<Vec<WasmAstNode>>, Vec<WasmAstNode>)>), ObjectTree(Vec<(Option<Vec<WasmAstNode>>, Vec<WasmAstNode>)>),
} }
#[derive(Debug, Serialize, Default)] #[derive(Debug, Serialize, Deserialize, Default)]
pub struct AdditionalProperties { pub struct AdditionalProperties {
#[serde(flatten)] #[serde(flatten)]
pub(crate) properties: HashMap<String, AdditionalPropertyValue>, pub(crate) properties: HashMap<String, AdditionalPropertyValue>,

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::AngleLink; use crate::types::AngleLink;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmAngleLink { pub struct WasmAngleLink {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
AngleLink<'s>, AngleLink<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::AngleLink(original) },
{ "TODO".into() },
{ {
Ok(WasmAngleLink { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmAngleLink {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmAngleLink {
fn into(self) -> WasmAstNode {
WasmAstNode::AngleLink(self)
}
}

View File

@ -1,5 +1,4 @@
use std::borrow::Cow; use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::angle_link::WasmAngleLink; use super::angle_link::WasmAngleLink;
@ -62,7 +61,7 @@ use super::verbatim::WasmVerbatim;
use super::verse_block::WasmVerseBlock; use super::verse_block::WasmVerseBlock;
use super::WasmStandardProperties; use super::WasmStandardProperties;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
pub struct WasmAstNodeWrapper<I> { pub struct WasmAstNodeWrapper<I> {
pub(crate) ast_node: String, pub(crate) ast_node: String,
#[serde(rename = "standard-properties")] #[serde(rename = "standard-properties")]
@ -73,70 +72,70 @@ pub struct WasmAstNodeWrapper<I> {
pub(crate) properties: I, pub(crate) properties: I,
} }
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum WasmAstNode { pub enum WasmAstNode {
// Document Nodes // Document Nodes
Document(WasmAstNodeWrapper<WasmDocument>), Document(WasmAstNodeWrapper<WasmDocument>),
Headline(WasmHeadline), Headline(WasmAstNodeWrapper<WasmHeadline>),
Section(WasmSection), Section(WasmAstNodeWrapper<WasmSection>),
// Elements // Elements
Paragraph(WasmParagraph), Paragraph(WasmAstNodeWrapper<WasmParagraph>),
PlainList(WasmPlainList), PlainList(WasmAstNodeWrapper<WasmPlainList>),
PlainListItem(WasmPlainListItem), PlainListItem(WasmAstNodeWrapper<WasmPlainListItem>),
CenterBlock(WasmCenterBlock), CenterBlock(WasmAstNodeWrapper<WasmCenterBlock>),
QuoteBlock(WasmQuoteBlock), QuoteBlock(WasmAstNodeWrapper<WasmQuoteBlock>),
SpecialBlock(WasmSpecialBlock), SpecialBlock(WasmAstNodeWrapper<WasmSpecialBlock>),
DynamicBlock(WasmDynamicBlock), DynamicBlock(WasmAstNodeWrapper<WasmDynamicBlock>),
FootnoteDefinition(WasmFootnoteDefinition), FootnoteDefinition(WasmAstNodeWrapper<WasmFootnoteDefinition>),
Comment(WasmComment), Comment(WasmAstNodeWrapper<WasmComment>),
Drawer(WasmDrawer), Drawer(WasmAstNodeWrapper<WasmDrawer>),
PropertyDrawer(WasmPropertyDrawer), PropertyDrawer(WasmAstNodeWrapper<WasmPropertyDrawer>),
NodeProperty(WasmNodeProperty), NodeProperty(WasmAstNodeWrapper<WasmNodeProperty>),
Table(WasmTable), Table(WasmAstNodeWrapper<WasmTable>),
TableRow(WasmTableRow), TableRow(WasmAstNodeWrapper<WasmTableRow>),
VerseBlock(WasmVerseBlock), VerseBlock(WasmAstNodeWrapper<WasmVerseBlock>),
CommentBlock(WasmCommentBlock), CommentBlock(WasmAstNodeWrapper<WasmCommentBlock>),
ExampleBlock(WasmExampleBlock), ExampleBlock(WasmAstNodeWrapper<WasmExampleBlock>),
ExportBlock(WasmExportBlock), ExportBlock(WasmAstNodeWrapper<WasmExportBlock>),
SrcBlock(WasmSrcBlock), SrcBlock(WasmAstNodeWrapper<WasmSrcBlock>),
Clock(WasmClock), Clock(WasmAstNodeWrapper<WasmClock>),
DiarySexp(WasmDiarySexp), DiarySexp(WasmAstNodeWrapper<WasmDiarySexp>),
Planning(WasmPlanning), Planning(WasmAstNodeWrapper<WasmPlanning>),
FixedWidthArea(WasmFixedWidthArea), FixedWidthArea(WasmAstNodeWrapper<WasmFixedWidthArea>),
HorizontalRule(WasmHorizontalRule), HorizontalRule(WasmAstNodeWrapper<WasmHorizontalRule>),
Keyword(WasmKeyword), Keyword(WasmAstNodeWrapper<WasmKeyword>),
BabelCall(WasmBabelCall), BabelCall(WasmAstNodeWrapper<WasmBabelCall>),
LatexEnvironment(WasmLatexEnvironment), LatexEnvironment(WasmAstNodeWrapper<WasmLatexEnvironment>),
// Objects // Objects
Bold(WasmBold), Bold(WasmAstNodeWrapper<WasmBold>),
Italic(WasmItalic), Italic(WasmAstNodeWrapper<WasmItalic>),
Underline(WasmUnderline), Underline(WasmAstNodeWrapper<WasmUnderline>),
StrikeThrough(WasmStrikeThrough), StrikeThrough(WasmAstNodeWrapper<WasmStrikeThrough>),
Code(WasmCode), Code(WasmAstNodeWrapper<WasmCode>),
Verbatim(WasmVerbatim), Verbatim(WasmAstNodeWrapper<WasmVerbatim>),
PlainText(WasmPlainText), PlainText(WasmAstNodeWrapper<WasmPlainText>),
RegularLink(WasmRegularLink), RegularLink(WasmAstNodeWrapper<WasmRegularLink>),
RadioLink(WasmRadioLink), RadioLink(WasmAstNodeWrapper<WasmRadioLink>),
RadioTarget(WasmRadioTarget), RadioTarget(WasmAstNodeWrapper<WasmRadioTarget>),
PlainLink(WasmPlainLink), PlainLink(WasmAstNodeWrapper<WasmPlainLink>),
AngleLink(WasmAngleLink), AngleLink(WasmAstNodeWrapper<WasmAngleLink>),
OrgMacro(WasmOrgMacro), OrgMacro(WasmAstNodeWrapper<WasmOrgMacro>),
Entity(WasmEntity), Entity(WasmAstNodeWrapper<WasmEntity>),
LatexFragment(WasmLatexFragment), LatexFragment(WasmAstNodeWrapper<WasmLatexFragment>),
ExportSnippet(WasmExportSnippet), ExportSnippet(WasmAstNodeWrapper<WasmExportSnippet>),
FootnoteReference(WasmFootnoteReference), FootnoteReference(WasmAstNodeWrapper<WasmFootnoteReference>),
Citation(WasmCitation), Citation(WasmAstNodeWrapper<WasmCitation>),
CitationReference(WasmCitationReference), CitationReference(WasmAstNodeWrapper<WasmCitationReference>),
InlineBabelCall(WasmInlineBabelCall), InlineBabelCall(WasmAstNodeWrapper<WasmInlineBabelCall>),
InlineSourceBlock(WasmInlineSourceBlock), InlineSourceBlock(WasmAstNodeWrapper<WasmInlineSourceBlock>),
LineBreak(WasmLineBreak), LineBreak(WasmAstNodeWrapper<WasmLineBreak>),
Target(WasmTarget), Target(WasmAstNodeWrapper<WasmTarget>),
StatisticsCookie(WasmStatisticsCookie), StatisticsCookie(WasmAstNodeWrapper<WasmStatisticsCookie>),
Subscript(WasmSubscript), Subscript(WasmAstNodeWrapper<WasmSubscript>),
Superscript(WasmSuperscript), Superscript(WasmAstNodeWrapper<WasmSuperscript>),
TableCell(WasmTableCell), TableCell(WasmAstNodeWrapper<WasmTableCell>),
Timestamp(WasmTimestamp), Timestamp(WasmAstNodeWrapper<WasmTimestamp>),
} }
impl WasmAstNode {} impl WasmAstNode {}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::BabelCall; use crate::types::BabelCall;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmBabelCall { pub struct WasmBabelCall {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
BabelCall<'s>, BabelCall<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::BabelCall(original) },
{ "TODO".into() },
{ {
Ok(WasmBabelCall { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmBabelCall {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmBabelCall {
fn into(self) -> WasmAstNode {
WasmAstNode::BabelCall(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Bold; use crate::types::Bold;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmBold { pub struct WasmBold {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Bold<'s>, Bold<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Bold(original) },
{ "TODO".into() },
{ {
Ok(WasmBold { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmBold {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmBold {
fn into(self) -> WasmAstNode {
WasmAstNode::Bold(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::CenterBlock; use crate::types::CenterBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmCenterBlock { pub struct WasmCenterBlock {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
CenterBlock<'s>, CenterBlock<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::CenterBlock(original) },
{ "TODO".into() },
{ {
Ok(WasmCenterBlock { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmCenterBlock {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmCenterBlock {
fn into(self) -> WasmAstNode {
WasmAstNode::CenterBlock(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Citation; use crate::types::Citation;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmCitation { pub struct WasmCitation {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Citation<'s>, Citation<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Citation(original) },
{ "TODO".into() },
{ {
Ok(WasmCitation { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmCitation {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmCitation {
fn into(self) -> WasmAstNode {
WasmAstNode::Citation(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::CitationReference; use crate::types::CitationReference;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmCitationReference { pub struct WasmCitationReference {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
CitationReference<'s>, CitationReference<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::CitationReference(original) },
{ "TODO".into() },
{ {
Ok(WasmCitationReference { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmCitationReference {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmCitationReference {
fn into(self) -> WasmAstNode {
WasmAstNode::CitationReference(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Clock; use crate::types::Clock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmClock { pub struct WasmClock {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Clock<'s>, Clock<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Clock(original) },
{ "TODO".into() },
{ {
Ok(WasmClock { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmClock {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmClock {
fn into(self) -> WasmAstNode {
WasmAstNode::Clock(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Code; use crate::types::Code;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmCode { pub struct WasmCode {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Code<'s>, Code<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Code(original) },
{ "TODO".into() },
{ {
Ok(WasmCode { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmCode {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmCode {
fn into(self) -> WasmAstNode {
WasmAstNode::Code(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Comment; use crate::types::Comment;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmComment { pub struct WasmComment {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Comment<'s>, Comment<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Comment(original) },
{ "TODO".into() },
{ {
Ok(WasmComment { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmComment {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmComment {
fn into(self) -> WasmAstNode {
WasmAstNode::Comment(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::CommentBlock; use crate::types::CommentBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmCommentBlock { pub struct WasmCommentBlock {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
CommentBlock<'s>, CommentBlock<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::CommentBlock(original) },
{ "TODO".into() },
{ {
Ok(WasmCommentBlock { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmCommentBlock {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmCommentBlock {
fn into(self) -> WasmAstNode {
WasmAstNode::CommentBlock(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::DiarySexp; use crate::types::DiarySexp;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmDiarySexp { pub struct WasmDiarySexp {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
DiarySexp<'s>, DiarySexp<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::DiarySexp(original) },
{ "TODO".into() },
{ {
Ok(WasmDiarySexp { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmDiarySexp {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmDiarySexp {
fn into(self) -> WasmAstNode {
WasmAstNode::DiarySexp(self)
}
}

View File

@ -1,19 +1,18 @@
use std::path::PathBuf; use std::path::PathBuf;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::additional_property::AdditionalProperties; use super::additional_property::AdditionalProperties;
use super::additional_property::AdditionalPropertyValue; use super::additional_property::AdditionalPropertyValue;
use super::ast_node::WasmAstNode; use super::ast_node::WasmAstNode;
use super::macros::new_to_wasm;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
#[cfg(feature = "wasm_test")]
use crate::compare::ElispFact; use crate::compare::ElispFact;
use crate::types::Document; use crate::types::Document;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
pub struct WasmDocument { pub struct WasmDocument {
#[serde(flatten)] #[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties, pub(crate) additional_properties: AdditionalProperties,
@ -22,7 +21,7 @@ pub struct WasmDocument {
pub(crate) path: Option<PathBuf>, pub(crate) path: Option<PathBuf>,
} }
new_to_wasm!( to_wasm!(
WasmDocument, WasmDocument,
Document<'s>, Document<'s>,
original, original,

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Drawer; use crate::types::Drawer;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmDrawer { pub struct WasmDrawer {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Drawer<'s>, Drawer<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Drawer(original) },
{ "TODO".into() },
{ {
Ok(WasmDrawer { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmDrawer {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmDrawer {
fn into(self) -> WasmAstNode {
WasmAstNode::Drawer(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::DynamicBlock; use crate::types::DynamicBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmDynamicBlock { pub struct WasmDynamicBlock {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
DynamicBlock<'s>, DynamicBlock<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::DynamicBlock(original) },
{ "TODO".into() },
{ {
Ok(WasmDynamicBlock { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmDynamicBlock {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmDynamicBlock {
fn into(self) -> WasmAstNode {
WasmAstNode::DynamicBlock(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Entity; use crate::types::Entity;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmEntity { pub struct WasmEntity {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Entity<'s>, Entity<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Entity(original) },
{ "TODO".into() },
{ {
Ok(WasmEntity { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmEntity {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmEntity {
fn into(self) -> WasmAstNode {
WasmAstNode::Entity(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::ExampleBlock; use crate::types::ExampleBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmExampleBlock { pub struct WasmExampleBlock {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
ExampleBlock<'s>, ExampleBlock<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::ExampleBlock(original) },
{ "TODO".into() },
{ {
Ok(WasmExampleBlock { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmExampleBlock {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmExampleBlock {
fn into(self) -> WasmAstNode {
WasmAstNode::ExampleBlock(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::ExportBlock; use crate::types::ExportBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmExportBlock { pub struct WasmExportBlock {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
ExportBlock<'s>, ExportBlock<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::ExportBlock(original) },
{ "TODO".into() },
{ {
Ok(WasmExportBlock { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmExportBlock {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmExportBlock {
fn into(self) -> WasmAstNode {
WasmAstNode::ExportBlock(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::ExportSnippet; use crate::types::ExportSnippet;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmExportSnippet { pub struct WasmExportSnippet {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
ExportSnippet<'s>, ExportSnippet<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::ExportSnippet(original) },
{ "TODO".into() },
{ {
Ok(WasmExportSnippet { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmExportSnippet {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmExportSnippet {
fn into(self) -> WasmAstNode {
WasmAstNode::ExportSnippet(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::FixedWidthArea; use crate::types::FixedWidthArea;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmFixedWidthArea { pub struct WasmFixedWidthArea {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
FixedWidthArea<'s>, FixedWidthArea<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::FixedWidthArea(original) },
{ "TODO".into() },
{ {
Ok(WasmFixedWidthArea { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmFixedWidthArea {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmFixedWidthArea {
fn into(self) -> WasmAstNode {
WasmAstNode::FixedWidthArea(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::FootnoteDefinition; use crate::types::FootnoteDefinition;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmFootnoteDefinition { pub struct WasmFootnoteDefinition {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
FootnoteDefinition<'s>, FootnoteDefinition<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::FootnoteDefinition(original) },
{ "TODO".into() },
{ {
Ok(WasmFootnoteDefinition { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmFootnoteDefinition {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmFootnoteDefinition {
fn into(self) -> WasmAstNode {
WasmAstNode::FootnoteDefinition(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::FootnoteReference; use crate::types::FootnoteReference;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmFootnoteReference { pub struct WasmFootnoteReference {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
FootnoteReference<'s>, FootnoteReference<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::FootnoteReference(original) },
{ "TODO".into() },
{ {
Ok(WasmFootnoteReference { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmFootnoteReference {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmFootnoteReference {
fn into(self) -> WasmAstNode {
WasmAstNode::FootnoteReference(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode; use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Heading; use crate::types::Heading;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "headline")]
pub struct WasmHeadline { pub struct WasmHeadline {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Heading<'s>, Heading<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Headline(original) },
{ "TODO".into() },
{ {
Ok(WasmHeadline { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmHeadline {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmHeadline {
fn into(self) -> WasmAstNode {
WasmAstNode::Headline(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::HorizontalRule; use crate::types::HorizontalRule;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmHorizontalRule { pub struct WasmHorizontalRule {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
HorizontalRule<'s>, HorizontalRule<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::HorizontalRule(original) },
{ "TODO".into() },
{ {
Ok(WasmHorizontalRule { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmHorizontalRule {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmHorizontalRule {
fn into(self) -> WasmAstNode {
WasmAstNode::HorizontalRule(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::InlineBabelCall; use crate::types::InlineBabelCall;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmInlineBabelCall { pub struct WasmInlineBabelCall {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
InlineBabelCall<'s>, InlineBabelCall<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::InlineBabelCall(original) },
{ "TODO".into() },
{ {
Ok(WasmInlineBabelCall { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmInlineBabelCall {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmInlineBabelCall {
fn into(self) -> WasmAstNode {
WasmAstNode::InlineBabelCall(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::InlineSourceBlock; use crate::types::InlineSourceBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmInlineSourceBlock { pub struct WasmInlineSourceBlock {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
InlineSourceBlock<'s>, InlineSourceBlock<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::InlineSourceBlock(original) },
{ "TODO".into() },
{ {
Ok(WasmInlineSourceBlock { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmInlineSourceBlock {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmInlineSourceBlock {
fn into(self) -> WasmAstNode {
WasmAstNode::InlineSourceBlock(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Italic; use crate::types::Italic;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmItalic { pub struct WasmItalic {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Italic<'s>, Italic<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Italic(original) },
{ "TODO".into() },
{ {
Ok(WasmItalic { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmItalic {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmItalic {
fn into(self) -> WasmAstNode {
WasmAstNode::Italic(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Keyword; use crate::types::Keyword;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmKeyword { pub struct WasmKeyword {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Keyword<'s>, Keyword<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Keyword(original) },
{ "TODO".into() },
{ {
Ok(WasmKeyword { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmKeyword {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmKeyword {
fn into(self) -> WasmAstNode {
WasmAstNode::Keyword(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::LatexEnvironment; use crate::types::LatexEnvironment;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmLatexEnvironment { pub struct WasmLatexEnvironment {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
LatexEnvironment<'s>, LatexEnvironment<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::LatexEnvironment(original) },
{ "TODO".into() },
{ {
Ok(WasmLatexEnvironment { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmLatexEnvironment {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmLatexEnvironment {
fn into(self) -> WasmAstNode {
WasmAstNode::LatexEnvironment(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::LatexFragment; use crate::types::LatexFragment;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmLatexFragment { pub struct WasmLatexFragment {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
LatexFragment<'s>, LatexFragment<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::LatexFragment(original) },
{ "TODO".into() },
{ {
Ok(WasmLatexFragment { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmLatexFragment {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmLatexFragment {
fn into(self) -> WasmAstNode {
WasmAstNode::LatexFragment(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::LineBreak; use crate::types::LineBreak;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmLineBreak { pub struct WasmLineBreak {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
LineBreak<'s>, LineBreak<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::LineBreak(original) },
{ "TODO".into() },
{ {
Ok(WasmLineBreak { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmLineBreak {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmLineBreak {
fn into(self) -> WasmAstNode {
WasmAstNode::LineBreak(self)
}
}

View File

@ -2,42 +2,6 @@
/// ///
/// 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, $original:ident, $wasm_context:ident, $fnbody:tt) => {
impl<'s> ToWasm for $istruct {
type Output = $ostruct;
fn to_wasm(
&self,
$wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>,
) -> Result<Self::Output, crate::error::CustomError> {
let $original = self;
$fnbody
}
}
};
($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $standard_properties:ident, $fnbody:tt) => {
impl<'s> ToWasm for $istruct {
type Output = $ostruct;
fn 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.clone())?;
$fnbody
}
}
};
}
pub(crate) use to_wasm;
/// Write the implementation for the intermediate ast node.
///
/// This exists to make changing the type signature easier.
macro_rules! new_to_wasm {
($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $fnbody:tt) => { ($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $fnbody:tt) => {
impl<'s> ToWasm for $istruct { impl<'s> ToWasm for $istruct {
type Output = $ostruct; type Output = $ostruct;
@ -83,7 +47,7 @@ macro_rules! new_to_wasm {
} }
#[cfg(feature = "wasm_test")] #[cfg(feature = "wasm_test")]
impl<'s> ElispFact<'s> for $ostruct { impl<'s> crate::compare::ElispFact<'s> for $ostruct {
fn get_elisp_name<'b>(&'b self) -> std::borrow::Cow<'s, str> { fn get_elisp_name<'b>(&'b self) -> std::borrow::Cow<'s, str> {
let $original = self; let $original = self;
let ret = $elispnamebody; let ret = $elispnamebody;
@ -93,4 +57,4 @@ macro_rules! new_to_wasm {
}; };
} }
pub(crate) use new_to_wasm; pub(crate) use to_wasm;

View File

@ -67,6 +67,7 @@ pub use additional_property::AdditionalProperties;
pub use additional_property::AdditionalPropertyValue; pub use additional_property::AdditionalPropertyValue;
pub(crate) use angle_link::WasmAngleLink; pub(crate) use angle_link::WasmAngleLink;
pub use ast_node::WasmAstNode; pub use ast_node::WasmAstNode;
pub use ast_node::WasmAstNodeWrapper;
pub(crate) use babel_call::WasmBabelCall; pub(crate) use babel_call::WasmBabelCall;
pub(crate) use bold::WasmBold; pub(crate) use bold::WasmBold;
pub(crate) use center_block::WasmCenterBlock; pub(crate) use center_block::WasmCenterBlock;

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::NodeProperty; use crate::types::NodeProperty;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmNodeProperty { pub struct WasmNodeProperty {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,11 +20,14 @@ to_wasm!(
NodeProperty<'s>, NodeProperty<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::NodeProperty(original) },
{ "TODO".into() },
{ {
Ok(WasmNodeProperty { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmNodeProperty {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::OrgMacro; use crate::types::OrgMacro;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmOrgMacro { pub struct WasmOrgMacro {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
OrgMacro<'s>, OrgMacro<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::OrgMacro(original) },
{ "TODO".into() },
{ {
Ok(WasmOrgMacro { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmOrgMacro {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmOrgMacro {
fn into(self) -> WasmAstNode {
WasmAstNode::OrgMacro(self)
}
}

View File

@ -1,24 +1,19 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties; use super::AdditionalProperties;
#[cfg(feature = "wasm_test")]
use crate::compare::ElispFact; use crate::compare::ElispFact;
use crate::types::GetAffiliatedKeywords; use crate::types::GetAffiliatedKeywords;
use crate::types::Paragraph; use crate::types::Paragraph;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "paragraph")]
pub struct WasmParagraph { pub struct WasmParagraph {
pub(crate) standard_properties: WasmStandardProperties,
#[serde(flatten)] #[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties, pub(crate) additional_properties: AdditionalProperties,
pub(crate) children: Vec<WasmAstNode>,
} }
to_wasm!( to_wasm!(
@ -26,7 +21,8 @@ to_wasm!(
Paragraph<'s>, Paragraph<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Paragraph(original) },
{ "paragraph".into() },
{ {
let additional_properties = original let additional_properties = original
.get_affiliated_keywords() .get_affiliated_keywords()
@ -42,23 +38,11 @@ to_wasm!(
}) })
.collect::<Result<Vec<_>, _>>()?; .collect::<Result<Vec<_>, _>>()?;
Ok(WasmParagraph { Ok((
standard_properties,
additional_properties,
children, children,
}) WasmParagraph {
additional_properties,
},
))
} }
); );
impl Into<WasmAstNode> for WasmParagraph {
fn into(self) -> WasmAstNode {
WasmAstNode::Paragraph(self)
}
}
#[cfg(feature = "wasm_test")]
impl<'s> ElispFact<'s> for WasmParagraph {
fn get_elisp_name<'b>(&'b self) -> std::borrow::Cow<'s, str> {
"paragraph".into()
}
}

View File

@ -1,12 +1,14 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNodeWrapper;
use super::document::WasmDocument; use super::document::WasmDocument;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "status", content = "content")] #[serde(tag = "status", content = "content")]
pub enum ParseResult { pub enum ParseResult {
#[serde(rename = "success")] #[serde(rename = "success")]
Success(WasmDocument), Success(WasmAstNodeWrapper<WasmDocument>),
#[serde(rename = "error")] #[serde(rename = "error")]
Error(String), Error(String),

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::PlainLink; use crate::types::PlainLink;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmPlainLink { pub struct WasmPlainLink {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
PlainLink<'s>, PlainLink<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::PlainLink(original) },
{ "TODO".into() },
{ {
Ok(WasmPlainLink { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmPlainLink {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmPlainLink {
fn into(self) -> WasmAstNode {
WasmAstNode::PlainLink(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::PlainList; use crate::types::PlainList;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmPlainList { pub struct WasmPlainList {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
PlainList<'s>, PlainList<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::PlainList(original) },
{ "TODO".into() },
{ {
Ok(WasmPlainList { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmPlainList {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmPlainList {
fn into(self) -> WasmAstNode {
WasmAstNode::PlainList(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::PlainListItem; use crate::types::PlainListItem;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmPlainListItem { pub struct WasmPlainListItem {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,11 +20,24 @@ to_wasm!(
PlainListItem<'s>, PlainListItem<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::PlainListItem(original) },
{ "TODO".into() },
{ {
Ok(WasmPlainListItem { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmPlainListItem {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::PlainText; use crate::types::PlainText;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmPlainText { pub struct WasmPlainText {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
PlainText<'s>, PlainText<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::PlainText(original) },
{ "TODO".into() },
{ {
Ok(WasmPlainText { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmPlainText {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmPlainText {
fn into(self) -> WasmAstNode {
WasmAstNode::PlainText(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Planning; use crate::types::Planning;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmPlanning { pub struct WasmPlanning {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Planning<'s>, Planning<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Planning(original) },
{ "TODO".into() },
{ {
Ok(WasmPlanning { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmPlanning {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmPlanning {
fn into(self) -> WasmAstNode {
WasmAstNode::Planning(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::PropertyDrawer; use crate::types::PropertyDrawer;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmPropertyDrawer { pub struct WasmPropertyDrawer {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
PropertyDrawer<'s>, PropertyDrawer<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::PropertyDrawer(original) },
{ "TODO".into() },
{ {
Ok(WasmPropertyDrawer { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmPropertyDrawer {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmPropertyDrawer {
fn into(self) -> WasmAstNode {
WasmAstNode::PropertyDrawer(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::QuoteBlock; use crate::types::QuoteBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmQuoteBlock { pub struct WasmQuoteBlock {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
QuoteBlock<'s>, QuoteBlock<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::QuoteBlock(original) },
{ "TODO".into() },
{ {
Ok(WasmQuoteBlock { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmQuoteBlock {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmQuoteBlock {
fn into(self) -> WasmAstNode {
WasmAstNode::QuoteBlock(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::RadioLink; use crate::types::RadioLink;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmRadioLink { pub struct WasmRadioLink {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
RadioLink<'s>, RadioLink<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::RadioLink(original) },
{ "TODO".into() },
{ {
Ok(WasmRadioLink { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmRadioLink {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmRadioLink {
fn into(self) -> WasmAstNode {
WasmAstNode::RadioLink(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::RadioTarget; use crate::types::RadioTarget;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmRadioTarget { pub struct WasmRadioTarget {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
RadioTarget<'s>, RadioTarget<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::RadioTarget(original) },
{ "TODO".into() },
{ {
Ok(WasmRadioTarget { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmRadioTarget {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmRadioTarget {
fn into(self) -> WasmAstNode {
WasmAstNode::RadioTarget(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::RegularLink; use crate::types::RegularLink;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmRegularLink { pub struct WasmRegularLink {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
RegularLink<'s>, RegularLink<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::RegularLink(original) },
{ "TODO".into() },
{ {
Ok(WasmRegularLink { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmRegularLink {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmRegularLink {
fn into(self) -> WasmAstNode {
WasmAstNode::RegularLink(self)
}
}

View File

@ -1,23 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode; use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties; use super::AdditionalProperties;
#[cfg(feature = "wasm_test")]
use crate::compare::ElispFact; use crate::compare::ElispFact;
use crate::types::Section; use crate::types::Section;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "section")]
pub struct WasmSection { pub struct WasmSection {
pub(crate) standard_properties: WasmStandardProperties,
#[serde(flatten)] #[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties, pub(crate) additional_properties: AdditionalProperties,
pub(crate) children: Vec<WasmAstNode>,
} }
to_wasm!( to_wasm!(
@ -25,7 +20,8 @@ to_wasm!(
Section<'s>, Section<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Section(original) },
{ "section".into() },
{ {
let children = original let children = original
.children .children
@ -37,23 +33,11 @@ to_wasm!(
}) })
.collect::<Result<Vec<_>, _>>()?; .collect::<Result<Vec<_>, _>>()?;
Ok(WasmSection { Ok((
standard_properties,
additional_properties: AdditionalProperties::default(),
children, children,
}) WasmSection {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmSection {
fn into(self) -> WasmAstNode {
WasmAstNode::Section(self)
}
}
#[cfg(feature = "wasm_test")]
impl<'s> ElispFact<'s> for WasmSection {
fn get_elisp_name<'b>(&'b self) -> std::borrow::Cow<'s, str> {
"section".into()
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::SpecialBlock; use crate::types::SpecialBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmSpecialBlock { pub struct WasmSpecialBlock {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
SpecialBlock<'s>, SpecialBlock<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::SpecialBlock(original) },
{ "TODO".into() },
{ {
Ok(WasmSpecialBlock { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmSpecialBlock {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmSpecialBlock {
fn into(self) -> WasmAstNode {
WasmAstNode::SpecialBlock(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::SrcBlock; use crate::types::SrcBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmSrcBlock { pub struct WasmSrcBlock {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
SrcBlock<'s>, SrcBlock<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::SrcBlock(original) },
{ "TODO".into() },
{ {
Ok(WasmSrcBlock { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmSrcBlock {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmSrcBlock {
fn into(self) -> WasmAstNode {
WasmAstNode::SrcBlock(self)
}
}

View File

@ -1,3 +1,4 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::to_wasm::ToWasmContext; use super::to_wasm::ToWasmContext;
@ -5,7 +6,7 @@ use super::to_wasm::ToWasmStandardProperties;
use crate::types::PostBlank; use crate::types::PostBlank;
use crate::types::StandardProperties; use crate::types::StandardProperties;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
pub(crate) struct WasmStandardProperties { pub(crate) struct WasmStandardProperties {
pub(crate) begin: usize, pub(crate) begin: usize,
pub(crate) end: usize, pub(crate) end: usize,

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::StatisticsCookie; use crate::types::StatisticsCookie;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmStatisticsCookie { pub struct WasmStatisticsCookie {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
StatisticsCookie<'s>, StatisticsCookie<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::StatisticsCookie(original) },
{ "TODO".into() },
{ {
Ok(WasmStatisticsCookie { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmStatisticsCookie {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmStatisticsCookie {
fn into(self) -> WasmAstNode {
WasmAstNode::StatisticsCookie(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::StrikeThrough; use crate::types::StrikeThrough;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmStrikeThrough { pub struct WasmStrikeThrough {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
StrikeThrough<'s>, StrikeThrough<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::StrikeThrough(original) },
{ "TODO".into() },
{ {
Ok(WasmStrikeThrough { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmStrikeThrough {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmStrikeThrough {
fn into(self) -> WasmAstNode {
WasmAstNode::StrikeThrough(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Subscript; use crate::types::Subscript;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmSubscript { pub struct WasmSubscript {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Subscript<'s>, Subscript<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Subscript(original) },
{ "TODO".into() },
{ {
Ok(WasmSubscript { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmSubscript {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmSubscript {
fn into(self) -> WasmAstNode {
WasmAstNode::Subscript(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Superscript; use crate::types::Superscript;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmSuperscript { pub struct WasmSuperscript {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Superscript<'s>, Superscript<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Superscript(original) },
{ "TODO".into() },
{ {
Ok(WasmSuperscript { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmSuperscript {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmSuperscript {
fn into(self) -> WasmAstNode {
WasmAstNode::Superscript(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Table; use crate::types::Table;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmTable { pub struct WasmTable {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Table<'s>, Table<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Table(original) },
{ "TODO".into() },
{ {
Ok(WasmTable { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmTable {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmTable {
fn into(self) -> WasmAstNode {
WasmAstNode::Table(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::TableCell; use crate::types::TableCell;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmTableCell { pub struct WasmTableCell {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,11 +20,24 @@ to_wasm!(
TableCell<'s>, TableCell<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::TableCell(original) },
{ "TODO".into() },
{ {
Ok(WasmTableCell { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmTableCell {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::TableRow; use crate::types::TableRow;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmTableRow { pub struct WasmTableRow {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,11 +20,24 @@ to_wasm!(
TableRow<'s>, TableRow<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::TableRow(original) },
{ "TODO".into() },
{ {
Ok(WasmTableRow { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmTableRow {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Target; use crate::types::Target;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmTarget { pub struct WasmTarget {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Target<'s>, Target<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Target(original) },
{ "TODO".into() },
{ {
Ok(WasmTarget { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmTarget {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmTarget {
fn into(self) -> WasmAstNode {
WasmAstNode::Target(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Timestamp; use crate::types::Timestamp;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmTimestamp { pub struct WasmTimestamp {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Timestamp<'s>, Timestamp<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Timestamp(original) },
{ "TODO".into() },
{ {
Ok(WasmTimestamp { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmTimestamp {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmTimestamp {
fn into(self) -> WasmAstNode {
WasmAstNode::Timestamp(self)
}
}

View File

@ -1,6 +1,7 @@
use super::macros::to_wasm; use super::macros::to_wasm;
use super::WasmAstNode; use super::WasmAstNode;
use crate::error::CustomError; use crate::error::CustomError;
use crate::types::DocumentElement;
use crate::types::Element; use crate::types::Element;
use crate::types::Object; use crate::types::Object;
@ -30,125 +31,94 @@ impl<'s> ToWasmContext<'s> {
} }
} }
to_wasm!( to_wasm!(WasmAstNode, DocumentElement<'s>, original, wasm_context, {
WasmAstNode, match original {
Element<'s>, DocumentElement::Heading(inner) => {
original, inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
wasm_context, }
standard_properties, DocumentElement::Section(inner) => {
{ inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
match original {
Element::Paragraph(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Element::PlainList(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Element::CenterBlock(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Element::QuoteBlock(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Element::SpecialBlock(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Element::DynamicBlock(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Element::FootnoteDefinition(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Element::Comment(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Element::Drawer(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Element::PropertyDrawer(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Element::Table(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Element::VerseBlock(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Element::CommentBlock(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Element::ExampleBlock(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Element::ExportBlock(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Element::SrcBlock(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Element::Clock(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Element::DiarySexp(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Element::Planning(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Element::FixedWidthArea(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Element::HorizontalRule(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Element::Keyword(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Element::BabelCall(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Element::LatexEnvironment(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
} }
} }
); });
to_wasm!( to_wasm!(WasmAstNode, Element<'s>, original, wasm_context, {
WasmAstNode, match original {
Object<'s>, Element::Paragraph(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
original, Element::PlainList(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
wasm_context, Element::CenterBlock(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
standard_properties, Element::QuoteBlock(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
{ Element::SpecialBlock(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
match original { Element::DynamicBlock(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::Bold(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into), Element::FootnoteDefinition(inner) => {
Object::Italic(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into), inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
Object::Underline(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into), }
Object::StrikeThrough(inner) => { Element::Comment(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into) Element::Drawer(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
} Element::PropertyDrawer(inner) => {
Object::Code(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into), inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
Object::Verbatim(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into), }
Object::PlainText(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into), Element::Table(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::RegularLink(inner) => { Element::VerseBlock(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into) Element::CommentBlock(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
} Element::ExampleBlock(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::RadioLink(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into), Element::ExportBlock(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::RadioTarget(inner) => { Element::SrcBlock(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into) Element::Clock(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
} Element::DiarySexp(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::PlainLink(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into), Element::Planning(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::AngleLink(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into), Element::FixedWidthArea(inner) => {
Object::OrgMacro(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into), inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
Object::Entity(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into), }
Object::LatexFragment(inner) => { Element::HorizontalRule(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into) inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
} }
Object::ExportSnippet(inner) => { Element::Keyword(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into) Element::BabelCall(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
} Element::LatexEnvironment(inner) => {
Object::FootnoteReference(inner) => { inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Object::Citation(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::CitationReference(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Object::InlineBabelCall(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Object::InlineSourceBlock(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Object::LineBreak(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::Target(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::StatisticsCookie(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Object::Subscript(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::Superscript(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Object::Timestamp(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
} }
} }
); });
to_wasm!(WasmAstNode, Object<'s>, original, wasm_context, {
match original {
Object::Bold(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::Italic(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::Underline(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::StrikeThrough(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::Code(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::Verbatim(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::PlainText(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::RegularLink(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::RadioLink(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::RadioTarget(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::PlainLink(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::AngleLink(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::OrgMacro(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::Entity(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::LatexFragment(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::ExportSnippet(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::FootnoteReference(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Object::Citation(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::CitationReference(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Object::InlineBabelCall(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Object::InlineSourceBlock(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Object::LineBreak(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::Target(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::StatisticsCookie(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
Object::Subscript(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::Superscript(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
Object::Timestamp(inner) => inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into),
}
});

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Underline; use crate::types::Underline;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmUnderline { pub struct WasmUnderline {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Underline<'s>, Underline<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Underline(original) },
{ "TODO".into() },
{ {
Ok(WasmUnderline { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmUnderline {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmUnderline {
fn into(self) -> WasmAstNode {
WasmAstNode::Underline(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Verbatim; use crate::types::Verbatim;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmVerbatim { pub struct WasmVerbatim {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Verbatim<'s>, Verbatim<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::Verbatim(original) },
{ "TODO".into() },
{ {
Ok(WasmVerbatim { Ok((
standard_properties, Vec::new(),
children: Vec::new(), WasmVerbatim {
}) additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmVerbatim {
fn into(self) -> WasmAstNode {
WasmAstNode::Verbatim(self)
}
}

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::VerseBlock; use crate::types::VerseBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmVerseBlock { pub struct WasmVerseBlock {
standard_properties: WasmStandardProperties, #[serde(flatten)]
children: Vec<WasmAstNode>, pub(crate) additional_properties: AdditionalProperties,
} }
to_wasm!( to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
VerseBlock<'s>, VerseBlock<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, { WasmAstNode::VerseBlock(original) },
{ "TODO".into() },
{ {
Ok(WasmVerseBlock { let children = original
standard_properties, .children
children: Vec::new(), .iter()
}) .map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmVerseBlock {
additional_properties: AdditionalProperties::default(),
},
))
} }
); );
impl Into<WasmAstNode> for WasmVerseBlock {
fn into(self) -> WasmAstNode {
WasmAstNode::VerseBlock(self)
}
}

View File

@ -7,6 +7,7 @@ use crate::compare::EmacsField;
use crate::compare::Token; use crate::compare::Token;
use crate::wasm::WasmAngleLink; use crate::wasm::WasmAngleLink;
use crate::wasm::WasmAstNode; use crate::wasm::WasmAstNode;
use crate::wasm::WasmAstNodeWrapper;
use crate::wasm::WasmBabelCall; use crate::wasm::WasmBabelCall;
use crate::wasm::WasmBold; use crate::wasm::WasmBold;
use crate::wasm::WasmCenterBlock; use crate::wasm::WasmCenterBlock;
@ -69,7 +70,7 @@ use crate::wasm_test::macros::wasm_compare;
pub fn wasm_compare_document<'e, 's, 'w>( pub fn wasm_compare_document<'e, 's, 'w>(
source: &'s str, source: &'s str,
emacs: &'e Token<'s>, emacs: &'e Token<'s>,
wasm: &'w WasmDocument, wasm: &'w WasmAstNodeWrapper<WasmDocument>,
) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> { ) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
let wasm_json = serde_json::to_string(&wasm)?; let wasm_json = serde_json::to_string(&wasm)?;
let wasm_json_parsed = serde_json::from_str(&wasm_json)?; let wasm_json_parsed = serde_json::from_str(&wasm_json)?;
@ -153,6 +154,11 @@ fn compare_ast_node<'b, 's, 'p>(
.next() .next()
.ok_or("Should have an attributes child.")? .ok_or("Should have an attributes child.")?
.as_map()?; .as_map()?;
let wasm_attributes_map = wasm
.get("properties")
.ok_or(r#"Wasm ast node should have a "properties" attribute."#)?
.as_object()
.ok_or(r#"Wasm ast node "properties" attribute should be an object."#)?;
{ {
// Compare attribute names. // Compare attribute names.
@ -160,11 +166,10 @@ fn compare_ast_node<'b, 's, 'p>(
.keys() .keys()
.map(|s| (*s).to_owned()) .map(|s| (*s).to_owned())
.collect(); .collect();
let wasm_keys: std::collections::BTreeSet<String> = wasm let wasm_keys: std::collections::BTreeSet<String> =
.keys() std::iter::once(":standard-properties".to_owned())
.filter(|k| !k.starts_with("__")) .chain(wasm_attributes_map.keys().map(wasm_key_to_emacs_key))
.map(wasm_key_to_emacs_key) .collect();
.collect();
let emacs_only_attributes: Vec<&String> = emacs_keys.difference(&wasm_keys).collect(); let emacs_only_attributes: Vec<&String> = emacs_keys.difference(&wasm_keys).collect();
let wasm_only_attributes: Vec<&String> = wasm_keys.difference(&emacs_keys).collect(); let wasm_only_attributes: Vec<&String> = wasm_keys.difference(&emacs_keys).collect();
if !emacs_only_attributes.is_empty() { if !emacs_only_attributes.is_empty() {
@ -201,13 +206,10 @@ fn compare_ast_node<'b, 's, 'p>(
{ {
// Compare attributes. // Compare attributes.
for attribute_name in wasm for attribute_name in wasm_attributes_map.keys() {
.keys()
.filter(|k| !k.starts_with("__") && k.as_str() != "standard-properties")
{
let mut layer = WasmDiffResult::default(); let mut layer = WasmDiffResult::default();
layer.name = Cow::Owned(attribute_name.clone()); layer.name = Cow::Owned(attribute_name.clone());
let wasm_attribute_value = wasm let wasm_attribute_value = wasm_attributes_map
.get(attribute_name) .get(attribute_name)
.ok_or("Key should exist in both wasm and elisp at this point.")?; .ok_or("Key should exist in both wasm and elisp at this point.")?;
let emacs_key = wasm_key_to_emacs_key(attribute_name); let emacs_key = wasm_key_to_emacs_key(attribute_name);