Updated pkgs html2md (PR accepted), and slack (getPermalink support added).
This commit is contained in:
33
vendor/github.com/patcon/html2md/core.go
generated
vendored
Normal file
33
vendor/github.com/patcon/html2md/core.go
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
package html2md
|
||||
|
||||
import "regexp"
|
||||
|
||||
const (
|
||||
Foreign = iota
|
||||
Void
|
||||
)
|
||||
|
||||
type ReplaceFunc func(string, []string) string
|
||||
|
||||
type Rule struct {
|
||||
Patterns []string
|
||||
Tp int
|
||||
Replacement ReplaceFunc
|
||||
}
|
||||
|
||||
func AttrRegExp(attr string) *regexp.Regexp {
|
||||
return regexp.MustCompile(attr + `\s*=\s*["']?([^"\"']*)["']?`)
|
||||
}
|
||||
|
||||
var (
|
||||
rules = make(map[string]*Rule)
|
||||
converts = make([]func(string) string, 0)
|
||||
)
|
||||
|
||||
func AddRule(name string, rule *Rule) {
|
||||
rules[name] = rule
|
||||
}
|
||||
|
||||
func AddConvert(f func(string) string) {
|
||||
converts = append(converts, f)
|
||||
}
|
||||
Reference in New Issue
Block a user