[READ-ONLY] Mirror of https://github.com/andrioid/humle. Write HTML with Go functions
0

Configure Feed

Select the types of activity you want to include in your feed.

humle / argument.go
730 B 39 lines
1package humle 2 3type ArgumentType int 4 5const ( 6 ArgumentAttribute = iota 7 ArgumentProp 8 ArgumentText 9) 10 11// Arguments are either props or attributes and are used by components 12type Argument interface { 13 ArgumentType() ArgumentType 14} 15 16type Arguments []Argument 17 18func (args Arguments) GetAttributes() Attributes { 19 attributes := Attributes{} 20 for _, arg := range args { 21 switch t := arg.(type) { 22 case attribute: 23 attributes[t.name] = t 24 } 25 } 26 return attributes 27} 28 29// Special cases, like Text() which can be more ergonomic as an argument than child 30func (args Arguments) GetNodes() []Node { 31 nodes := []Node{} 32 for _, arg := range args { 33 switch t := arg.(type) { 34 case Node: 35 nodes = append(nodes, t) 36 } 37 } 38 return nodes 39}