diff options
Diffstat (limited to 'html')
-rw-r--r-- | html/html.go | 6 | ||||
-rw-r--r-- | html/html_test.go | 6 |
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) } |