summaryrefslogtreecommitdiffstats
path: root/modules/templates
diff options
context:
space:
mode:
Diffstat (limited to 'modules/templates')
-rw-r--r--modules/templates/helper.go29
1 files changed, 23 insertions, 6 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index 7e33f26209..7b175bfab3 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -665,7 +665,11 @@ func RenderCommitMessageLink(msg, urlPrefix, urlDefault string, metas map[string
cleanMsg := template.HTMLEscapeString(msg)
// we can safely assume that it will not return any error, since there
// shouldn't be any special HTML.
- fullMessage, err := markup.RenderCommitMessage([]byte(cleanMsg), urlPrefix, urlDefault, metas)
+ fullMessage, err := markup.RenderCommitMessage(&markup.RenderContext{
+ URLPrefix: urlPrefix,
+ DefaultLink: urlDefault,
+ Metas: metas,
+ }, cleanMsg)
if err != nil {
log.Error("RenderCommitMessage: %v", err)
return ""
@@ -692,7 +696,11 @@ func RenderCommitMessageLinkSubject(msg, urlPrefix, urlDefault string, metas map
// we can safely assume that it will not return any error, since there
// shouldn't be any special HTML.
- renderedMessage, err := markup.RenderCommitMessageSubject([]byte(template.HTMLEscapeString(msgLine)), urlPrefix, urlDefault, metas)
+ renderedMessage, err := markup.RenderCommitMessageSubject(&markup.RenderContext{
+ URLPrefix: urlPrefix,
+ DefaultLink: urlDefault,
+ Metas: metas,
+ }, template.HTMLEscapeString(msgLine))
if err != nil {
log.Error("RenderCommitMessageSubject: %v", err)
return template.HTML("")
@@ -714,7 +722,10 @@ func RenderCommitBody(msg, urlPrefix string, metas map[string]string) template.H
return template.HTML("")
}
- renderedMessage, err := markup.RenderCommitMessage([]byte(template.HTMLEscapeString(msgLine)), urlPrefix, "", metas)
+ renderedMessage, err := markup.RenderCommitMessage(&markup.RenderContext{
+ URLPrefix: urlPrefix,
+ Metas: metas,
+ }, template.HTMLEscapeString(msgLine))
if err != nil {
log.Error("RenderCommitMessage: %v", err)
return ""
@@ -724,7 +735,10 @@ func RenderCommitBody(msg, urlPrefix string, metas map[string]string) template.H
// RenderIssueTitle renders issue/pull title with defined post processors
func RenderIssueTitle(text, urlPrefix string, metas map[string]string) template.HTML {
- renderedText, err := markup.RenderIssueTitle([]byte(template.HTMLEscapeString(text)), urlPrefix, metas)
+ renderedText, err := markup.RenderIssueTitle(&markup.RenderContext{
+ URLPrefix: urlPrefix,
+ Metas: metas,
+ }, template.HTMLEscapeString(text))
if err != nil {
log.Error("RenderIssueTitle: %v", err)
return template.HTML("")
@@ -734,7 +748,7 @@ func RenderIssueTitle(text, urlPrefix string, metas map[string]string) template.
// RenderEmoji renders html text with emoji post processors
func RenderEmoji(text string) template.HTML {
- renderedText, err := markup.RenderEmoji([]byte(template.HTMLEscapeString(text)))
+ renderedText, err := markup.RenderEmoji(template.HTMLEscapeString(text))
if err != nil {
log.Error("RenderEmoji: %v", err)
return template.HTML("")
@@ -758,7 +772,10 @@ func ReactionToEmoji(reaction string) template.HTML {
// RenderNote renders the contents of a git-notes file as a commit message.
func RenderNote(msg, urlPrefix string, metas map[string]string) template.HTML {
cleanMsg := template.HTMLEscapeString(msg)
- fullMessage, err := markup.RenderCommitMessage([]byte(cleanMsg), urlPrefix, "", metas)
+ fullMessage, err := markup.RenderCommitMessage(&markup.RenderContext{
+ URLPrefix: urlPrefix,
+ Metas: metas,
+ }, cleanMsg)
if err != nil {
log.Error("RenderNote: %v", err)
return ""