Update dependencies and fix whatsmeow API changes (#1887)
* Update dependencies * Fix whatsmau API changes
This commit is contained in:
48
vendor/github.com/gomarkdown/markdown/parser/inline.go
generated
vendored
48
vendor/github.com/gomarkdown/markdown/parser/inline.go
generated
vendored
@@ -6,7 +6,6 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/gomarkdown/markdown/ast"
|
||||
"github.com/gomarkdown/markdown/internal/valid"
|
||||
)
|
||||
|
||||
// Parsing of inline elements
|
||||
@@ -69,7 +68,7 @@ func emphasis(p *Parser, data []byte, offset int) (int, ast.Node) {
|
||||
if n > 2 && data[1] != c {
|
||||
// whitespace cannot follow an opening emphasis;
|
||||
// strikethrough only takes two characters '~~'
|
||||
if isSpace(data[1]) {
|
||||
if IsSpace(data[1]) {
|
||||
return 0, nil
|
||||
}
|
||||
if p.extensions&SuperSubscript != 0 && c == '~' {
|
||||
@@ -81,7 +80,7 @@ func emphasis(p *Parser, data []byte, offset int) (int, ast.Node) {
|
||||
}
|
||||
ret++ // we started with data[1:] above.
|
||||
for i := 1; i < ret; i++ {
|
||||
if isSpace(data[i]) && !isEscape(data, i) {
|
||||
if IsSpace(data[i]) && !isEscape(data, i) {
|
||||
return 0, nil
|
||||
}
|
||||
}
|
||||
@@ -98,7 +97,7 @@ func emphasis(p *Parser, data []byte, offset int) (int, ast.Node) {
|
||||
}
|
||||
|
||||
if n > 3 && data[1] == c && data[2] != c {
|
||||
if isSpace(data[2]) {
|
||||
if IsSpace(data[2]) {
|
||||
return 0, nil
|
||||
}
|
||||
ret, node := helperDoubleEmphasis(p, data[2:], c)
|
||||
@@ -110,7 +109,7 @@ func emphasis(p *Parser, data []byte, offset int) (int, ast.Node) {
|
||||
}
|
||||
|
||||
if n > 4 && data[1] == c && data[2] == c && data[3] != c {
|
||||
if c == '~' || isSpace(data[3]) {
|
||||
if c == '~' || IsSpace(data[3]) {
|
||||
return 0, nil
|
||||
}
|
||||
ret, node := helperTripleEmphasis(p, data, 3, c)
|
||||
@@ -156,7 +155,7 @@ func codeSpan(p *Parser, data []byte, offset int) (int, ast.Node) {
|
||||
if data[j] == '\n' {
|
||||
break
|
||||
}
|
||||
if !isSpace(data[j]) {
|
||||
if !IsSpace(data[j]) {
|
||||
hasCharsAfterDelimiter = true
|
||||
}
|
||||
}
|
||||
@@ -256,7 +255,7 @@ func maybeInlineFootnoteOrSuper(p *Parser, data []byte, offset int) (int, ast.No
|
||||
return 0, nil
|
||||
}
|
||||
for i := offset; i < offset+ret; i++ {
|
||||
if isSpace(data[i]) && !isEscape(data, i) {
|
||||
if IsSpace(data[i]) && !isEscape(data, i) {
|
||||
return 0, nil
|
||||
}
|
||||
}
|
||||
@@ -421,7 +420,7 @@ func link(p *Parser, data []byte, offset int) (int, ast.Node) {
|
||||
|
||||
// skip whitespace after title
|
||||
titleE = i - 1
|
||||
for titleE > titleB && isSpace(data[titleE]) {
|
||||
for titleE > titleB && IsSpace(data[titleE]) {
|
||||
titleE--
|
||||
}
|
||||
|
||||
@@ -433,7 +432,7 @@ func link(p *Parser, data []byte, offset int) (int, ast.Node) {
|
||||
}
|
||||
|
||||
// remove whitespace at the end of the link
|
||||
for linkE > linkB && isSpace(data[linkE-1]) {
|
||||
for linkE > linkB && IsSpace(data[linkE-1]) {
|
||||
linkE--
|
||||
}
|
||||
|
||||
@@ -602,9 +601,8 @@ func link(p *Parser, data []byte, offset int) (int, ast.Node) {
|
||||
}
|
||||
|
||||
// links need something to click on and somewhere to go
|
||||
if len(uLink) == 0 || (t == linkNormal && txtE <= 1) {
|
||||
return 0, nil
|
||||
}
|
||||
// [](http://bla) is legal in CommonMark, so allow txtE <=1 for linkNormal
|
||||
// [bla]() is also legal in CommonMark, so allow empty uLink
|
||||
}
|
||||
|
||||
// call the relevant rendering function
|
||||
@@ -827,7 +825,9 @@ func linkEndsWithEntity(data []byte, linkEnd int) bool {
|
||||
}
|
||||
|
||||
// hasPrefixCaseInsensitive is a custom implementation of
|
||||
// strings.HasPrefix(strings.ToLower(s), prefix)
|
||||
//
|
||||
// strings.HasPrefix(strings.ToLower(s), prefix)
|
||||
//
|
||||
// we rolled our own because ToLower pulls in a huge machinery of lowercasing
|
||||
// anything from Unicode and that's very slow. Since this func will only be
|
||||
// used on ASCII protocol prefixes, we can take shortcuts.
|
||||
@@ -889,7 +889,7 @@ func autoLink(p *Parser, data []byte, offset int) (int, ast.Node) {
|
||||
|
||||
// scan backward for a word boundary
|
||||
rewind := 0
|
||||
for offset-rewind > 0 && rewind <= 7 && isLetter(data[offset-rewind-1]) {
|
||||
for offset-rewind > 0 && rewind <= 7 && IsLetter(data[offset-rewind-1]) {
|
||||
rewind++
|
||||
}
|
||||
if rewind > 6 { // longest supported protocol is "mailto" which has 6 letters
|
||||
@@ -901,7 +901,7 @@ func autoLink(p *Parser, data []byte, offset int) (int, ast.Node) {
|
||||
|
||||
isSafeURL := p.IsSafeURLOverride
|
||||
if isSafeURL == nil {
|
||||
isSafeURL = valid.IsSafeURL
|
||||
isSafeURL = IsSafeURL
|
||||
}
|
||||
if !isSafeURL(data) {
|
||||
return 0, nil
|
||||
@@ -996,7 +996,7 @@ func autoLink(p *Parser, data []byte, offset int) (int, ast.Node) {
|
||||
}
|
||||
|
||||
func isEndOfLink(char byte) bool {
|
||||
return isSpace(char) || char == '<'
|
||||
return IsSpace(char) || char == '<'
|
||||
}
|
||||
|
||||
// return the length of the given tag, or 0 is it's not valid
|
||||
@@ -1018,7 +1018,7 @@ func tagLength(data []byte) (autolink autolinkType, end int) {
|
||||
i = 1
|
||||
}
|
||||
|
||||
if !isAlnum(data[i]) {
|
||||
if !IsAlnum(data[i]) {
|
||||
return notAutolink, 0
|
||||
}
|
||||
|
||||
@@ -1026,7 +1026,7 @@ func tagLength(data []byte) (autolink autolinkType, end int) {
|
||||
autolink = notAutolink
|
||||
|
||||
// try to find the beginning of an URI
|
||||
for i < len(data) && (isAlnum(data[i]) || data[i] == '.' || data[i] == '+' || data[i] == '-') {
|
||||
for i < len(data) && (IsAlnum(data[i]) || data[i] == '.' || data[i] == '+' || data[i] == '-') {
|
||||
i++
|
||||
}
|
||||
|
||||
@@ -1051,7 +1051,7 @@ func tagLength(data []byte) (autolink autolinkType, end int) {
|
||||
for i < len(data) {
|
||||
if data[i] == '\\' {
|
||||
i += 2
|
||||
} else if data[i] == '>' || data[i] == '\'' || data[i] == '"' || isSpace(data[i]) {
|
||||
} else if data[i] == '>' || data[i] == '\'' || data[i] == '"' || IsSpace(data[i]) {
|
||||
break
|
||||
} else {
|
||||
i++
|
||||
@@ -1083,7 +1083,7 @@ func isMailtoAutoLink(data []byte) int {
|
||||
|
||||
// address is assumed to be: [-@._a-zA-Z0-9]+ with exactly one '@'
|
||||
for i, c := range data {
|
||||
if isAlnum(c) {
|
||||
if IsAlnum(c) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -1204,10 +1204,10 @@ func helperEmphasis(p *Parser, data []byte, c byte) (int, ast.Node) {
|
||||
continue
|
||||
}
|
||||
|
||||
if data[i] == c && !isSpace(data[i-1]) {
|
||||
if data[i] == c && !IsSpace(data[i-1]) {
|
||||
|
||||
if p.extensions&NoIntraEmphasis != 0 {
|
||||
if !(i+1 == len(data) || isSpace(data[i+1]) || isPunctuation(data[i+1])) {
|
||||
if !(i+1 == len(data) || IsSpace(data[i+1]) || IsPunctuation(data[i+1])) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
@@ -1231,7 +1231,7 @@ func helperDoubleEmphasis(p *Parser, data []byte, c byte) (int, ast.Node) {
|
||||
}
|
||||
i += length
|
||||
|
||||
if i+1 < len(data) && data[i] == c && data[i+1] == c && i > 0 && !isSpace(data[i-1]) {
|
||||
if i+1 < len(data) && data[i] == c && data[i+1] == c && i > 0 && !IsSpace(data[i-1]) {
|
||||
var node ast.Node = &ast.Strong{}
|
||||
if c == '~' {
|
||||
node = &ast.Del{}
|
||||
@@ -1257,7 +1257,7 @@ func helperTripleEmphasis(p *Parser, data []byte, offset int, c byte) (int, ast.
|
||||
i += length
|
||||
|
||||
// skip whitespace preceded symbols
|
||||
if data[i] != c || isSpace(data[i-1]) {
|
||||
if data[i] != c || IsSpace(data[i-1]) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user