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

View File

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

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::BabelCall;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmBabelCall {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
BabelCall<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::BabelCall(original) },
{ "TODO".into() },
{
Ok(WasmBabelCall {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Bold;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmBold {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Bold<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Bold(original) },
{ "TODO".into() },
{
Ok(WasmBold {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::CenterBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmCenterBlock {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
CenterBlock<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::CenterBlock(original) },
{ "TODO".into() },
{
Ok(WasmCenterBlock {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Citation;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmCitation {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Citation<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Citation(original) },
{ "TODO".into() },
{
Ok(WasmCitation {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::CitationReference;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmCitationReference {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
CitationReference<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::CitationReference(original) },
{ "TODO".into() },
{
Ok(WasmCitationReference {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Clock;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmClock {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Clock<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Clock(original) },
{ "TODO".into() },
{
Ok(WasmClock {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Code;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmCode {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Code<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Code(original) },
{ "TODO".into() },
{
Ok(WasmCode {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Comment;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmComment {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Comment<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Comment(original) },
{ "TODO".into() },
{
Ok(WasmComment {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::CommentBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmCommentBlock {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
CommentBlock<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::CommentBlock(original) },
{ "TODO".into() },
{
Ok(WasmCommentBlock {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::DiarySexp;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmDiarySexp {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
DiarySexp<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::DiarySexp(original) },
{ "TODO".into() },
{
Ok(WasmDiarySexp {
standard_properties,
children: Vec::new(),
})
Ok((
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 serde::Deserialize;
use serde::Serialize;
use super::additional_property::AdditionalProperties;
use super::additional_property::AdditionalPropertyValue;
use super::ast_node::WasmAstNode;
use super::macros::new_to_wasm;
use super::macros::to_wasm;
use super::to_wasm::ToWasm;
#[cfg(feature = "wasm_test")]
use crate::compare::ElispFact;
use crate::types::Document;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmDocument {
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
@ -22,7 +21,7 @@ pub struct WasmDocument {
pub(crate) path: Option<PathBuf>,
}
new_to_wasm!(
to_wasm!(
WasmDocument,
Document<'s>,
original,

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Drawer;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmDrawer {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Drawer<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Drawer(original) },
{ "TODO".into() },
{
Ok(WasmDrawer {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::DynamicBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmDynamicBlock {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
DynamicBlock<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::DynamicBlock(original) },
{ "TODO".into() },
{
Ok(WasmDynamicBlock {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Entity;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmEntity {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Entity<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Entity(original) },
{ "TODO".into() },
{
Ok(WasmEntity {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::ExampleBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmExampleBlock {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
ExampleBlock<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::ExampleBlock(original) },
{ "TODO".into() },
{
Ok(WasmExampleBlock {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::ExportBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmExportBlock {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
ExportBlock<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::ExportBlock(original) },
{ "TODO".into() },
{
Ok(WasmExportBlock {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::ExportSnippet;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmExportSnippet {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
ExportSnippet<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::ExportSnippet(original) },
{ "TODO".into() },
{
Ok(WasmExportSnippet {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::FixedWidthArea;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmFixedWidthArea {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
FixedWidthArea<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::FixedWidthArea(original) },
{ "TODO".into() },
{
Ok(WasmFixedWidthArea {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::FootnoteDefinition;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmFootnoteDefinition {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
FootnoteDefinition<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::FootnoteDefinition(original) },
{ "TODO".into() },
{
Ok(WasmFootnoteDefinition {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::FootnoteReference;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmFootnoteReference {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
FootnoteReference<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::FootnoteReference(original) },
{ "TODO".into() },
{
Ok(WasmFootnoteReference {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Heading;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "headline")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmHeadline {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Heading<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Headline(original) },
{ "TODO".into() },
{
Ok(WasmHeadline {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::HorizontalRule;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmHorizontalRule {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
HorizontalRule<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::HorizontalRule(original) },
{ "TODO".into() },
{
Ok(WasmHorizontalRule {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::InlineBabelCall;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmInlineBabelCall {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
InlineBabelCall<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::InlineBabelCall(original) },
{ "TODO".into() },
{
Ok(WasmInlineBabelCall {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::InlineSourceBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmInlineSourceBlock {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
InlineSourceBlock<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::InlineSourceBlock(original) },
{ "TODO".into() },
{
Ok(WasmInlineSourceBlock {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Italic;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmItalic {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Italic<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Italic(original) },
{ "TODO".into() },
{
Ok(WasmItalic {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Keyword;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmKeyword {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Keyword<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Keyword(original) },
{ "TODO".into() },
{
Ok(WasmKeyword {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::LatexEnvironment;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmLatexEnvironment {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
LatexEnvironment<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::LatexEnvironment(original) },
{ "TODO".into() },
{
Ok(WasmLatexEnvironment {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::LatexFragment;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmLatexFragment {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
LatexFragment<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::LatexFragment(original) },
{ "TODO".into() },
{
Ok(WasmLatexFragment {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::LineBreak;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmLineBreak {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
LineBreak<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::LineBreak(original) },
{ "TODO".into() },
{
Ok(WasmLineBreak {
standard_properties,
children: Vec::new(),
})
Ok((
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.
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) => {
impl<'s> ToWasm for $istruct {
type Output = $ostruct;
@ -83,7 +47,7 @@ macro_rules! new_to_wasm {
}
#[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> {
let $original = self;
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(crate) use angle_link::WasmAngleLink;
pub use ast_node::WasmAstNode;
pub use ast_node::WasmAstNodeWrapper;
pub(crate) use babel_call::WasmBabelCall;
pub(crate) use bold::WasmBold;
pub(crate) use center_block::WasmCenterBlock;

View File

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

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::OrgMacro;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmOrgMacro {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
OrgMacro<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::OrgMacro(original) },
{ "TODO".into() },
{
Ok(WasmOrgMacro {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
#[cfg(feature = "wasm_test")]
use crate::compare::ElispFact;
use crate::types::GetAffiliatedKeywords;
use crate::types::Paragraph;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "paragraph")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmParagraph {
pub(crate) standard_properties: WasmStandardProperties,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
pub(crate) children: Vec<WasmAstNode>,
}
to_wasm!(
@ -26,7 +21,8 @@ to_wasm!(
Paragraph<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Paragraph(original) },
{ "paragraph".into() },
{
let additional_properties = original
.get_affiliated_keywords()
@ -42,23 +38,11 @@ to_wasm!(
})
.collect::<Result<Vec<_>, _>>()?;
Ok(WasmParagraph {
standard_properties,
additional_properties,
Ok((
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 super::ast_node::WasmAstNodeWrapper;
use super::document::WasmDocument;
#[derive(Debug, Serialize)]
#[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "status", content = "content")]
pub enum ParseResult {
#[serde(rename = "success")]
Success(WasmDocument),
Success(WasmAstNodeWrapper<WasmDocument>),
#[serde(rename = "error")]
Error(String),

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::PlainLink;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmPlainLink {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
PlainLink<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::PlainLink(original) },
{ "TODO".into() },
{
Ok(WasmPlainLink {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::PlainList;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmPlainList {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
PlainList<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::PlainList(original) },
{ "TODO".into() },
{
Ok(WasmPlainList {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::PlainListItem;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmPlainListItem {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,11 +20,24 @@ to_wasm!(
PlainListItem<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::PlainListItem(original) },
{ "TODO".into() },
{
Ok(WasmPlainListItem {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::PlainText;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmPlainText {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
PlainText<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::PlainText(original) },
{ "TODO".into() },
{
Ok(WasmPlainText {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Planning;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmPlanning {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Planning<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Planning(original) },
{ "TODO".into() },
{
Ok(WasmPlanning {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::PropertyDrawer;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmPropertyDrawer {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
PropertyDrawer<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::PropertyDrawer(original) },
{ "TODO".into() },
{
Ok(WasmPropertyDrawer {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::QuoteBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmQuoteBlock {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
QuoteBlock<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::QuoteBlock(original) },
{ "TODO".into() },
{
Ok(WasmQuoteBlock {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::RadioLink;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmRadioLink {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
RadioLink<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::RadioLink(original) },
{ "TODO".into() },
{
Ok(WasmRadioLink {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::RadioTarget;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmRadioTarget {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
RadioTarget<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::RadioTarget(original) },
{ "TODO".into() },
{
Ok(WasmRadioTarget {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::RegularLink;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmRegularLink {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
RegularLink<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::RegularLink(original) },
{ "TODO".into() },
{
Ok(WasmRegularLink {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
#[cfg(feature = "wasm_test")]
use crate::compare::ElispFact;
use crate::types::Section;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "section")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmSection {
pub(crate) standard_properties: WasmStandardProperties,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
pub(crate) children: Vec<WasmAstNode>,
}
to_wasm!(
@ -25,7 +20,8 @@ to_wasm!(
Section<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Section(original) },
{ "section".into() },
{
let children = original
.children
@ -37,23 +33,11 @@ to_wasm!(
})
.collect::<Result<Vec<_>, _>>()?;
Ok(WasmSection {
standard_properties,
additional_properties: AdditionalProperties::default(),
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::SpecialBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmSpecialBlock {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
SpecialBlock<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::SpecialBlock(original) },
{ "TODO".into() },
{
Ok(WasmSpecialBlock {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::SrcBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmSrcBlock {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
SrcBlock<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::SrcBlock(original) },
{ "TODO".into() },
{
Ok(WasmSrcBlock {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::to_wasm::ToWasmContext;
@ -5,7 +6,7 @@ use super::to_wasm::ToWasmStandardProperties;
use crate::types::PostBlank;
use crate::types::StandardProperties;
#[derive(Debug, Serialize)]
#[derive(Debug, Serialize, Deserialize)]
pub(crate) struct WasmStandardProperties {
pub(crate) begin: usize,
pub(crate) end: usize,

View File

@ -1,18 +1,18 @@
use serde::Deserialize;
use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::StatisticsCookie;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmStatisticsCookie {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
StatisticsCookie<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::StatisticsCookie(original) },
{ "TODO".into() },
{
Ok(WasmStatisticsCookie {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::StrikeThrough;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmStrikeThrough {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
StrikeThrough<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::StrikeThrough(original) },
{ "TODO".into() },
{
Ok(WasmStrikeThrough {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Subscript;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmSubscript {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Subscript<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Subscript(original) },
{ "TODO".into() },
{
Ok(WasmSubscript {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Superscript;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmSuperscript {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Superscript<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Superscript(original) },
{ "TODO".into() },
{
Ok(WasmSuperscript {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Table;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmTable {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Table<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Table(original) },
{ "TODO".into() },
{
Ok(WasmTable {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::TableCell;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmTableCell {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,11 +20,24 @@ to_wasm!(
TableCell<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::TableCell(original) },
{ "TODO".into() },
{
Ok(WasmTableCell {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::TableRow;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmTableRow {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,11 +20,24 @@ to_wasm!(
TableRow<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::TableRow(original) },
{ "TODO".into() },
{
Ok(WasmTableRow {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Target;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmTarget {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Target<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Target(original) },
{ "TODO".into() },
{
Ok(WasmTarget {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Timestamp;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmTimestamp {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Timestamp<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Timestamp(original) },
{ "TODO".into() },
{
Ok(WasmTimestamp {
standard_properties,
children: Vec::new(),
})
Ok((
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::WasmAstNode;
use crate::error::CustomError;
use crate::types::DocumentElement;
use crate::types::Element;
use crate::types::Object;
@ -30,125 +31,94 @@ impl<'s> ToWasmContext<'s> {
}
}
to_wasm!(
WasmAstNode,
Element<'s>,
original,
wasm_context,
standard_properties,
{
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!(WasmAstNode, DocumentElement<'s>, original, wasm_context, {
match original {
DocumentElement::Heading(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
DocumentElement::Section(inner) => {
inner.to_wasm(wasm_context).map(Into::<WasmAstNode>::into)
}
}
);
});
to_wasm!(
WasmAstNode,
Object<'s>,
original,
wasm_context,
standard_properties,
{
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),
to_wasm!(WasmAstNode, Element<'s>, original, wasm_context, {
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!(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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Underline;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmUnderline {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
Underline<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Underline(original) },
{ "TODO".into() },
{
Ok(WasmUnderline {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Verbatim;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmVerbatim {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,14 @@ to_wasm!(
Verbatim<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::Verbatim(original) },
{ "TODO".into() },
{
Ok(WasmVerbatim {
standard_properties,
children: Vec::new(),
})
Ok((
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 super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::VerseBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmVerseBlock {
standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode>,
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
}
to_wasm!(
@ -20,17 +20,24 @@ to_wasm!(
VerseBlock<'s>,
original,
wasm_context,
standard_properties,
{ WasmAstNode::VerseBlock(original) },
{ "TODO".into() },
{
Ok(WasmVerseBlock {
standard_properties,
children: Vec::new(),
})
let children = original
.children
.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::wasm::WasmAngleLink;
use crate::wasm::WasmAstNode;
use crate::wasm::WasmAstNodeWrapper;
use crate::wasm::WasmBabelCall;
use crate::wasm::WasmBold;
use crate::wasm::WasmCenterBlock;
@ -69,7 +70,7 @@ use crate::wasm_test::macros::wasm_compare;
pub fn wasm_compare_document<'e, 's, 'w>(
source: &'s str,
emacs: &'e Token<'s>,
wasm: &'w WasmDocument,
wasm: &'w WasmAstNodeWrapper<WasmDocument>,
) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
let wasm_json = serde_json::to_string(&wasm)?;
let wasm_json_parsed = serde_json::from_str(&wasm_json)?;
@ -153,6 +154,11 @@ fn compare_ast_node<'b, 's, 'p>(
.next()
.ok_or("Should have an attributes child.")?
.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.
@ -160,11 +166,10 @@ fn compare_ast_node<'b, 's, 'p>(
.keys()
.map(|s| (*s).to_owned())
.collect();
let wasm_keys: std::collections::BTreeSet<String> = wasm
.keys()
.filter(|k| !k.starts_with("__"))
.map(wasm_key_to_emacs_key)
.collect();
let wasm_keys: std::collections::BTreeSet<String> =
std::iter::once(":standard-properties".to_owned())
.chain(wasm_attributes_map.keys().map(wasm_key_to_emacs_key))
.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();
if !emacs_only_attributes.is_empty() {
@ -201,13 +206,10 @@ fn compare_ast_node<'b, 's, 'p>(
{
// Compare attributes.
for attribute_name in wasm
.keys()
.filter(|k| !k.starts_with("__") && k.as_str() != "standard-properties")
{
for attribute_name in wasm_attributes_map.keys() {
let mut layer = WasmDiffResult::default();
layer.name = Cow::Owned(attribute_name.clone());
let wasm_attribute_value = wasm
let wasm_attribute_value = wasm_attributes_map
.get(attribute_name)
.ok_or("Key should exist in both wasm and elisp at this point.")?;
let emacs_key = wasm_key_to_emacs_key(attribute_name);