Added all non-obsolete, non-experimental attribs from MDN

This commit is contained in:
2019-04-08 21:52:26 -06:00
parent e43b8aa6ee
commit f637b196fe
6 changed files with 975 additions and 6 deletions

View File

@ -19,6 +19,14 @@ package %s
import "gitlab.codemonkeysoftware.net/b/hatmill"
`
func identifier(s string) string {
words := strings.Split(s, "-")
for i, word := range words {
words[i] = strings.Title(word)
}
return strings.Join(words, "")
}
func fileHeader(packageName string) string {
return fmt.Sprintf(headerFmt, packageName)
}
@ -88,7 +96,7 @@ func (def AttribDef) Generate() string {
panic(fmt.Errorf("unknown attribute type: %v", def.Type))
}
return fmt.Sprintf(template, strings.Title(def.Name), def.Name)
return fmt.Sprintf(template, identifier(def.Name), def.Name)
}
type ElemDef struct {
@ -125,7 +133,7 @@ func (def ElemDef) Generate() string {
if def.Void {
template = voidTemplate
}
return fmt.Sprintf(template, strings.Title(def.Name), def.Name)
return fmt.Sprintf(template, identifier(def.Name), def.Name)
}
type Defs struct {