summaryrefslogtreecommitdiff
path: root/html
diff options
context:
space:
mode:
authorAdam Scarr <adam@vektah.net>2017-08-13 12:56:46 +1000
committerAdam Scarr <adam@vektah.net>2017-08-13 13:00:22 +1000
commit77930f8f066b058c7e6cbae015523370ca3dab7e (patch)
treefd0e4e3663f1183633fb16be297a20764a38d37c /html
parentf5b81e8e2eebd06e79159eaa3e721ac59ba3cc8c (diff)
Add map shorthand
Diffstat (limited to 'html')
-rw-r--r--html/html.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/html/html.go b/html/html.go
index 5fe9480..33e5cc4 100644
--- a/html/html.go
+++ b/html/html.go
@@ -18,12 +18,12 @@ var (
tag Parser
identifier = Regex("[a-zA-Z][a-zA-Z0-9]*")
- text = Map(NotChars("<>"), func(n Result) Result {
+ text = NotChars("<>").Map(func(n Result) Result {
return Result{Result: n.Token}
})
element = Any(text, &tag)
- elements = Map(Some(element), func(n Result) Result {
+ elements = Some(element).Map(func(n Result) Result {
ret := []interface{}{}
for _, child := range n.Child {
ret = append(ret, child.Result)
@@ -32,7 +32,7 @@ var (
})
attr = Seq(identifier, "=", StringLit(`"'`))
- attrs = Map(Some(attr), func(node Result) Result {
+ attrs = Some(attr).Map(func(node Result) Result {
attr := map[string]string{}
for _, attrNode := range node.Child {
@@ -47,7 +47,7 @@ var (
)
func init() {
- tag = Map(Seq(tstart, Cut(), elements, tend), func(node Result) Result {
+ tag = Seq(tstart, Cut(), elements, tend).Map(func(node Result) Result {
openTag := node.Child[0]
return Result{Result: htmlTag{
Name: openTag.Child[1].Token,