Add category and path to WasmDocument.
This commit is contained in:
parent
4984ea4179
commit
abf066701e
2
Makefile
2
Makefile
@ -36,7 +36,7 @@ wasm:
|
||||
|
||||
.PHONY: run_wasm
|
||||
run_wasm:
|
||||
> cat /tmp/test.org | cargo run --profile wasm --bin wasm_test --features wasm_test | jq
|
||||
> cat /tmp/test.org | cargo run --profile wasm --bin wasm_test --features wasm_test
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
@ -1,3 +1,5 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use super::ast_node::WasmAstNode;
|
||||
@ -14,6 +16,8 @@ pub struct WasmDocument<'s> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
additional_properties: Vec<(String, &'s str)>,
|
||||
children: Vec<WasmAstNode<'s>>,
|
||||
category: Option<String>,
|
||||
path: Option<PathBuf>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
@ -23,6 +27,9 @@ to_wasm!(
|
||||
wasm_context,
|
||||
standard_properties,
|
||||
{
|
||||
let category = original.category.clone();
|
||||
let path = original.path.clone();
|
||||
|
||||
let additional_properties: Vec<(String, &str)> = original
|
||||
.get_additional_properties()
|
||||
.map(|node_property| {
|
||||
@ -47,20 +54,13 @@ to_wasm!(
|
||||
.map(Into::<WasmAstNode<'_>>::into)
|
||||
}))
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
// let children = original
|
||||
// .children
|
||||
// .iter()
|
||||
// .map(|child| {
|
||||
// child
|
||||
// .to_wasm(wasm_context.clone())
|
||||
// .map(Into::<WasmAstNode<'_>>::into)
|
||||
// })
|
||||
// .collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
Ok(WasmDocument {
|
||||
standard_properties,
|
||||
additional_properties,
|
||||
children,
|
||||
category,
|
||||
path,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user