mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
Use io.ByteWriter
This commit is contained in:
parent
ff066ede82
commit
74e1374f5a
2 changed files with 3 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ package parser
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"io"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/yuin/goldmark/text"
|
"github.com/yuin/goldmark/text"
|
||||||
|
|
@ -227,7 +228,7 @@ func parseAttributeString(reader text.Reader) ([]byte, bool) {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func scanAttributeDecimal(reader text.Reader, w *bytes.Buffer) {
|
func scanAttributeDecimal(reader text.Reader, w io.ByteWriter) {
|
||||||
for {
|
for {
|
||||||
c := reader.Peek()
|
c := reader.Peek()
|
||||||
if util.IsNumeric(c) {
|
if util.IsNumeric(c) {
|
||||||
|
|
|
||||||
|
|
@ -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("/"))
|
isCloseTag := match[2] > -1 && bytes.Equal(line[match[2]:match[3]], []byte("/"))
|
||||||
hasAttr := match[6] != match[7]
|
hasAttr := match[6] != match[7]
|
||||||
tagName = strings.ToLower(string(line[match[4]:match[5]]))
|
tagName = strings.ToLower(string(line[match[4]:match[5]]))
|
||||||
_, ok := allowedBlockTags[strings.ToLower(string(tagName))]
|
_, ok := allowedBlockTags[tagName]
|
||||||
if ok {
|
if ok {
|
||||||
node = ast.NewHTMLBlock(ast.HTMLBlockType6)
|
node = ast.NewHTMLBlock(ast.HTMLBlockType6)
|
||||||
} else if tagName != "script" && tagName != "style" && tagName != "pre" && !ast.IsParagraph(last) && !(isCloseTag && hasAttr) { // type 7 can not interrupt paragraph
|
} else if tagName != "script" && tagName != "style" && tagName != "pre" && !ast.IsParagraph(last) && !(isCloseTag && hasAttr) { // type 7 can not interrupt paragraph
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue