diff --git a/routers/web/auth/oauth.go b/routers/web/auth/oauth.go
index 660fa8fe4e..ee0770ef37 100644
--- a/routers/web/auth/oauth.go
+++ b/routers/web/auth/oauth.go
@@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"html"
+ "html/template"
"io"
"net/http"
"net/url"
@@ -499,11 +500,11 @@ func AuthorizeOAuth(ctx *context.Context) {
ctx.Data["Scope"] = form.Scope
ctx.Data["Nonce"] = form.Nonce
if user != nil {
- ctx.Data["ApplicationCreatorLinkHTML"] = fmt.Sprintf(`@%s `, html.EscapeString(user.HomeLink()), html.EscapeString(user.Name))
+ ctx.Data["ApplicationCreatorLinkHTML"] = template.HTML(fmt.Sprintf(`@%s `, html.EscapeString(user.HomeLink()), html.EscapeString(user.Name)))
} else {
- ctx.Data["ApplicationCreatorLinkHTML"] = fmt.Sprintf(`%s `, html.EscapeString(setting.AppSubURL+"/"), html.EscapeString(setting.AppName))
+ ctx.Data["ApplicationCreatorLinkHTML"] = template.HTML(fmt.Sprintf(`%s `, html.EscapeString(setting.AppSubURL+"/"), html.EscapeString(setting.AppName)))
}
- ctx.Data["ApplicationRedirectDomainHTML"] = "" + html.EscapeString(form.RedirectURI) + " "
+ ctx.Data["ApplicationRedirectDomainHTML"] = template.HTML("" + html.EscapeString(form.RedirectURI) + " ")
// TODO document SESSION <=> FORM
err = ctx.Session.Set("client_id", app.ClientID)
if err != nil {
diff --git a/templates/admin/dashboard.tmpl b/templates/admin/dashboard.tmpl
index 8088315f17..cc7d338589 100644
--- a/templates/admin/dashboard.tmpl
+++ b/templates/admin/dashboard.tmpl
@@ -2,7 +2,7 @@
{{if .NeedUpdate}}
-
{{(ctx.Locale.Tr "admin.dashboard.new_version_hint" .RemoteVersion AppVer) | Str2html}}
+
{{ctx.Locale.Tr "admin.dashboard.new_version_hint" .RemoteVersion AppVer}}
{{end}}
{{else if .SearchResults}}
- {{ctx.Locale.Tr "explore.code_search_results" (.Keyword|Escape) | Str2html}}
+ {{ctx.Locale.Tr "explore.code_search_results" (.Keyword|Escape)}}
{{template "code/searchresults" .}}
{{else if .Keyword}}
diff --git a/templates/home.tmpl b/templates/home.tmpl
index 78364431e9..1e5369e7ee 100644
--- a/templates/home.tmpl
+++ b/templates/home.tmpl
@@ -17,7 +17,7 @@
{{svg "octicon-flame"}} {{ctx.Locale.Tr "startpage.install"}}
- {{ctx.Locale.Tr "startpage.install_desc" | Str2html}}
+ {{ctx.Locale.Tr "startpage.install_desc"}}
@@ -25,7 +25,7 @@
{{svg "octicon-device-desktop"}} {{ctx.Locale.Tr "startpage.platform"}}
- {{ctx.Locale.Tr "startpage.platform_desc" | Str2html}}
+ {{ctx.Locale.Tr "startpage.platform_desc"}}
@@ -35,7 +35,7 @@
{{svg "octicon-rocket"}} {{ctx.Locale.Tr "startpage.lightweight"}}
- {{ctx.Locale.Tr "startpage.lightweight_desc" | Str2html}}
+ {{ctx.Locale.Tr "startpage.lightweight_desc"}}
@@ -43,7 +43,7 @@
{{svg "octicon-code"}} {{ctx.Locale.Tr "startpage.license"}}
- {{ctx.Locale.Tr "startpage.license_desc" | Str2html}}
+ {{ctx.Locale.Tr "startpage.license_desc"}}
diff --git a/templates/mail/auth/activate.tmpl b/templates/mail/auth/activate.tmpl
index a15afe3d49..b1bb4cb463 100644
--- a/templates/mail/auth/activate.tmpl
+++ b/templates/mail/auth/activate.tmpl
@@ -8,8 +8,8 @@
{{$activate_url := printf "%suser/activate?code=%s" AppUrl (QueryEscape .Code)}}
- {{.locale.Tr "mail.activate_account.text_1" (.DisplayName|DotEscape) AppName | Str2html}}
- {{.locale.Tr "mail.activate_account.text_2" .ActiveCodeLives | Str2html}}
{{$activate_url}}
+ {{.locale.Tr "mail.activate_account.text_1" (.DisplayName|DotEscape) AppName}}
+ {{.locale.Tr "mail.activate_account.text_2" .ActiveCodeLives}}
{{$activate_url}}
{{.locale.Tr "mail.link_not_working_do_paste"}}
© {{AppName}}
diff --git a/templates/mail/auth/activate_email.tmpl b/templates/mail/auth/activate_email.tmpl
index b15cc2a68a..3d32f80a4e 100644
--- a/templates/mail/auth/activate_email.tmpl
+++ b/templates/mail/auth/activate_email.tmpl
@@ -8,8 +8,8 @@
{{$activate_url := printf "%suser/activate_email?code=%s&email=%s" AppUrl (QueryEscape .Code) (QueryEscape .Email)}}
- {{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}
- {{.locale.Tr "mail.activate_email.text" .ActiveCodeLives | Str2html}}
{{$activate_url}}
+ {{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape)}}
+ {{.locale.Tr "mail.activate_email.text" .ActiveCodeLives}}
{{$activate_url}}
{{.locale.Tr "mail.link_not_working_do_paste"}}
© {{AppName}}
diff --git a/templates/mail/auth/register_notify.tmpl b/templates/mail/auth/register_notify.tmpl
index 3cdb456fb3..ec3e09dd5f 100644
--- a/templates/mail/auth/register_notify.tmpl
+++ b/templates/mail/auth/register_notify.tmpl
@@ -8,10 +8,10 @@
{{$set_pwd_url := printf "%[1]suser/forgot_password" AppUrl}}
- {{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}
+ {{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape)}}
{{.locale.Tr "mail.register_notify.text_1" AppName}}
{{.locale.Tr "mail.register_notify.text_2" .Username}}
{{AppUrl}}user/login
- {{.locale.Tr "mail.register_notify.text_3" ($set_pwd_url | Escape) | Str2html}}
+ {{.locale.Tr "mail.register_notify.text_3" ($set_pwd_url | Escape)}}
© {{AppName}}
diff --git a/templates/mail/auth/reset_passwd.tmpl b/templates/mail/auth/reset_passwd.tmpl
index 172844c954..55b1ecec3f 100644
--- a/templates/mail/auth/reset_passwd.tmpl
+++ b/templates/mail/auth/reset_passwd.tmpl
@@ -8,8 +8,8 @@
{{$recover_url := printf "%suser/recover_account?code=%s" AppUrl (QueryEscape .Code)}}
- {{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}
- {{.locale.Tr "mail.reset_password.text" .ResetPwdCodeLives | Str2html}}
{{$recover_url}}
+ {{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape)}}
+ {{.locale.Tr "mail.reset_password.text" .ResetPwdCodeLives}}
{{$recover_url}}
{{.locale.Tr "mail.link_not_working_do_paste"}}
© {{AppName}}
diff --git a/templates/mail/issue/default.tmpl b/templates/mail/issue/default.tmpl
index b5a7ab95cf..54ae726d71 100644
--- a/templates/mail/issue/default.tmpl
+++ b/templates/mail/issue/default.tmpl
@@ -16,7 +16,7 @@
- {{if .IsMention}}{{.locale.Tr "mail.issue.x_mentioned_you" .Doer.Name | Str2html}}
{{end}}
+ {{if .IsMention}}{{.locale.Tr "mail.issue.x_mentioned_you" .Doer.Name}}
{{end}}
{{if eq .ActionName "push"}}
{{if .Comment.IsForcePush}}
@@ -30,32 +30,32 @@
{{.locale.Tr "mail.issue.action.force_push" .Doer.Name .Comment.Issue.PullRequest.HeadBranch ($oldCommitLink|Safe) ($newCommitLink|Safe)}}
{{else}}
- {{.locale.TrN (len .Comment.Commits) "mail.issue.action.push_1" "mail.issue.action.push_n" .Doer.Name .Comment.Issue.PullRequest.HeadBranch (len .Comment.Commits) | Str2html}}
+ {{.locale.TrN (len .Comment.Commits) "mail.issue.action.push_1" "mail.issue.action.push_n" .Doer.Name .Comment.Issue.PullRequest.HeadBranch (len .Comment.Commits)}}
{{end}}
{{end}}
{{if eq .ActionName "close"}}
- {{.locale.Tr "mail.issue.action.close" (Escape .Doer.Name) .Issue.Index | Str2html}}
+ {{.locale.Tr "mail.issue.action.close" (Escape .Doer.Name) .Issue.Index}}
{{else if eq .ActionName "reopen"}}
- {{.locale.Tr "mail.issue.action.reopen" (Escape .Doer.Name) .Issue.Index | Str2html}}
+ {{.locale.Tr "mail.issue.action.reopen" (Escape .Doer.Name) .Issue.Index}}
{{else if eq .ActionName "merge"}}
- {{.locale.Tr "mail.issue.action.merge" (Escape .Doer.Name) .Issue.Index (Escape .Issue.PullRequest.BaseBranch) | Str2html}}
+ {{.locale.Tr "mail.issue.action.merge" (Escape .Doer.Name) .Issue.Index (Escape .Issue.PullRequest.BaseBranch)}}
{{else if eq .ActionName "approve"}}
- {{.locale.Tr "mail.issue.action.approve" (Escape .Doer.Name) | Str2html}}
+ {{.locale.Tr "mail.issue.action.approve" (Escape .Doer.Name)}}
{{else if eq .ActionName "reject"}}
- {{.locale.Tr "mail.issue.action.reject" (Escape .Doer.Name) | Str2html}}
+ {{.locale.Tr "mail.issue.action.reject" (Escape .Doer.Name)}}
{{else if eq .ActionName "review"}}
- {{.locale.Tr "mail.issue.action.review" (Escape .Doer.Name) | Str2html}}
+ {{.locale.Tr "mail.issue.action.review" (Escape .Doer.Name)}}
{{else if eq .ActionName "review_dismissed"}}
- {{.locale.Tr "mail.issue.action.review_dismissed" (Escape .Doer.Name) (Escape .Comment.Review.Reviewer.Name) | Str2html}}
+ {{.locale.Tr "mail.issue.action.review_dismissed" (Escape .Doer.Name) (Escape .Comment.Review.Reviewer.Name)}}
{{else if eq .ActionName "ready_for_review"}}
- {{.locale.Tr "mail.issue.action.ready_for_review" (Escape .Doer.Name) | Str2html}}
+ {{.locale.Tr "mail.issue.action.ready_for_review" (Escape .Doer.Name)}}
{{end}}
{{- if eq .Body ""}}
{{if eq .ActionName "new"}}
- {{.locale.Tr "mail.issue.action.new" (Escape .Doer.Name) .Issue.Index | Str2html}}
+ {{.locale.Tr "mail.issue.action.new" (Escape .Doer.Name) .Issue.Index}}
{{end}}
{{else}}
{{.Body | Str2html}}
diff --git a/templates/mail/team_invite.tmpl b/templates/mail/team_invite.tmpl
index d21b7843ec..cb0c0c0a50 100644
--- a/templates/mail/team_invite.tmpl
+++ b/templates/mail/team_invite.tmpl
@@ -5,7 +5,7 @@
- {{.locale.Tr "mail.team_invite.text_1" (DotEscape .Inviter.DisplayName) (DotEscape .Team.Name) (DotEscape .Organization.DisplayName) | Str2html}}
+ {{.locale.Tr "mail.team_invite.text_1" (DotEscape .Inviter.DisplayName) (DotEscape .Team.Name) (DotEscape .Organization.DisplayName)}}
{{.locale.Tr "mail.team_invite.text_2"}}
{{.InviteURL}}
{{.locale.Tr "mail.link_not_working_do_paste"}}
{{.locale.Tr "mail.team_invite.text_3" .Invite.Email}}
diff --git a/templates/org/settings/delete.tmpl b/templates/org/settings/delete.tmpl
index 2cf8238f57..e1ef471e34 100644
--- a/templates/org/settings/delete.tmpl
+++ b/templates/org/settings/delete.tmpl
@@ -6,7 +6,7 @@
-
{{svg "octicon-alert"}} {{ctx.Locale.Tr "org.settings.delete_prompt" | Str2html}}
+
{{svg "octicon-alert"}} {{ctx.Locale.Tr "org.settings.delete_prompt"}}
diff --git a/templates/org/team/sidebar.tmpl b/templates/org/team/sidebar.tmpl
index 37550ab71f..440fa11dc9 100644
--- a/templates/org/team/sidebar.tmpl
+++ b/templates/org/team/sidebar.tmpl
@@ -27,16 +27,16 @@
{{if eq .Team.LowerName "owners"}}
- {{ctx.Locale.Tr "org.teams.owners_permission_desc" | Str2html}}
+ {{ctx.Locale.Tr "org.teams.owners_permission_desc"}}
{{else}}
{{ctx.Locale.Tr "org.team_access_desc"}}
{{if .Team.IncludesAllRepositories}}
- {{ctx.Locale.Tr "org.teams.all_repositories" | Str2html}}
+ {{ctx.Locale.Tr "org.teams.all_repositories"}}
{{else}}
- {{ctx.Locale.Tr "org.teams.specific_repositories" | Str2html}}
+ {{ctx.Locale.Tr "org.teams.specific_repositories"}}
{{end}}
{{if .Team.CanCreateOrgRepo}}
{{ctx.Locale.Tr "org.teams.can_create_org_repo"}}
@@ -44,10 +44,10 @@
{{if (eq .Team.AccessMode 2)}}
{{ctx.Locale.Tr "org.settings.permission"}}
- {{ctx.Locale.Tr "org.teams.write_permission_desc" | Str2html}}
+ {{ctx.Locale.Tr "org.teams.write_permission_desc"}}
{{else if (eq .Team.AccessMode 3)}}
{{ctx.Locale.Tr "org.settings.permission"}}
- {{ctx.Locale.Tr "org.teams.admin_permission_desc" | Str2html}}
+ {{ctx.Locale.Tr "org.teams.admin_permission_desc"}}
{{else}}
diff --git a/templates/repo/blame.tmpl b/templates/repo/blame.tmpl
index 31cd5b23f6..4df7b18c44 100644
--- a/templates/repo/blame.tmpl
+++ b/templates/repo/blame.tmpl
@@ -2,11 +2,11 @@
{{$revsFileLink := URLJoin .RepoLink "src" .BranchNameSubURL "/.git-blame-ignore-revs"}}
{{if .UsesIgnoreRevs}}
-
{{ctx.Locale.Tr "repo.blame.ignore_revs" $revsFileLink (print $revsFileLink "?bypass-blame-ignore=true") | Str2html}}
+
{{ctx.Locale.Tr "repo.blame.ignore_revs" $revsFileLink (print $revsFileLink "?bypass-blame-ignore=true")}}
{{else}}
-
{{ctx.Locale.Tr "repo.blame.ignore_revs.failed" $revsFileLink | Str2html}}
+
{{ctx.Locale.Tr "repo.blame.ignore_revs.failed" $revsFileLink}}
{{end}}
{{end}}
diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl
index 8ae7301c4a..46503cb5df 100644
--- a/templates/repo/branch/list.tmpl
+++ b/templates/repo/branch/list.tmpl
@@ -210,7 +210,7 @@
{{ctx.Locale.Tr "repo.branch.delete_html"}}
-
{{ctx.Locale.Tr "repo.branch.delete_desc" | Str2html}}
+
{{ctx.Locale.Tr "repo.branch.delete_desc"}}
{{template "base/modal_actions_confirm" .}}
diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl
index d6ff22b7ab..73c9ca6a1f 100644
--- a/templates/repo/create.tmpl
+++ b/templates/repo/create.tmpl
@@ -158,7 +158,7 @@
{{end}}
- {{ctx.Locale.Tr "repo.license_helper_desc" "https://choosealicense.com/" | Str2html}}
+ {{ctx.Locale.Tr "repo.license_helper_desc" "https://choosealicense.com/"}}
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl
index 5960decc06..abeeacead0 100644
--- a/templates/repo/diff/box.tmpl
+++ b/templates/repo/diff/box.tmpl
@@ -19,7 +19,7 @@
{{end}}
{{if not .DiffNotAvailable}}
- {{svg "octicon-diff" 16 "gt-mr-2"}}{{ctx.Locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
+ {{svg "octicon-diff" 16 "gt-mr-2"}}{{ctx.Locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion}}
{{end}}
diff --git a/templates/repo/diff/stats.tmpl b/templates/repo/diff/stats.tmpl
index db468ab6c8..b7acb3d49b 100644
--- a/templates/repo/diff/stats.tmpl
+++ b/templates/repo/diff/stats.tmpl
@@ -1,5 +1,5 @@
{{Eval .file.Addition "+" .file.Deletion}}
-
+
{{/* if the denominator is zero, then the float result is "width: NaNpx", as before, it just works */}}
diff --git a/templates/repo/empty.tmpl b/templates/repo/empty.tmpl
index 62194abe50..f171cd8d5c 100644
--- a/templates/repo/empty.tmpl
+++ b/templates/repo/empty.tmpl
@@ -24,7 +24,7 @@
-
{{ctx.Locale.Tr "repo.clone_this_repo"}} {{ctx.Locale.Tr "repo.clone_helper" "http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository" | Str2html}}
+
{{ctx.Locale.Tr "repo.clone_this_repo"}} {{ctx.Locale.Tr "repo.clone_helper" "http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository"}}
-
{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.description" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | Str2html}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.description.local"}}{{end}}
+
{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.description" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.description.local"}}{{end}}
{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.label"}}
diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl
index 6dbeb741db..5b747c2bf9 100644
--- a/templates/repo/release/list.tmpl
+++ b/templates/repo/release/list.tmpl
@@ -54,7 +54,7 @@
{{TimeSinceUnix $release.CreatedUnix ctx.Locale}}
{{end}}
{{if and (not $release.IsDraft) ($.Permission.CanRead $.UnitTypeCode)}}
- |
{{ctx.Locale.Tr "repo.release.ahead.commits" $release.NumCommitsBehind | Str2html}} {{ctx.Locale.Tr "repo.release.ahead.target" $release.TargetBehind}}
+ |
{{ctx.Locale.Tr "repo.release.ahead.commits" $release.NumCommitsBehind}} {{ctx.Locale.Tr "repo.release.ahead.target" $release.TargetBehind}}
{{end}}
diff --git a/templates/repo/search.tmpl b/templates/repo/search.tmpl
index b616b4de32..495620300f 100644
--- a/templates/repo/search.tmpl
+++ b/templates/repo/search.tmpl
@@ -24,7 +24,7 @@
{{else if .Keyword}}
- {{ctx.Locale.Tr "repo.search.results" (.Keyword|Escape) (.RepoLink|Escape) (.RepoName|Escape) | Str2html}}
+ {{ctx.Locale.Tr "repo.search.results" (.Keyword|Escape) (.RepoLink|Escape) (.RepoName|Escape)}}
{{if .SearchResults}}
diff --git a/templates/repo/settings/deploy_keys.tmpl b/templates/repo/settings/deploy_keys.tmpl
index 3ea854ef88..a79a196825 100644
--- a/templates/repo/settings/deploy_keys.tmpl
+++ b/templates/repo/settings/deploy_keys.tmpl
@@ -31,7 +31,7 @@
{{ctx.Locale.Tr "repo.settings.is_writable"}}
- {{ctx.Locale.Tr "repo.settings.is_writable_info" | Str2html}}
+ {{ctx.Locale.Tr "repo.settings.is_writable_info"}}
diff --git a/templates/repo/settings/githooks.tmpl b/templates/repo/settings/githooks.tmpl
index 389d381f30..bdbfb40ca1 100644
--- a/templates/repo/settings/githooks.tmpl
+++ b/templates/repo/settings/githooks.tmpl
@@ -6,7 +6,7 @@
- {{ctx.Locale.Tr "repo.settings.githooks_desc" | Str2html}}
+ {{ctx.Locale.Tr "repo.settings.githooks_desc"}}
{{range .Hooks}}
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl
index 7122778f06..6d01b227ff 100644
--- a/templates/repo/settings/options.tmpl
+++ b/templates/repo/settings/options.tmpl
@@ -191,7 +191,7 @@
{{ctx.Locale.Tr "repo.mirror_lfs_endpoint"}}
-
{{ctx.Locale.Tr "repo.mirror_lfs_endpoint_desc" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | Str2html}}
+
{{ctx.Locale.Tr "repo.mirror_lfs_endpoint_desc" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery"}}
{{end}}
@@ -409,7 +409,7 @@
{{ctx.Locale.Tr "repo.settings.tracker_url_format"}}
-
{{ctx.Locale.Tr "repo.settings.tracker_url_format_desc" | Str2html}}
+
{{ctx.Locale.Tr "repo.settings.tracker_url_format_desc"}}
{{ctx.Locale.Tr "repo.settings.tracker_issue_style"}}
@@ -437,7 +437,7 @@
{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern"}}
-
{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern_desc" | Str2html}}
+
{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern_desc"}}
diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl
index e2f841f758..e57509abc0 100644
--- a/templates/repo/settings/protected_branch.tmpl
+++ b/templates/repo/settings/protected_branch.tmpl
@@ -2,7 +2,7 @@