mirror of
https://github.com/gohugoio/hugo.git
synced 2024-05-11 05:54:58 +00:00
publisher: Get the collector in line with the io.Writer interface
As in: Do not retain the input slice.
This commit is contained in:
@ -152,18 +152,21 @@ type htmlElementsCollectorWriter struct {
|
||||
}
|
||||
|
||||
// Write collects HTML elements from p.
|
||||
func (w *htmlElementsCollectorWriter) Write(p []byte) (n int, err error) {
|
||||
n = len(p)
|
||||
func (w *htmlElementsCollectorWriter) Write(p []byte) (int, error) {
|
||||
w.input = p
|
||||
w.pos = 0
|
||||
|
||||
for {
|
||||
w.r = w.next()
|
||||
if w.r == eof {
|
||||
return
|
||||
break
|
||||
}
|
||||
w.state = w.state(w)
|
||||
}
|
||||
|
||||
w.pos = 0
|
||||
w.input = nil
|
||||
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
func (l *htmlElementsCollectorWriter) backup() {
|
||||
|
Reference in New Issue
Block a user