wild-doc
Example
```rust
use wild_doc::*;
let dir="./wd-test/";
if std::path::Path::new(dir).exists(){
std::fs::removedirall(dir).unwrap();
}
std::fs::createdirall(dir).unwrap();
let mut wd=WildDoc::new(
dir
,IncludeLocal::new("./include/")
).unwrap();
//update data.
/wd.run(r#"
Noah
US
Liam
US
Olivia
UK
"#,b"").unwrap();/
let updatexml=r#"
"#;
wd.run(updatexml,r#"{
"name":"Noah"
,"from":"US"
}"#).unwrap();
wd.run(updatexml,r#"{
"name":"Liam"
,"from":"US"
}"#).unwrap();
wd.run(updatexml,r#"{
"name":"Olivia"
,"from":"UK"
}"#).unwrap();
//select data.
let r=wd.run(r#"
find persons.
"#,"").unwrap();
println!("{}",std::str::from_utf8(r.body()).unwrap());
//seaech data
let r=wd.run(r#"
find persons from the US.
"#,"").unwrap();
println!("{}",std::str::from_utf8(r.body()).unwrap());
//use javascript
let r=wd.run(r#"
const ymd=function(){
const now=new Date();
return now.getFullYear()+"-"+(now.getMonth()+1)+"-"+now.getDate();
};
wd.general.uk="UK";
wd.general.ymd=function(){
const now=new Date();
return now.getFullYear()+"-"+(now.getMonth()+1)+"-"+now.getDate();
};
wd.resultoptions['test']="OK";
find persons from the .
"#,"").unwrap();
println!("{} : {}",std::str::fromutf8(r.body()).unwrap(),r.options_json());
//search in update section.
wd.run(r#"
hoge:
Renamed
"#,"").unwrap();
let r=wd.run(r#"
find persons.
"#,"").unwrap();
println!("{}",std::str::from_utf8(r.body()).unwrap());
//use WebAPI
let r=wd.run(r#"
wd.general.a="OK";
wd.stack.push({
hoge:{
hoge:"A"
}
,a:1
});
console.log(crypto.randomUUID());
wd.resultoptions.test="TEST";
wd.resultoptions.test2=crypto.randomUUID();
a:
v:
input:
wd.stack.pop();
wd.general.a="OK2";
a:
v:
"#,r#"{
"name":"Ken"
,"from":"US"
}"#).unwrap();
println!("{} : {}",std::str::fromutf8(r.body()).unwrap(),r.optionsjson());
```
Include file
layout.xml
xml
<html>
<head>
<title>HTML include test</title>
</head>
<body>
<wd:include wd:src="wd.v('body_path')" />
</body>
</html>
body.xml
xml
BODY
rust
rust
let r=wd.exec(r#"<wd><wd:stack var="body_path:'body.xml'">
<wd:include src="layout.xml" />
<wd:stack></wd>"#);
println!("{}",r);
output
html
<html>
<head>
<title>HTML include test</title>
</head>
<body>
BODY
</body>
</html>