From f3f445862e0962b673b5e0d3d12b00c3f7001d85 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Sat, 16 Sep 2023 05:51:54 +0200 Subject: [PATCH] Use `print` instead of `printf` (#27093) A bit more performant when we only use it for appending strings. --- templates/explore/repo_search.tmpl | 2 +- templates/repo/commit_page.tmpl | 10 +++++----- templates/repo/commits_list.tmpl | 10 +++++----- templates/repo/commits_list_small.tmpl | 10 +++++----- templates/repo/create_helper.tmpl | 2 +- templates/repo/graph/commits.tmpl | 10 +++++----- templates/repo/home.tmpl | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/templates/explore/repo_search.tmpl b/templates/explore/repo_search.tmpl index c056662fb8..0731368e85 100644 --- a/templates/explore/repo_search.tmpl +++ b/templates/explore/repo_search.tmpl @@ -36,7 +36,7 @@ {{if and .PageIsExploreRepositories .OnlyShowRelevant}}
- {{.locale.Tr "explore.relevant_repositories" ((printf "%s%s" $.Link "?only_show_relevant=0")|Escape) | Safe}} + {{.locale.Tr "explore.relevant_repositories" ((print $.Link "?only_show_relevant=0")|Escape) | Safe}}
{{end}}
diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl index 612c0f94ca..8e56b43553 100644 --- a/templates/repo/commit_page.tmpl +++ b/templates/repo/commit_page.tmpl @@ -4,17 +4,17 @@
{{$class := ""}} {{if .Commit.Signature}} - {{$class = (printf "%s%s" $class " isSigned")}} + {{$class = (print $class " isSigned")}} {{if .Verification.Verified}} {{if eq .Verification.TrustStatus "trusted"}} - {{$class = (printf "%s%s" $class " isVerified")}} + {{$class = (print $class " isVerified")}} {{else if eq .Verification.TrustStatus "untrusted"}} - {{$class = (printf "%s%s" $class " isVerifiedUntrusted")}} + {{$class = (print $class " isVerifiedUntrusted")}} {{else}} - {{$class = (printf "%s%s" $class " isVerifiedUnmatched")}} + {{$class = (print $class " isVerifiedUnmatched")}} {{end}} {{else if .Verification.Warning}} - {{$class = (printf "%s%s" $class " isWarning")}} + {{$class = (print $class " isWarning")}} {{end}} {{end}}
diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index a06c425b73..7ecbc8f884 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -28,17 +28,17 @@ {{$class := "ui sha label"}} {{if .Signature}} - {{$class = (printf "%s%s" $class " isSigned")}} + {{$class = (print $class " isSigned")}} {{if .Verification.Verified}} {{if eq .Verification.TrustStatus "trusted"}} - {{$class = (printf "%s%s" $class " isVerified")}} + {{$class = (print $class " isVerified")}} {{else if eq .Verification.TrustStatus "untrusted"}} - {{$class = (printf "%s%s" $class " isVerifiedUntrusted")}} + {{$class = (print $class " isVerifiedUntrusted")}} {{else}} - {{$class = (printf "%s%s" $class " isVerifiedUnmatched")}} + {{$class = (print $class " isVerifiedUnmatched")}} {{end}} {{else if .Verification.Warning}} - {{$class = (printf "%s%s" $class " isWarning")}} + {{$class = (print $class " isWarning")}} {{end}} {{end}} {{$commitShaLink := ""}} diff --git a/templates/repo/commits_list_small.tmpl b/templates/repo/commits_list_small.tmpl index b5a7134294..645bd73bb8 100644 --- a/templates/repo/commits_list_small.tmpl +++ b/templates/repo/commits_list_small.tmpl @@ -17,17 +17,17 @@ {{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $.root}} {{$class := "ui sha label"}} {{if .Signature}} - {{$class = (printf "%s%s" $class " isSigned")}} + {{$class = (print $class " isSigned")}} {{if .Verification.Verified}} {{if eq .Verification.TrustStatus "trusted"}} - {{$class = (printf "%s%s" $class " isVerified")}} + {{$class = (print $class " isVerified")}} {{else if eq .Verification.TrustStatus "untrusted"}} - {{$class = (printf "%s%s" $class " isVerifiedUntrusted")}} + {{$class = (print $class " isVerifiedUntrusted")}} {{else}} - {{$class = (printf "%s%s" $class " isVerifiedUnmatched")}} + {{$class = (print $class " isVerifiedUnmatched")}} {{end}} {{else if .Verification.Warning}} - {{$class = (printf "%s%s" $class " isWarning")}} + {{$class = (print $class " isWarning")}} {{end}} {{end}} diff --git a/templates/repo/create_helper.tmpl b/templates/repo/create_helper.tmpl index ec253e961d..4b91cdf075 100644 --- a/templates/repo/create_helper.tmpl +++ b/templates/repo/create_helper.tmpl @@ -1,3 +1,3 @@ {{if not $.DisableMigrations}} -

{{.locale.Tr "repo.new_repo_helper" ((printf "%s%s" AppSubUrl "/repo/migrate")|Escape) | Safe}}

+

{{.locale.Tr "repo.new_repo_helper" ((print AppSubUrl "/repo/migrate")|Escape) | Safe}}

{{end}} diff --git a/templates/repo/graph/commits.tmpl b/templates/repo/graph/commits.tmpl index 58ede56579..b8817f5c88 100644 --- a/templates/repo/graph/commits.tmpl +++ b/templates/repo/graph/commits.tmpl @@ -8,17 +8,17 @@ {{$class := "ui sha label"}} {{if $commit.Commit.Signature}} - {{$class = (printf "%s%s" $class " isSigned")}} + {{$class = (print $class " isSigned")}} {{if $commit.Verification.Verified}} {{if eq $commit.Verification.TrustStatus "trusted"}} - {{$class = (printf "%s%s" $class " isVerified")}} + {{$class = (print $class " isVerified")}} {{else if eq $commit.Verification.TrustStatus "untrusted"}} - {{$class = (printf "%s%s" $class " isVerifiedUntrusted")}} + {{$class = (print $class " isVerifiedUntrusted")}} {{else}} - {{$class = (printf "%s%s" $class " isVerifiedUnmatched")}} + {{$class = (print $class " isVerifiedUnmatched")}} {{end}} {{else if $commit.Verification.Warning}} - {{$class = (printf "%s%s" $class " isWarning")}} + {{$class = (print $class " isWarning")}} {{end}} {{end}}
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 11dc47f555..616cb7a938 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -70,7 +70,7 @@ {{if ne .Repository.ID .BaseRepo.ID}} {{$cmpBranch = printf "%s/%s:" (.Repository.OwnerName|PathEscape) (.Repository.Name|PathEscape)}} {{end}} - {{$cmpBranch = printf "%s%s" $cmpBranch (.BranchName|PathEscapeSegments)}} + {{$cmpBranch = print $cmpBranch (.BranchName|PathEscapeSegments)}} {{$compareLink := printf "%s/compare/%s...%s" .BaseRepo.Link (.BaseRepo.DefaultBranch|PathEscapeSegments) $cmpBranch}}