Add link metadata fetching package
This commit is contained in:
parent
a4a4588ae6
commit
d22758227d
22 changed files with 27836 additions and 0 deletions
50
vendor/github.com/golang-commonmark/markdown/linkify/charset.go
generated
vendored
Normal file
50
vendor/github.com/golang-commonmark/markdown/linkify/charset.go
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
// Copyright 2015 The Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package linkify
|
||||
|
||||
import "unicode"
|
||||
|
||||
var (
|
||||
trigger [256]bool
|
||||
unreserved [256]bool
|
||||
subdelims [256]bool
|
||||
emailcs [256]bool
|
||||
basicPunct [256]bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
for _, b := range "-._~" {
|
||||
unreserved[b] = true
|
||||
}
|
||||
for _, b := range "!$&'()*+,;=" {
|
||||
subdelims[b] = true
|
||||
}
|
||||
for _, b := range "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%&'*+/=?^_`{|}~-" {
|
||||
emailcs[b] = true
|
||||
}
|
||||
for _, b := range ".,?!;:" {
|
||||
basicPunct[b] = true
|
||||
}
|
||||
}
|
||||
|
||||
func isAllowedInEmail(r rune) bool {
|
||||
return r < 0x7f && emailcs[r]
|
||||
}
|
||||
|
||||
func isLetterOrDigit(r rune) bool {
|
||||
return unicode.In(r, unicode.Letter, unicode.Digit)
|
||||
}
|
||||
|
||||
func isPunctOrSpaceOrControl(r rune) bool {
|
||||
return r == '<' || r == '>' || unicode.In(r, unicode.Punct, unicode.Space, unicode.Cc)
|
||||
}
|
||||
|
||||
func isUnreserved(r rune) bool {
|
||||
return (r < 0x7f && unreserved[r]) || isLetterOrDigit(r)
|
||||
}
|
||||
|
||||
func isSubDelimiter(r rune) bool {
|
||||
return r < 0x7f && subdelims[r]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue