organic/src/wasm/entity.rs

50 lines
1.3 KiB
Rust
Raw Normal View History

use serde::Deserialize;
use serde::Serialize;
use super::ast_node::WasmAstNode;
2023-12-30 16:24:51 -05:00
use super::headline::Noop;
use super::macros::to_wasm;
use super::to_wasm::ToWasm;
use crate::compare::ElispFact;
use crate::types::Entity;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)]
2023-12-29 12:49:43 -05:00
pub struct WasmEntity {
2023-12-30 16:24:51 -05:00
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!(
2023-12-29 12:49:43 -05:00
WasmEntity,
2023-12-25 11:51:39 -05:00
Entity<'s>,
2023-12-25 12:32:35 -05:00
original,
wasm_context,
{ WasmAstNode::Entity(original) },
2023-12-30 16:24:51 -05:00
{ "entity".into() },
{
Ok((
Vec::new(),
WasmEntity {
2023-12-30 16:24:51 -05:00
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,
},
))
}
);