mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 23:12:10 -05:00
transform chain using BBP
This commit is contained in:
parent
5441fc5dfc
commit
4828fee11d
1 changed files with 4 additions and 2 deletions
|
@ -1,8 +1,9 @@
|
||||||
package transform
|
package transform
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
bp "github.com/spf13/hugo/bufferpool"
|
||||||
)
|
)
|
||||||
|
|
||||||
type trans func([]byte) []byte
|
type trans func([]byte) []byte
|
||||||
|
@ -20,8 +21,9 @@ func NewEmptyTransforms() []link {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *chain) Apply(w io.Writer, r io.Reader) (err error) {
|
func (c *chain) Apply(w io.Writer, r io.Reader) (err error) {
|
||||||
|
buffer := bp.GetBuffer()
|
||||||
|
defer bp.PutBuffer(buffer)
|
||||||
|
|
||||||
buffer := new(bytes.Buffer)
|
|
||||||
buffer.ReadFrom(r)
|
buffer.ReadFrom(r)
|
||||||
b := buffer.Bytes()
|
b := buffer.Bytes()
|
||||||
for _, tr := range *c {
|
for _, tr := range *c {
|
||||||
|
|
Loading…
Reference in a new issue