summaryrefslogtreecommitdiff
path: root/html
diff options
context:
space:
mode:
authorAdam Scarr <adam@vektah.net>2017-08-11 00:08:08 +1000
committerAdam Scarr <adam@vektah.net>2017-08-11 00:08:08 +1000
commit60dd11deeec8254da45f9f5b7d24dedef27c4f53 (patch)
tree4c60a98e94d7b89204fa698496b75dcbf71cd42d /html
parentb2713a0653eca81d1428112dd8b29b3fd4c53089 (diff)
Add go report card
Diffstat (limited to 'html')
-rw-r--r--html/html.go6
-rw-r--r--html/html_test.go6
2 files changed, 6 insertions, 6 deletions
diff --git a/html/html.go b/html/html.go
index 4e2197d..5fe9480 100644
--- a/html/html.go
+++ b/html/html.go
@@ -4,11 +4,11 @@ import (
. "github.com/vektah/goparsify"
)
-func Parse(input string) (result interface{}, err error) {
+func parse(input string) (result interface{}, err error) {
return Run(tag, input)
}
-type Tag struct {
+type htmlTag struct {
Name string
Attributes map[string]string
Body []interface{}
@@ -49,7 +49,7 @@ var (
func init() {
tag = Map(Seq(tstart, Cut(), elements, tend), func(node Result) Result {
openTag := node.Child[0]
- return Result{Result: Tag{
+ return Result{Result: htmlTag{
Name: openTag.Child[1].Token,
Attributes: openTag.Child[3].Result.(map[string]string),
Body: node.Child[2].Result.([]interface{}),
diff --git a/html/html_test.go b/html/html_test.go
index f614b4d..7649fdd 100644
--- a/html/html_test.go
+++ b/html/html_test.go
@@ -7,10 +7,10 @@ import (
)
func TestParse(t *testing.T) {
- result, err := Parse(`<body>hello <p color="blue">world</p></body>`)
+ result, err := parse(`<body>hello <p color="blue">world</p></body>`)
require.NoError(t, err)
- require.Equal(t, Tag{Name: "body", Attributes: map[string]string{}, Body: []interface{}{
+ require.Equal(t, htmlTag{Name: "body", Attributes: map[string]string{}, Body: []interface{}{
"hello ",
- Tag{Name: "p", Attributes: map[string]string{"color": "blue"}, Body: []interface{}{"world"}},
+ htmlTag{Name: "p", Attributes: map[string]string{"color": "blue"}, Body: []interface{}{"world"}},
}}, result)
}