mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-07-11 21:16:27 +00:00
Update dependencies (#1841)
This commit is contained in:
1
vendor/github.com/gomarkdown/markdown/fuzz.go
generated
vendored
1
vendor/github.com/gomarkdown/markdown/fuzz.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build gofuzz
|
||||
// +build gofuzz
|
||||
|
||||
package markdown
|
||||
|
90
vendor/github.com/gomarkdown/markdown/html/renderer.go
generated
vendored
90
vendor/github.com/gomarkdown/markdown/html/renderer.go
generated
vendored
@ -11,6 +11,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/gomarkdown/markdown/ast"
|
||||
"github.com/gomarkdown/markdown/internal/valid"
|
||||
"github.com/gomarkdown/markdown/parser"
|
||||
)
|
||||
|
||||
@ -211,70 +212,6 @@ func NewRenderer(opts RendererOptions) *Renderer {
|
||||
}
|
||||
}
|
||||
|
||||
func isHTMLTag(tag []byte, tagname string) bool {
|
||||
found, _ := findHTMLTagPos(tag, tagname)
|
||||
return found
|
||||
}
|
||||
|
||||
// Look for a character, but ignore it when it's in any kind of quotes, it
|
||||
// might be JavaScript
|
||||
func skipUntilCharIgnoreQuotes(html []byte, start int, char byte) int {
|
||||
inSingleQuote := false
|
||||
inDoubleQuote := false
|
||||
inGraveQuote := false
|
||||
i := start
|
||||
for i < len(html) {
|
||||
switch {
|
||||
case html[i] == char && !inSingleQuote && !inDoubleQuote && !inGraveQuote:
|
||||
return i
|
||||
case html[i] == '\'':
|
||||
inSingleQuote = !inSingleQuote
|
||||
case html[i] == '"':
|
||||
inDoubleQuote = !inDoubleQuote
|
||||
case html[i] == '`':
|
||||
inGraveQuote = !inGraveQuote
|
||||
}
|
||||
i++
|
||||
}
|
||||
return start
|
||||
}
|
||||
|
||||
func findHTMLTagPos(tag []byte, tagname string) (bool, int) {
|
||||
i := 0
|
||||
if i < len(tag) && tag[0] != '<' {
|
||||
return false, -1
|
||||
}
|
||||
i++
|
||||
i = skipSpace(tag, i)
|
||||
|
||||
if i < len(tag) && tag[i] == '/' {
|
||||
i++
|
||||
}
|
||||
|
||||
i = skipSpace(tag, i)
|
||||
j := 0
|
||||
for ; i < len(tag); i, j = i+1, j+1 {
|
||||
if j >= len(tagname) {
|
||||
break
|
||||
}
|
||||
|
||||
if strings.ToLower(string(tag[i]))[0] != tagname[j] {
|
||||
return false, -1
|
||||
}
|
||||
}
|
||||
|
||||
if i == len(tag) {
|
||||
return false, -1
|
||||
}
|
||||
|
||||
rightAngle := skipUntilCharIgnoreQuotes(tag, i, '>')
|
||||
if rightAngle >= i {
|
||||
return true, rightAngle
|
||||
}
|
||||
|
||||
return false, -1
|
||||
}
|
||||
|
||||
func isRelativeLink(link []byte) (yes bool) {
|
||||
// a tag begin with '#'
|
||||
if link[0] == '#' {
|
||||
@ -351,14 +288,6 @@ func needSkipLink(flags Flags, dest []byte) bool {
|
||||
return flags&Safelink != 0 && !isSafeLink(dest) && !isMailto(dest)
|
||||
}
|
||||
|
||||
func isSmartypantable(node ast.Node) bool {
|
||||
switch node.GetParent().(type) {
|
||||
case *ast.Link, *ast.CodeBlock, *ast.Code:
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func appendLanguageAttr(attrs []string, info []byte) []string {
|
||||
if len(info) == 0 {
|
||||
return attrs
|
||||
@ -1297,21 +1226,8 @@ func isListItemTerm(node ast.Node) bool {
|
||||
return ok && data.ListFlags&ast.ListTypeTerm != 0
|
||||
}
|
||||
|
||||
// TODO: move to internal package
|
||||
func skipSpace(data []byte, i int) int {
|
||||
n := len(data)
|
||||
for i < n && isSpace(data[i]) {
|
||||
i++
|
||||
}
|
||||
return i
|
||||
}
|
||||
|
||||
// TODO: move to internal package
|
||||
var validUris = [][]byte{[]byte("http://"), []byte("https://"), []byte("ftp://"), []byte("mailto://")}
|
||||
var validPaths = [][]byte{[]byte("/"), []byte("./"), []byte("../")}
|
||||
|
||||
func isSafeLink(link []byte) bool {
|
||||
for _, path := range validPaths {
|
||||
for _, path := range valid.Paths {
|
||||
if len(link) >= len(path) && bytes.Equal(link[:len(path)], path) {
|
||||
if len(link) == len(path) {
|
||||
return true
|
||||
@ -1321,7 +1237,7 @@ func isSafeLink(link []byte) bool {
|
||||
}
|
||||
}
|
||||
|
||||
for _, prefix := range validUris {
|
||||
for _, prefix := range valid.URIs {
|
||||
// TODO: handle unicode here
|
||||
// case-insensitive prefix test
|
||||
if len(link) > len(prefix) && bytes.Equal(bytes.ToLower(link[:len(prefix)]), prefix) && isAlnum(link[len(prefix)]) {
|
||||
|
14
vendor/github.com/gomarkdown/markdown/internal/valid/valid.go
generated
vendored
Normal file
14
vendor/github.com/gomarkdown/markdown/internal/valid/valid.go
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
package valid
|
||||
|
||||
var URIs = [][]byte{
|
||||
[]byte("http://"),
|
||||
[]byte("https://"),
|
||||
[]byte("ftp://"),
|
||||
[]byte("mailto:"),
|
||||
}
|
||||
|
||||
var Paths = [][]byte{
|
||||
[]byte("/"),
|
||||
[]byte("./"),
|
||||
[]byte("../"),
|
||||
}
|
4
vendor/github.com/gomarkdown/markdown/parser/block.go
generated
vendored
4
vendor/github.com/gomarkdown/markdown/parser/block.go
generated
vendored
@ -24,8 +24,8 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
reBackslashOrAmp = regexp.MustCompile("[\\&]")
|
||||
reEntityOrEscapedChar = regexp.MustCompile("(?i)\\\\" + escapable + "|" + charEntity)
|
||||
reBackslashOrAmp = regexp.MustCompile(`[\&]`)
|
||||
reEntityOrEscapedChar = regexp.MustCompile(`(?i)\\` + escapable + "|" + charEntity)
|
||||
|
||||
// blockTags is a set of tags that are recognized as HTML block tags.
|
||||
// Any of these can be included in markdown text without special escaping.
|
||||
|
10
vendor/github.com/gomarkdown/markdown/parser/inline.go
generated
vendored
10
vendor/github.com/gomarkdown/markdown/parser/inline.go
generated
vendored
@ -6,6 +6,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/gomarkdown/markdown/ast"
|
||||
"github.com/gomarkdown/markdown/internal/valid"
|
||||
)
|
||||
|
||||
// Parsing of inline elements
|
||||
@ -994,12 +995,9 @@ func isEndOfLink(char byte) bool {
|
||||
return isSpace(char) || char == '<'
|
||||
}
|
||||
|
||||
var validUris = [][]byte{[]byte("http://"), []byte("https://"), []byte("ftp://"), []byte("mailto://")}
|
||||
var validPaths = [][]byte{[]byte("/"), []byte("./"), []byte("../")}
|
||||
|
||||
func isSafeLink(link []byte) bool {
|
||||
nLink := len(link)
|
||||
for _, path := range validPaths {
|
||||
for _, path := range valid.Paths {
|
||||
nPath := len(path)
|
||||
linkPrefix := link[:nPath]
|
||||
if nLink >= nPath && bytes.Equal(linkPrefix, path) {
|
||||
@ -1011,7 +1009,7 @@ func isSafeLink(link []byte) bool {
|
||||
}
|
||||
}
|
||||
|
||||
for _, prefix := range validUris {
|
||||
for _, prefix := range valid.URIs {
|
||||
// TODO: handle unicode here
|
||||
// case-insensitive prefix test
|
||||
nPrefix := len(prefix)
|
||||
@ -1119,7 +1117,7 @@ func isMailtoAutoLink(data []byte) int {
|
||||
nb++
|
||||
|
||||
case '-', '.', '_':
|
||||
break
|
||||
// no-op but not defult
|
||||
|
||||
case '>':
|
||||
if nb == 1 {
|
||||
|
3
vendor/github.com/gomarkdown/markdown/parser/parser.go
generated
vendored
3
vendor/github.com/gomarkdown/markdown/parser/parser.go
generated
vendored
@ -8,7 +8,6 @@ import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/gomarkdown/markdown/ast"
|
||||
)
|
||||
@ -720,6 +719,7 @@ func isAlnum(c byte) bool {
|
||||
// TODO: this is not used
|
||||
// Replace tab characters with spaces, aligning to the next TAB_SIZE column.
|
||||
// always ends output with a newline
|
||||
/*
|
||||
func expandTabs(out *bytes.Buffer, line []byte, tabSize int) {
|
||||
// first, check for common cases: no tabs, or only tabs at beginning of line
|
||||
i, prefix := 0, 0
|
||||
@ -775,6 +775,7 @@ func expandTabs(out *bytes.Buffer, line []byte, tabSize int) {
|
||||
i++
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Find if a line counts as indented or not.
|
||||
// Returns number of characters the indent is (0 = not indented).
|
||||
|
Reference in New Issue
Block a user