diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-11-05 14:04:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-05 14:04:26 +0800 |
commit | 4a469c8e1b3c1d153316aec9fd8cbdd3e1dd54e8 (patch) | |
tree | 3fc7eae5668299c7dbd5933cd14839bbccacefdd /templates/package | |
parent | b068dbd40ee3b4dc7d18cdcf168f0c24cea234c0 (diff) | |
download | gitea-4a469c8e1b3c1d153316aec9fd8cbdd3e1dd54e8.tar.gz gitea-4a469c8e1b3c1d153316aec9fd8cbdd3e1dd54e8.zip |
Refactor template ctx and render utils (#32422)
Clean up the templates
Diffstat (limited to 'templates/package')
-rw-r--r-- | templates/package/content/cargo.tmpl | 2 | ||||
-rw-r--r-- | templates/package/content/chef.tmpl | 2 | ||||
-rw-r--r-- | templates/package/content/composer.tmpl | 2 | ||||
-rw-r--r-- | templates/package/content/npm.tmpl | 2 | ||||
-rw-r--r-- | templates/package/content/nuget.tmpl | 6 | ||||
-rw-r--r-- | templates/package/content/pub.tmpl | 2 | ||||
-rw-r--r-- | templates/package/content/pypi.tmpl | 4 |
7 files changed, 10 insertions, 10 deletions
diff --git a/templates/package/content/cargo.tmpl b/templates/package/content/cargo.tmpl index 7fd88a284a..8b51074af4 100644 --- a/templates/package/content/cargo.tmpl +++ b/templates/package/content/cargo.tmpl @@ -27,7 +27,7 @@ git-fetch-with-cli = true</code></pre></div> {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Readme}} <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div>{{end}} - {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment">{{ctx.RenderUtils.MarkdownToHtml .PackageDescriptor.Metadata.Readme}}</div>{{end}} {{end}} {{if .PackageDescriptor.Metadata.Dependencies}} diff --git a/templates/package/content/chef.tmpl b/templates/package/content/chef.tmpl index 03ce9f852b..b3713808f6 100644 --- a/templates/package/content/chef.tmpl +++ b/templates/package/content/chef.tmpl @@ -20,7 +20,7 @@ <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> <div class="ui attached segment"> {{if .PackageDescriptor.Metadata.Description}}<p>{{.PackageDescriptor.Metadata.Description}}</p>{{end}} - {{if .PackageDescriptor.Metadata.LongDescription}}{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.LongDescription}}{{end}} + {{if .PackageDescriptor.Metadata.LongDescription}}{{ctx.RenderUtils.MarkdownToHtml .PackageDescriptor.Metadata.LongDescription}}{{end}} </div> {{end}} diff --git a/templates/package/content/composer.tmpl b/templates/package/content/composer.tmpl index 8d48e6c95d..4569820869 100644 --- a/templates/package/content/composer.tmpl +++ b/templates/package/content/composer.tmpl @@ -25,7 +25,7 @@ {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Comments}} <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div>{{end}} - {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment markup markdown">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment markup markdown">{{ctx.RenderUtils.MarkdownToHtml .PackageDescriptor.Metadata.Readme}}</div>{{end}} {{if .PackageDescriptor.Metadata.Comments}}<div class="ui attached segment">{{StringUtils.Join .PackageDescriptor.Metadata.Comments " "}}</div>{{end}} {{end}} diff --git a/templates/package/content/npm.tmpl b/templates/package/content/npm.tmpl index 01298a664c..bb024348d0 100644 --- a/templates/package/content/npm.tmpl +++ b/templates/package/content/npm.tmpl @@ -25,7 +25,7 @@ <div class="ui attached segment"> {{if .PackageDescriptor.Metadata.Readme}} <div class="markup markdown"> - {{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}} + {{ctx.RenderUtils.MarkdownToHtml .PackageDescriptor.Metadata.Readme}} </div> {{else if .PackageDescriptor.Metadata.Description}} {{.PackageDescriptor.Metadata.Description}} diff --git a/templates/package/content/nuget.tmpl b/templates/package/content/nuget.tmpl index f1fe420c0b..5bb98a86dd 100644 --- a/templates/package/content/nuget.tmpl +++ b/templates/package/content/nuget.tmpl @@ -18,9 +18,9 @@ {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.ReleaseNotes .PackageDescriptor.Metadata.Readme}} <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> - {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Description}}</div>{{end}} - {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment markup markdown">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} - {{if .PackageDescriptor.Metadata.ReleaseNotes}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.ReleaseNotes}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{ctx.RenderUtils.MarkdownToHtml .PackageDescriptor.Metadata.Description}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment markup markdown">{{ctx.RenderUtils.MarkdownToHtml .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ReleaseNotes}}<div class="ui attached segment">{{ctx.RenderUtils.MarkdownToHtml .PackageDescriptor.Metadata.ReleaseNotes}}</div>{{end}} {{end}} {{if .PackageDescriptor.Metadata.Dependencies}} diff --git a/templates/package/content/pub.tmpl b/templates/package/content/pub.tmpl index f2c7ac938f..2f63cde3a6 100644 --- a/templates/package/content/pub.tmpl +++ b/templates/package/content/pub.tmpl @@ -14,6 +14,6 @@ {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Readme}} <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div>{{end}} - {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment">{{ctx.RenderUtils.MarkdownToHtml .PackageDescriptor.Metadata.Readme}}</div>{{end}} {{end}} {{end}} diff --git a/templates/package/content/pypi.tmpl b/templates/package/content/pypi.tmpl index 817fced97b..2a22a6ed71 100644 --- a/templates/package/content/pypi.tmpl +++ b/templates/package/content/pypi.tmpl @@ -16,9 +16,9 @@ <div class="ui attached segment"> <p>{{if .PackageDescriptor.Metadata.Summary}}{{.PackageDescriptor.Metadata.Summary}}{{end}}</p> {{if .PackageDescriptor.Metadata.LongDescription}} - {{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.LongDescription}} + {{ctx.RenderUtils.MarkdownToHtml .PackageDescriptor.Metadata.LongDescription}} {{else if .PackageDescriptor.Metadata.Description}} - {{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Description}} + {{ctx.RenderUtils.MarkdownToHtml .PackageDescriptor.Metadata.Description}} {{end}} </div> {{end}} |