mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-22 18:19:54 -04:00
26 lines
619 B
Plaintext
26 lines
619 B
Plaintext
|
let make_element = macro(name, attrs, children) => {
|
||
|
name = name,
|
||
|
attrs = attrs,
|
||
|
children = children,
|
||
|
};
|
||
|
|
||
|
let doc = {
|
||
|
root = make_element(
|
||
|
"top",
|
||
|
{id = "foo"},
|
||
|
[
|
||
|
make_element(
|
||
|
"child1",
|
||
|
{ attr1 = "value1", attr2 = "value2"},
|
||
|
[
|
||
|
"inner text content",
|
||
|
make_element(
|
||
|
"grandchild",
|
||
|
{},
|
||
|
[{
|
||
|
text = "Another text node",
|
||
|
}]),
|
||
|
])]),
|
||
|
};
|
||
|
|
||
|
out xml doc;
|