Renamed Empty to Void in codegen
This commit is contained in:
parent
4ebae3c948
commit
62026132a8
@ -9,7 +9,7 @@
|
||||
{"name": "div"},
|
||||
{"name": "head"},
|
||||
{"name": "html"},
|
||||
{"name": "img", "empty": true},
|
||||
{"name": "img", "void": true},
|
||||
{"name": "li"},
|
||||
{"name": "span"},
|
||||
{"name": "title"},
|
||||
|
@ -4,13 +4,13 @@ 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
|
||||
options for attribute types and element emptiness:
|
||||
options for attribute types and element voidnesss:
|
||||
|
||||
```
|
||||
{
|
||||
"elements": [
|
||||
{"name": "div"},
|
||||
{"name": "img", "empty": true},
|
||||
{"name": "img", "void": true},
|
||||
],
|
||||
"attributes": [
|
||||
{"name": "src", "type": "string"},
|
||||
@ -19,5 +19,5 @@ options for attribute types and element emptiness:
|
||||
}
|
||||
```
|
||||
|
||||
The `"empty"` key can be omitted from an element definition and defaults to
|
||||
The `"void"` key can be omitted from an element definition and defaults to
|
||||
`false`.
|
||||
|
@ -99,7 +99,7 @@ func (def AttribDef) Generate(qualified bool) string {
|
||||
|
||||
type ElemDef struct {
|
||||
Name string `json:"name"`
|
||||
Empty bool `json:"empty"`
|
||||
Void bool `json:"void"`
|
||||
}
|
||||
|
||||
func (def ElemDef) Generate(qualified bool) string {
|
||||
@ -132,7 +132,7 @@ func (def ElemDef) Generate(qualified bool) string {
|
||||
pkg = "hatmill."
|
||||
}
|
||||
template := parentTemplate
|
||||
if def.Empty {
|
||||
if def.Void {
|
||||
template = voidTemplate
|
||||
}
|
||||
return fmt.Sprintf(template, strings.Title(def.Name), def.Name, pkg)
|
||||
|
Loading…
Reference in New Issue
Block a user