hatmill/internal/codegen
Brandon Dyck cbf7aa6a9d Move module to git.codemonkeysoftware.net 2023-12-20 15:35:09 -07:00
..
README.md Renamed Empty to Void in codegen 2019-03-28 20:23:35 -06:00
codegen.go Move module to git.codemonkeysoftware.net 2023-12-20 15:35:09 -07:00

README.md

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 options for attribute types and element voidnesss:

{
  "elements": [
    {"name": "div"},
    {"name": "img", "void": true},
  ],
  "attributes": [
    {"name": "src", "type": "string"},
    {"name": "disabled", "type": "bool"}
  ]
}

The "void" key can be omitted from an element definition and defaults to false.