Use io.ByteWriter

This commit is contained in:
Cameron Moore 2019-11-29 13:42:55 -06:00
parent ff066ede82
commit 74e1374f5a
2 changed files with 3 additions and 2 deletions

View file

@ -2,6 +2,7 @@ package parser
import (
"bytes"
"io"
"strconv"
"github.com/yuin/goldmark/text"
@ -227,7 +228,7 @@ func parseAttributeString(reader text.Reader) ([]byte, bool) {
return nil, false
}
func scanAttributeDecimal(reader text.Reader, w *bytes.Buffer) {
func scanAttributeDecimal(reader text.Reader, w io.ByteWriter) {
for {
c := reader.Peek()
if util.IsNumeric(c) {

View file

@ -134,7 +134,7 @@ func (b *htmlBlockParser) Open(parent ast.Node, reader text.Reader, pc Context)
isCloseTag := match[2] > -1 && bytes.Equal(line[match[2]:match[3]], []byte("/"))
hasAttr := match[6] != match[7]
tagName = strings.ToLower(string(line[match[4]:match[5]]))
_, ok := allowedBlockTags[strings.ToLower(string(tagName))]
_, ok := allowedBlockTags[tagName]
if ok {
node = ast.NewHTMLBlock(ast.HTMLBlockType6)
} else if tagName != "script" && tagName != "style" && tagName != "pre" && !ast.IsParagraph(last) && !(isCloseTag && hasAttr) { // type 7 can not interrupt paragraph