Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'transform/chain.go')
-rw-r--r--transform/chain.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/transform/chain.go b/transform/chain.go
index ab26a350e..4019dca25 100644
--- a/transform/chain.go
+++ b/transform/chain.go
@@ -23,6 +23,7 @@ func NewEmptyTransforms() []link {
// contentTransformer is an interface that enables rotation of pooled buffers
// in the transformer chain.
type contentTransformer interface {
+ Path() []byte
Content() []byte
io.Writer
}
@@ -30,10 +31,15 @@ type contentTransformer interface {
// Implements contentTransformer
// Content is read from the from-buffer and rewritten to to the to-buffer.
type fromToBuffer struct {
+ path []byte
from *bytes.Buffer
to *bytes.Buffer
}
+func (ft fromToBuffer) Path() []byte {
+ return ft.path
+}
+
func (ft fromToBuffer) Write(p []byte) (n int, err error) {
return ft.to.Write(p)
}
@@ -42,7 +48,7 @@ func (ft fromToBuffer) Content() []byte {
return ft.from.Bytes()
}
-func (c *chain) Apply(w io.Writer, r io.Reader) error {
+func (c *chain) Apply(w io.Writer, r io.Reader, p []byte) error {
b1 := bp.GetBuffer()
defer bp.PutBuffer(b1)
@@ -57,7 +63,7 @@ func (c *chain) Apply(w io.Writer, r io.Reader) error {
b2 := bp.GetBuffer()
defer bp.PutBuffer(b2)
- fb := &fromToBuffer{from: b1, to: b2}
+ fb := &fromToBuffer{path: p, from: b1, to: b2}
for i, tr := range *c {
if i > 0 {