mirror of
https://github.com/TxtDot/dalet.git
synced 2024-12-25 20:23:44 +03:00
doc: update daletl data format
This commit is contained in:
parent
b9beffa965
commit
dfa42ae830
1 changed files with 42 additions and 6 deletions
|
@ -4,8 +4,6 @@
|
|||
|
||||
Daletl must be serialized as [MessagePack](https://github.com/msgpack/msgpack/blob/master/spec.md). All data transfer between server and client is done in this format.
|
||||
|
||||
## Data representation
|
||||
|
||||
### Root
|
||||
|
||||
Daletl root is array of tags. For convenience, we will use the json5 representation of the data.
|
||||
|
@ -18,7 +16,11 @@ Daletl root is array of tags. For convenience, we will use the json5 representat
|
|||
|
||||
All tags specification is in [Tags](./tags.md).
|
||||
|
||||
Each tag is array of 1-3 elements.
|
||||
Each tag may be one of three types:
|
||||
|
||||
#### Data Representation
|
||||
|
||||
##### As array of 1-3 elements
|
||||
|
||||
1. Tag id
|
||||
2. Tag body (optional if argument not specified, if argument specified it must be null)
|
||||
|
@ -26,17 +28,17 @@ Each tag is array of 1-3 elements.
|
|||
|
||||
Tag id is integer number.
|
||||
|
||||
Body can be only a string, null, or an array of tags.
|
||||
Body can be only a string, null, array of tags or tag (equals to array of tags with 1 tag).
|
||||
|
||||
Argument can be number or string.
|
||||
|
||||
#### Heading example
|
||||
###### Heading example
|
||||
|
||||
```json5
|
||||
[1, "This is heading", 1]
|
||||
```
|
||||
|
||||
#### Unordered list example
|
||||
###### Unordered list example
|
||||
|
||||
```json5
|
||||
[
|
||||
|
@ -47,3 +49,37 @@ Argument can be number or string.
|
|||
],
|
||||
]
|
||||
```
|
||||
|
||||
##### As string
|
||||
|
||||
String becomes element tag.
|
||||
|
||||
```json5
|
||||
"Element"
|
||||
```
|
||||
|
||||
equals to
|
||||
|
||||
```json5
|
||||
[0, "Element"]
|
||||
```
|
||||
|
||||
##### As array of tags
|
||||
|
||||
If array not started with a number. The implication is that this turns into an “element” tag
|
||||
|
||||
```json5
|
||||
["Element", [1, "Heading"]]
|
||||
```
|
||||
|
||||
equals to
|
||||
|
||||
```json5
|
||||
[
|
||||
0,
|
||||
[
|
||||
[0, "Element"],
|
||||
[1, "Heading"],
|
||||
],
|
||||
]
|
||||
```
|
||||
|
|
Loading…
Add table
Reference in a new issue