diff options
Diffstat (limited to 'vendor/github.com/gomarkdown/markdown/parser')
-rw-r--r-- | vendor/github.com/gomarkdown/markdown/parser/block.go | 4 | ||||
-rw-r--r-- | vendor/github.com/gomarkdown/markdown/parser/inline.go | 10 | ||||
-rw-r--r-- | vendor/github.com/gomarkdown/markdown/parser/parser.go | 3 |
3 files changed, 8 insertions, 9 deletions
diff --git a/vendor/github.com/gomarkdown/markdown/parser/block.go b/vendor/github.com/gomarkdown/markdown/parser/block.go index dee173f8..eeebec73 100644 --- a/vendor/github.com/gomarkdown/markdown/parser/block.go +++ b/vendor/github.com/gomarkdown/markdown/parser/block.go @@ -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. diff --git a/vendor/github.com/gomarkdown/markdown/parser/inline.go b/vendor/github.com/gomarkdown/markdown/parser/inline.go index 1f23935c..ae7f244e 100644 --- a/vendor/github.com/gomarkdown/markdown/parser/inline.go +++ b/vendor/github.com/gomarkdown/markdown/parser/inline.go @@ -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 { diff --git a/vendor/github.com/gomarkdown/markdown/parser/parser.go b/vendor/github.com/gomarkdown/markdown/parser/parser.go index 7712a29f..eb63a911 100644 --- a/vendor/github.com/gomarkdown/markdown/parser/parser.go +++ b/vendor/github.com/gomarkdown/markdown/parser/parser.go @@ -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). |