hatmill/internal/codegen/README.md

24 lines
528 B
Markdown
Raw Permalink Normal View History

2019-03-24 19:28:36 +00:00
# codegen
codegen reads JSON descriptions of HTML elements and attributes, and generates
Go functions to create them.
The input file consists of a JSON object like the following, which includes all
2019-03-29 02:22:31 +00:00
options for attribute types and element voidnesss:
2019-03-24 19:28:36 +00:00
```
{
"elements": [
{"name": "div"},
2019-03-29 02:22:31 +00:00
{"name": "img", "void": true},
],
"attributes": [
{"name": "src", "type": "string"},
{"name": "disabled", "type": "bool"}
]
}
2019-03-24 19:28:36 +00:00
```
2019-03-29 02:22:31 +00:00
The `"void"` key can be omitted from an element definition and defaults to
`false`.