Implement plain list item.
This commit is contained in:
parent
606bab9e6d
commit
c1b471208d
@ -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?
|
||||
},
|
||||
))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user