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::ast_node::WasmAstNode;
|
||||||
use super::macros::to_wasm;
|
use super::macros::to_wasm;
|
||||||
use super::to_wasm::ToWasm;
|
use super::to_wasm::ToWasm;
|
||||||
use super::AdditionalProperties;
|
|
||||||
use crate::compare::ElispFact;
|
use crate::compare::ElispFact;
|
||||||
|
use crate::types::CheckboxType;
|
||||||
use crate::types::PlainListItem;
|
use crate::types::PlainListItem;
|
||||||
|
use crate::types::PlainListItemCounter;
|
||||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct WasmPlainListItem {
|
pub struct WasmPlainListItem {
|
||||||
#[serde(flatten)]
|
pub(crate) tag: Vec<WasmAstNode>,
|
||||||
pub(crate) additional_properties: AdditionalProperties,
|
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!(
|
to_wasm!(
|
||||||
@ -21,7 +26,7 @@ to_wasm!(
|
|||||||
original,
|
original,
|
||||||
wasm_context,
|
wasm_context,
|
||||||
{ WasmAstNode::PlainListItem(original) },
|
{ WasmAstNode::PlainListItem(original) },
|
||||||
{ "TODO".into() },
|
{ "item".into() },
|
||||||
{
|
{
|
||||||
let children = original
|
let children = original
|
||||||
.children
|
.children
|
||||||
@ -36,7 +41,18 @@ to_wasm!(
|
|||||||
Ok((
|
Ok((
|
||||||
children,
|
children,
|
||||||
WasmPlainListItem {
|
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…
x
Reference in New Issue
Block a user