From 62026132a83b50b3ccf746cd831ef91f535670ed Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Thu, 28 Mar 2019 20:22:31 -0600 Subject: [PATCH] Renamed Empty to Void in codegen --- html5/defs.json | 2 +- internal/codegen/README.md | 6 +++--- internal/codegen/codegen.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/html5/defs.json b/html5/defs.json index d858664..71c624f 100644 --- a/html5/defs.json +++ b/html5/defs.json @@ -9,7 +9,7 @@ {"name": "div"}, {"name": "head"}, {"name": "html"}, - {"name": "img", "empty": true}, + {"name": "img", "void": true}, {"name": "li"}, {"name": "span"}, {"name": "title"}, diff --git a/internal/codegen/README.md b/internal/codegen/README.md index c681b2e..27a3571 100644 --- a/internal/codegen/README.md +++ b/internal/codegen/README.md @@ -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`. diff --git a/internal/codegen/codegen.go b/internal/codegen/codegen.go index e30d7cb..063adb6 100644 --- a/internal/codegen/codegen.go +++ b/internal/codegen/codegen.go @@ -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)