Implement entity.

This commit is contained in:
Tom Alexander 2023-12-30 16:24:51 -05:00
parent e7742b529a
commit ea000894f0
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -2,17 +2,26 @@ use serde::Deserialize;
use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::headline::Noop;
use super::macros::to_wasm;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::Entity;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmEntity {
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
pub(crate) name: String,
pub(crate) latex: String,
#[serde(rename = "latex-math-p")]
pub(crate) latex_math_mode: bool,
pub(crate) html: String,
pub(crate) ascii: String,
pub(crate) latin1: Noop,
#[serde(rename = "utf-8")]
pub(crate) utf8: String,
#[serde(rename = "use-brackets-p")]
pub(crate) use_brackets: bool,
}
to_wasm!(
@ -21,12 +30,19 @@ to_wasm!(
original,
wasm_context,
{ WasmAstNode::Entity(original) },
{ "TODO".into() },
{ "entity".into() },
{
Ok((
Vec::new(),
WasmEntity {
additional_properties: AdditionalProperties::default(),
name: original.name.to_owned(),
latex: original.latex.to_owned(),
latex_math_mode: original.latex_math_mode,
html: original.html.to_owned(),
ascii: original.ascii.to_owned(),
latin1: Noop {},
utf8: original.utf8.to_owned(),
use_brackets: original.use_brackets,
},
))
}