Skip to content

Commit

Permalink
Update readme examples
Browse files Browse the repository at this point in the history
  • Loading branch information
djmattyg007 committed Oct 16, 2021
1 parent 76f8335 commit b136a9f
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ A Python library for the [KDL Document Language](https://github.com/kdl-org/kdl)

## Install

pip install cuddle
```shell
pip install cuddle
```

Cuddle supports Python 3.9 and above.

Expand Down Expand Up @@ -47,17 +49,21 @@ print(dumps(loaded_doc))
print()

# Creating documents from scratch is a bit verbose
doc = Document(NodeList([]))
nodes = []
child_node = Node("complex name here!", [], {}, NodeList([]))
child_node = Node("complex name here!", None)
nodes.append(
Node("simple-name", None, arguments=[123], children=[child_node])
)
nodes.append(
Node("simple-name", [123], {}, NodeList([child_node]))
Node("second-node", None, properties={"key": "value"})
)
node_list = NodeList(nodes)
doc = Document(node_list)
print(dumps(doc))
```

The output:

```
title "Some title"
smile "😁"
Expand All @@ -69,10 +75,9 @@ foo bar=true quux=false "baz" 1 2 3
simple-name 123 {
"complex name here!"
}
second-node key="value"
```

## License

The code is available under the [MIT license](LICENSE). The example above is
made available from https://github.com/kdl-org/kdl under
[Creative Commons Attribution-ShareAlike 4.0 International](https://github.com/kdl-org/kdl/blob/main/LICENSE.md).
The code is available under the [MIT license](LICENSE.txt).

0 comments on commit b136a9f

Please sign in to comment.