summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/gomarkdown/markdown/html/esc.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-11-22 15:55:57 +0100
committerGitHub <noreply@github.com>2020-11-22 15:55:57 +0100
commit4cc2c914e634eb8c79eb61aa1bc29faf6021ffcf (patch)
tree92d3b8d27cd35455eae7423e4d47aad67cc6a43b /vendor/github.com/gomarkdown/markdown/html/esc.go
parentcbb46293ab670c1989bfcd9aae5d853223074038 (diff)
downloadmatterbridge-msglm-4cc2c914e634eb8c79eb61aa1bc29faf6021ffcf.tar.gz
matterbridge-msglm-4cc2c914e634eb8c79eb61aa1bc29faf6021ffcf.tar.bz2
matterbridge-msglm-4cc2c914e634eb8c79eb61aa1bc29faf6021ffcf.zip
Update vendor (#1297)
Diffstat (limited to 'vendor/github.com/gomarkdown/markdown/html/esc.go')
-rw-r--r--vendor/github.com/gomarkdown/markdown/html/esc.go50
1 files changed, 0 insertions, 50 deletions
diff --git a/vendor/github.com/gomarkdown/markdown/html/esc.go b/vendor/github.com/gomarkdown/markdown/html/esc.go
deleted file mode 100644
index 89ec9a27..00000000
--- a/vendor/github.com/gomarkdown/markdown/html/esc.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package html
-
-import (
- "html"
- "io"
-)
-
-var Escaper = [256][]byte{
- '&': []byte("&amp;"),
- '<': []byte("&lt;"),
- '>': []byte("&gt;"),
- '"': []byte("&quot;"),
-}
-
-// EscapeHTML writes html-escaped d to w. It escapes &, <, > and " characters.
-func EscapeHTML(w io.Writer, d []byte) {
- var start, end int
- n := len(d)
- for end < n {
- escSeq := Escaper[d[end]]
- if escSeq != nil {
- w.Write(d[start:end])
- w.Write(escSeq)
- start = end + 1
- }
- end++
- }
- if start < n && end <= n {
- w.Write(d[start:end])
- }
-}
-
-func escLink(w io.Writer, text []byte) {
- unesc := html.UnescapeString(string(text))
- EscapeHTML(w, []byte(unesc))
-}
-
-// Escape writes the text to w, but skips the escape character.
-func Escape(w io.Writer, text []byte) {
- esc := false
- for i := 0; i < len(text); i++ {
- if text[i] == '\\' {
- esc = !esc
- }
- if esc && text[i] == '\\' {
- continue
- }
- w.Write([]byte{text[i]})
- }
-}