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
|
.PHONY: run_wasm
|
||||||
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
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use super::ast_node::WasmAstNode;
|
use super::ast_node::WasmAstNode;
|
||||||
@ -14,6 +16,8 @@ pub struct WasmDocument<'s> {
|
|||||||
standard_properties: WasmStandardProperties,
|
standard_properties: WasmStandardProperties,
|
||||||
additional_properties: Vec<(String, &'s str)>,
|
additional_properties: Vec<(String, &'s str)>,
|
||||||
children: Vec<WasmAstNode<'s>>,
|
children: Vec<WasmAstNode<'s>>,
|
||||||
|
category: Option<String>,
|
||||||
|
path: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
to_wasm!(
|
to_wasm!(
|
||||||
@ -23,6 +27,9 @@ to_wasm!(
|
|||||||
wasm_context,
|
wasm_context,
|
||||||
standard_properties,
|
standard_properties,
|
||||||
{
|
{
|
||||||
|
let category = original.category.clone();
|
||||||
|
let path = original.path.clone();
|
||||||
|
|
||||||
let additional_properties: Vec<(String, &str)> = original
|
let additional_properties: Vec<(String, &str)> = original
|
||||||
.get_additional_properties()
|
.get_additional_properties()
|
||||||
.map(|node_property| {
|
.map(|node_property| {
|
||||||
@ -47,20 +54,13 @@ to_wasm!(
|
|||||||
.map(Into::<WasmAstNode<'_>>::into)
|
.map(Into::<WasmAstNode<'_>>::into)
|
||||||
}))
|
}))
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
.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 {
|
Ok(WasmDocument {
|
||||||
standard_properties,
|
standard_properties,
|
||||||
additional_properties,
|
additional_properties,
|
||||||
children,
|
children,
|
||||||
|
category,
|
||||||
|
path,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user