hugo/transform/chain.go

26 lines
404 B
Go
Raw Normal View History

package transform
import (
htmltran "code.google.com/p/go-html-transform/html/transform"
2013-10-01 22:59:35 -04:00
"io"
)
type chain []*htmltran.Transform
func NewChain(trs ...*htmltran.Transform) chain {
return trs
}
func (c *chain) Apply(w io.Writer, r io.Reader) (err error) {
var tr *htmltran.Transformer
if tr, err = htmltran.NewFromReader(r); err != nil {
return
}
2013-10-01 22:59:35 -04:00
tr.ApplyAll(*c...)
return tr.Render(w)
}