diff options
Diffstat (limited to 'html')
-rw-r--r-- | html/html.go | 2 | ||||
-rw-r--r-- | html/html_test.go | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/html/html.go b/html/html.go index 5ceb5e9..adee935 100644 --- a/html/html.go +++ b/html/html.go @@ -21,7 +21,7 @@ var ( element = Any(text, &tag) elements = Kleene(element) //attr := And(identifier, equal, String()) - attr = And(identifier, WS, "=", WS, `"test"`) + attr = And(WS, identifier, WS, "=", WS, Any(String('"'), String('\''))) attrs = Map(Kleene(attr, WS), func(node Node) Node { nodes := node.([]Node) attr := map[string]string{} diff --git a/html/html_test.go b/html/html_test.go index 6dca6d4..defdc10 100644 --- a/html/html_test.go +++ b/html/html_test.go @@ -8,10 +8,10 @@ import ( ) func TestParse(t *testing.T) { - result, _, err := Parse("<body>hello <b>world</b></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: []Node{ "hello ", - Tag{Name: "b", Attributes: map[string]string{}, Body: []Node{"world"}}, + Tag{Name: "p", Attributes: map[string]string{"color": "blue"}, Body: []Node{"world"}}, }}, result) } |