mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 15:23:14 -05:00
[CHORE] Update terminal-to-html dependency
- Update the `github.com/buildkite/terminal-to-html/v3` dependency from version v3.10.1 to v3.13.0. - Version v3.12.0 introduced an incompatible change, the return type of `AsHTML` changed from `[]byte` to `string`. That same version also introduced streaming mode https://github.com/buildkite/terminal-to-html/pull/126, which allows us to avoid reading the whole input into memory. - Closes #4313
This commit is contained in:
parent
741191a498
commit
3eb178db49
3 changed files with 8 additions and 8 deletions
2
go.mod
2
go.mod
|
@ -24,7 +24,7 @@ require (
|
|||
github.com/alecthomas/chroma/v2 v2.14.0
|
||||
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb
|
||||
github.com/blevesearch/bleve/v2 v2.4.1
|
||||
github.com/buildkite/terminal-to-html/v3 v3.10.1
|
||||
github.com/buildkite/terminal-to-html/v3 v3.13.0
|
||||
github.com/caddyserver/certmagic v0.21.0
|
||||
github.com/chi-middleware/proxy v1.1.1
|
||||
github.com/djherbis/buffer v1.2.0
|
||||
|
|
4
go.sum
4
go.sum
|
@ -143,8 +143,8 @@ github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
|||
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
||||
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
||||
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
||||
github.com/buildkite/terminal-to-html/v3 v3.10.1 h1:znT9eD26LQ59dDJJEpMCwkP4wEptEAPi74hsTBuHdEo=
|
||||
github.com/buildkite/terminal-to-html/v3 v3.10.1/go.mod h1:qtuRyYs6/Sw3FS9jUyVEaANHgHGqZsGqMknPLyau5cQ=
|
||||
github.com/buildkite/terminal-to-html/v3 v3.13.0 h1:TBRfvqZWoIpxxiiM9rdIn2bbI7pwxBjlQf8/cbLJnss=
|
||||
github.com/buildkite/terminal-to-html/v3 v3.13.0/go.mod h1:33sojHDaRBSMwwkKXPEkb5Uc7LKF79rWGurL3ei/GX0=
|
||||
github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
|
||||
github.com/caddyserver/certmagic v0.21.0 h1:yDoifClc4hIxhHer3AxUj4buhF+NzRR6torw/AOnuUE=
|
||||
github.com/caddyserver/certmagic v0.21.0/go.mod h1:OgUZNXYV/ylYoFJNmoYVR5nntydLNMQISePPgqZTyhc=
|
||||
|
|
|
@ -58,13 +58,13 @@ func (Renderer) CanRender(filename string, input io.Reader) bool {
|
|||
|
||||
// Render renders terminal colors to HTML with all specific handling stuff.
|
||||
func (Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.Writer) error {
|
||||
buf, err := io.ReadAll(input)
|
||||
if err != nil {
|
||||
screen := &trend.Screen{}
|
||||
if _, err := io.Copy(screen, input); err != nil {
|
||||
return err
|
||||
}
|
||||
buf = trend.Render(buf)
|
||||
buf = bytes.ReplaceAll(buf, []byte("\n"), []byte(`<br>`))
|
||||
_, err = output.Write(buf)
|
||||
buf := screen.AsHTML()
|
||||
buf = strings.ReplaceAll(buf, "\n", `<br>`)
|
||||
_, err := output.Write([]byte(buf))
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue