diff options
Diffstat (limited to 'html/html.go')
-rw-r--r-- | html/html.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/html/html.go b/html/html.go index 4d02cb0..dab239e 100644 --- a/html/html.go +++ b/html/html.go @@ -18,28 +18,28 @@ var ( tag Parser identifier = NoAutoWS(Merge(And(WS(), Chars("a-zA-Z", 1), Chars("a-zA-Z0-9", 0)))) - text = Map(NotChars("<>"), func(n *Node) *Node { - return &Node{Result: n.Token} + text = Map(NotChars("<>"), func(n Node) Node { + return Node{Result: n.Token} }) element = Any(text, &tag) - elements = Map(Kleene(element), func(n *Node) *Node { + elements = Map(Kleene(element), func(n Node) Node { ret := []interface{}{} for _, child := range n.Children { ret = append(ret, child.Result) } - return &Node{Result: ret} + return Node{Result: ret} }) attr = And(identifier, "=", Any(String('"'), String('\''))) - attrs = Map(Kleene(attr), func(node *Node) *Node { + attrs = Map(Kleene(attr), func(node Node) Node { attr := map[string]string{} for _, attrNode := range node.Children { attr[attrNode.Children[0].Token] = attrNode.Children[2].Token } - return &Node{Result: attr} + return Node{Result: attr} }) tstart = And("<", identifier, attrs, ">") @@ -47,9 +47,9 @@ var ( ) func init() { - tag = Map(And(tstart, elements, tend), func(node *Node) *Node { + tag = Map(And(tstart, elements, tend), func(node Node) Node { openTag := node.Children[0] - return &Node{Result: Tag{ + return Node{Result: Tag{ Name: openTag.Children[1].Token, Attributes: openTag.Children[2].Result.(map[string]string), Body: node.Children[1].Result.([]interface{}), |