mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05: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:
parent
ef0f1a7269
commit
a9bcd38181
1 changed files with 7 additions and 4 deletions
|
@ -152,18 +152,21 @@ type htmlElementsCollectorWriter struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write collects HTML elements from p.
|
// Write collects HTML elements from p.
|
||||||
func (w *htmlElementsCollectorWriter) Write(p []byte) (n int, err error) {
|
func (w *htmlElementsCollectorWriter) Write(p []byte) (int, error) {
|
||||||
n = len(p)
|
|
||||||
w.input = p
|
w.input = p
|
||||||
w.pos = 0
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
w.r = w.next()
|
w.r = w.next()
|
||||||
if w.r == eof {
|
if w.r == eof {
|
||||||
return
|
break
|
||||||
}
|
}
|
||||||
w.state = w.state(w)
|
w.state = w.state(w)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
w.pos = 0
|
||||||
|
w.input = nil
|
||||||
|
|
||||||
|
return len(p), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *htmlElementsCollectorWriter) backup() {
|
func (l *htmlElementsCollectorWriter) backup() {
|
||||||
|
|
Loading…
Reference in a new issue