Implement plain list item.
Some checks failed
clippy Build clippy has failed
rust-foreign-document-test Build rust-foreign-document-test has succeeded
rust-build Build rust-build has failed
rust-test Build rust-test has failed

This commit is contained in:
Tom Alexander 2023-12-29 23:06:45 -05:00
parent 606bab9e6d
commit c1b471208d
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -4,15 +4,20 @@ use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::to_wasm::ToWasm;
use super::AdditionalProperties;
use crate::compare::ElispFact;
use crate::types::CheckboxType;
use crate::types::PlainListItem;
use crate::types::PlainListItemCounter;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmPlainListItem {
#[serde(flatten)]
pub(crate) additional_properties: AdditionalProperties,
pub(crate) tag: Vec<WasmAstNode>,
pub(crate) bullet: String,
pub(crate) counter: Option<PlainListItemCounter>,
pub(crate) checkbox: Option<String>,
#[serde(rename = "pre-blank")]
pub(crate) pre_blank: usize,
}
to_wasm!(
@ -21,7 +26,7 @@ to_wasm!(
original,
wasm_context,
{ WasmAstNode::PlainListItem(original) },
{ "TODO".into() },
{ "item".into() },
{
let children = original
.children
@ -36,7 +41,18 @@ to_wasm!(
Ok((
children,
WasmPlainListItem {
additional_properties: AdditionalProperties::default(),
tag: Vec::new(),
bullet: original.bullet.to_owned(),
counter: original.counter.clone(),
checkbox: original.checkbox.as_ref().map(|(checkbox_type, _)| {
match checkbox_type {
CheckboxType::On => "on",
CheckboxType::Trans => "trans",
CheckboxType::Off => "off",
}
.to_owned()
}),
pre_blank: 0, // TODO: Should this be a no-op?
},
))
}