2019-03-24 19:28:36 +00:00
|
|
|
# codegen
|
|
|
|
|
2019-03-24 21:42:48 +00:00
|
|
|
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
|
|
|
|
|
|
|
```
|
2019-03-24 21:42:48 +00:00
|
|
|
{
|
|
|
|
"elements": [
|
|
|
|
{"name": "div"},
|
2019-03-29 02:22:31 +00:00
|
|
|
{"name": "img", "void": true},
|
2019-03-24 21:42:48 +00:00
|
|
|
],
|
|
|
|
"attributes": [
|
|
|
|
{"name": "src", "type": "string"},
|
|
|
|
{"name": "disabled", "type": "bool"}
|
|
|
|
]
|
|
|
|
}
|
2019-03-24 19:28:36 +00:00
|
|
|
```
|
2019-03-24 21:42:48 +00:00
|
|
|
|
2019-03-29 02:22:31 +00:00
|
|
|
The `"void"` key can be omitted from an element definition and defaults to
|
2019-03-24 21:42:48 +00:00
|
|
|
`false`.
|