aboutsummaryrefslogtreecommitdiffstats
path: root/modules/templates/util_render_legacy.go
blob: 8f7b84c83dcec3871ea440c94b9ecd0dca87b745 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright 2024 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package templates

import (
	"context"
	"html/template"

	issues_model "code.gitea.io/gitea/models/issues"
	"code.gitea.io/gitea/modules/reqctx"
	"code.gitea.io/gitea/modules/translation"
)

func renderEmojiLegacy(ctx context.Context, text string) template.HTML {
	panicIfDevOrTesting()
	return NewRenderUtils(reqctx.FromContext(ctx)).RenderEmoji(text)
}

func renderLabelLegacy(ctx context.Context, locale translation.Locale, label *issues_model.Label) template.HTML {
	panicIfDevOrTesting()
	return NewRenderUtils(reqctx.FromContext(ctx)).RenderLabel(label)
}

func renderLabelsLegacy(ctx context.Context, locale translation.Locale, labels []*issues_model.Label, repoLink string, issue *issues_model.Issue) template.HTML {
	panicIfDevOrTesting()
	return NewRenderUtils(reqctx.FromContext(ctx)).RenderLabels(labels, repoLink, issue)
}

func renderMarkdownToHtmlLegacy(ctx context.Context, input string) template.HTML { //nolint:revive
	panicIfDevOrTesting()
	return NewRenderUtils(reqctx.FromContext(ctx)).MarkdownToHtml(input)
}

func renderCommitMessageLegacy(ctx context.Context, msg string, metas map[string]string) template.HTML {
	panicIfDevOrTesting()
	return NewRenderUtils(reqctx.FromContext(ctx)).RenderCommitMessage(msg, metas)
}

func renderCommitMessageLinkSubjectLegacy(ctx context.Context, msg, urlDefault string, metas map[string]string) template.HTML {
	panicIfDevOrTesting()
	return NewRenderUtils(reqctx.FromContext(ctx)).RenderCommitMessageLinkSubject(msg, urlDefault, metas)
}

func renderIssueTitleLegacy(ctx context.Context, text string, metas map[string]string) template.HTML {
	panicIfDevOrTesting()
	return NewRenderUtils(reqctx.FromContext(ctx)).RenderIssueTitle(text, metas)
}

func renderCommitBodyLegacy(ctx context.Context, msg string, metas map[string]string) template.HTML {
	panicIfDevOrTesting()
	return NewRenderUtils(reqctx.FromContext(ctx)).RenderCommitBody(msg, metas)
}