mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-08-22 07:31:52 +02:00
Fix external renderer (#16401)
* fix external renderer * use GBackground context as fallback * no fallback, return error Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
fb04cc7dbd
commit
46a4c6835d
4
modules/markup/external/external.go
vendored
4
modules/markup/external/external.go
vendored
|
@ -98,6 +98,10 @@ func (p *Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.
|
||||||
args = append(args, f.Name())
|
args = append(args, f.Name())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ctx == nil || ctx.Ctx == nil {
|
||||||
|
return fmt.Errorf("RenderContext did not provide context")
|
||||||
|
}
|
||||||
|
|
||||||
processCtx, cancel := context.WithCancel(ctx.Ctx)
|
processCtx, cancel := context.WithCancel(ctx.Ctx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
|
|
@ -336,6 +336,7 @@ func renderDirectory(ctx *context.Context, treeLink string) {
|
||||||
ctx.Data["MarkupType"] = string(markupType)
|
ctx.Data["MarkupType"] = string(markupType)
|
||||||
var result strings.Builder
|
var result strings.Builder
|
||||||
err := markup.Render(&markup.RenderContext{
|
err := markup.Render(&markup.RenderContext{
|
||||||
|
Ctx: ctx,
|
||||||
Filename: readmeFile.name,
|
Filename: readmeFile.name,
|
||||||
URLPrefix: readmeTreelink,
|
URLPrefix: readmeTreelink,
|
||||||
Metas: ctx.Repo.Repository.ComposeDocumentMetas(),
|
Metas: ctx.Repo.Repository.ComposeDocumentMetas(),
|
||||||
|
@ -511,6 +512,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
|
||||||
ctx.Data["MarkupType"] = markupType
|
ctx.Data["MarkupType"] = markupType
|
||||||
var result strings.Builder
|
var result strings.Builder
|
||||||
err := markup.Render(&markup.RenderContext{
|
err := markup.Render(&markup.RenderContext{
|
||||||
|
Ctx: ctx,
|
||||||
Filename: blob.Name(),
|
Filename: blob.Name(),
|
||||||
URLPrefix: path.Dir(treeLink),
|
URLPrefix: path.Dir(treeLink),
|
||||||
Metas: ctx.Repo.Repository.ComposeDocumentMetas(),
|
Metas: ctx.Repo.Repository.ComposeDocumentMetas(),
|
||||||
|
@ -570,6 +572,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
|
||||||
ctx.Data["MarkupType"] = markupType
|
ctx.Data["MarkupType"] = markupType
|
||||||
var result strings.Builder
|
var result strings.Builder
|
||||||
err := markup.Render(&markup.RenderContext{
|
err := markup.Render(&markup.RenderContext{
|
||||||
|
Ctx: ctx,
|
||||||
Filename: blob.Name(),
|
Filename: blob.Name(),
|
||||||
URLPrefix: path.Dir(treeLink),
|
URLPrefix: path.Dir(treeLink),
|
||||||
Metas: ctx.Repo.Repository.ComposeDocumentMetas(),
|
Metas: ctx.Repo.Repository.ComposeDocumentMetas(),
|
||||||
|
|
Loading…
Reference in a new issue