summaryrefslogtreecommitdiff
path: root/vendor/github.com/tdewolff/parse/v2/buffer/writer.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-07-19 15:21:17 +0200
committerLibravatar GitHub <noreply@github.com>2022-07-19 15:21:17 +0200
commitc84384e6608368a13a774d6d33a8cc32da7cf209 (patch)
treea18aa9c1ced1299d2682c1993e1ba38f46448dba /vendor/github.com/tdewolff/parse/v2/buffer/writer.go
parent[chore] use our own logging implementation (#716) (diff)
downloadgotosocial-c84384e6608368a13a774d6d33a8cc32da7cf209.tar.xz
[bugfix] html escape special characters in text instead of totally removing them (#719)
* remove minify dependency * tidy up some tests * remove pre + postformat funcs * rework sanitization + formatting * update tests * add some more markdown tests
Diffstat (limited to 'vendor/github.com/tdewolff/parse/v2/buffer/writer.go')
-rw-r--r--vendor/github.com/tdewolff/parse/v2/buffer/writer.go65
1 files changed, 0 insertions, 65 deletions
diff --git a/vendor/github.com/tdewolff/parse/v2/buffer/writer.go b/vendor/github.com/tdewolff/parse/v2/buffer/writer.go
deleted file mode 100644
index 6c94201ff..000000000
--- a/vendor/github.com/tdewolff/parse/v2/buffer/writer.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package buffer
-
-import (
- "io"
-)
-
-// Writer implements an io.Writer over a byte slice.
-type Writer struct {
- buf []byte
- err error
- expand bool
-}
-
-// NewWriter returns a new Writer for a given byte slice.
-func NewWriter(buf []byte) *Writer {
- return &Writer{
- buf: buf,
- expand: true,
- }
-}
-
-// NewStaticWriter returns a new Writer for a given byte slice. It does not reallocate and expand the byte-slice.
-func NewStaticWriter(buf []byte) *Writer {
- return &Writer{
- buf: buf,
- expand: false,
- }
-}
-
-// Write writes bytes from the given byte slice and returns the number of bytes written and an error if occurred. When err != nil, n == 0.
-func (w *Writer) Write(b []byte) (int, error) {
- n := len(b)
- end := len(w.buf)
- if end+n > cap(w.buf) {
- if !w.expand {
- w.err = io.EOF
- return 0, io.EOF
- }
- buf := make([]byte, end, 2*cap(w.buf)+n)
- copy(buf, w.buf)
- w.buf = buf
- }
- w.buf = w.buf[:end+n]
- return copy(w.buf[end:], b), nil
-}
-
-// Len returns the length of the underlying byte slice.
-func (w *Writer) Len() int {
- return len(w.buf)
-}
-
-// Bytes returns the underlying byte slice.
-func (w *Writer) Bytes() []byte {
- return w.buf
-}
-
-// Reset empties and reuses the current buffer. Subsequent writes will overwrite the buffer, so any reference to the underlying slice is invalidated after this call.
-func (w *Writer) Reset() {
- w.buf = w.buf[:0]
-}
-
-// Close returns the last error.
-func (w *Writer) Close() error {
- return w.err
-}