wuzz/formatter/html.go

27 lines
429 B
Go
Raw Normal View History

package formatter
2017-04-06 05:39:49 +00:00
import (
"bytes"
"io"
"github.com/x86kernel/htmlcolor"
)
type htmlFormatter struct {
textFormatter
}
2017-04-06 05:39:49 +00:00
func (f *htmlFormatter) Format(writer io.Writer, data []byte) error {
htmlFormatter := htmlcolor.NewFormatter()
buf := bytes.NewBuffer(make([]byte, 0, len(data)))
htmlFormatter.Format(buf, data)
writer.Write(buf.Bytes())
return nil
}
func (f *htmlFormatter) Title() string {
return "[html]"
}