Added all non-obsolete, non-experimental attribs from MDN
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user