summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2023-05-22 04:57:49 +0200
committerGitHub <noreply@github.com>2023-05-22 10:57:49 +0800
commitcdb088cec288a20e14240f86a689dd14f4cd603b (patch)
tree0a491ea8dcffa22b5b1033d04f5402425fbeb73c /templates
parentec2a01d1e20c0d33c1ea7e362a7dfd5b653dd15f (diff)
downloadgitea-cdb088cec288a20e14240f86a689dd14f4cd603b.tar.gz
gitea-cdb088cec288a20e14240f86a689dd14f4cd603b.zip
Add CRAN package registry (#22331)
This PR adds a [CRAN](https://cran.r-project.org/) package registry. ![grafik](https://user-images.githubusercontent.com/1666336/210450039-d6fa6f77-20cd-4741-89a8-1624def267f7.png)
Diffstat (limited to 'templates')
-rw-r--r--templates/package/content/cran.tmpl59
-rw-r--r--templates/package/metadata/cran.tmpl5
-rw-r--r--templates/package/view.tmpl2
-rw-r--r--templates/swagger/v1_json.tmpl1
4 files changed, 67 insertions, 0 deletions
diff --git a/templates/package/content/cran.tmpl b/templates/package/content/cran.tmpl
new file mode 100644
index 0000000000..dcabdbce93
--- /dev/null
+++ b/templates/package/content/cran.tmpl
@@ -0,0 +1,59 @@
+{{if eq .PackageDescriptor.Package.Type "cran"}}
+ <h4 class="ui top attached header">{{.locale.Tr "packages.installation"}}</h4>
+ <div class="ui attached segment">
+ <div class="ui form">
+ <div class="field">
+ <label>{{svg "octicon-code"}} {{.locale.Tr "packages.cran.registry" | Safe}}</label>
+ <div class="markup"><pre class="code-block"><code>options("repos" = c(getOption("repos"), c(gitea="<gitea-origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/cran"></gitea-origin-url>")))</code></pre></div>
+ </div>
+ <div class="field">
+ <label>{{svg "octicon-terminal"}} {{.locale.Tr "packages.cran.install"}}</label>
+ <div class="markup"><pre class="code-block"><code>install.packages("{{.PackageDescriptor.Package.Name}}")</code></pre></div>
+ </div>
+ <div class="field">
+ <label>{{.locale.Tr "packages.cran.documentation" | Safe}}</label>
+ </div>
+ </div>
+ </div>
+
+ {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Title}}
+ <h4 class="ui top attached header">{{.locale.Tr "packages.about"}}</h4>
+ <div class="ui attached segment">
+ {{if .PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Title}}{{else}}{{end}}
+ </div>
+ {{end}}
+
+ {{if or .PackageDescriptor.Metadata.Imports .PackageDescriptor.Metadata.Depends .PackageDescriptor.Metadata.LinkingTo .PackageDescriptor.Metadata.Suggests}}
+ <h4 class="ui top attached header">{{.locale.Tr "packages.dependencies"}}</h4>
+ <div class="ui attached segment">
+ <table class="ui single line very basic table">
+ <tbody>
+ {{if .PackageDescriptor.Metadata.Imports}}
+ <tr>
+ <td>Imports</td>
+ <td>{{StringUtils.Join .PackageDescriptor.Metadata.Imports ", "}}</td>
+ </tr>
+ {{end}}
+ {{if .PackageDescriptor.Metadata.Depends}}
+ <tr>
+ <td>Depends</td>
+ <td>{{StringUtils.Join .PackageDescriptor.Metadata.Depends ", "}}</td>
+ </tr>
+ {{end}}
+ {{if .PackageDescriptor.Metadata.LinkingTo}}
+ <tr>
+ <td>LinkingTo</td>
+ <td>{{StringUtils.Join .PackageDescriptor.Metadata.LinkingTo ", "}}</td>
+ </tr>
+ {{end}}
+ {{if .PackageDescriptor.Metadata.Suggests}}
+ <tr>
+ <td>Suggests</td>
+ <td>{{StringUtils.Join .PackageDescriptor.Metadata.Suggests ", "}}</td>
+ </tr>
+ {{end}}
+ </tbody>
+ </table>
+ </div>
+ {{end}}
+{{end}}
diff --git a/templates/package/metadata/cran.tmpl b/templates/package/metadata/cran.tmpl
new file mode 100644
index 0000000000..7b113ec797
--- /dev/null
+++ b/templates/package/metadata/cran.tmpl
@@ -0,0 +1,5 @@
+{{if eq .PackageDescriptor.Package.Type "cran"}}
+ {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{.locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "mr-3"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}}
+ {{range .PackageDescriptor.Metadata.Authors}}<div class="item" title="{{$.locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "mr-3"}} {{.}}</div>{{end}}
+ {{range .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "mr-3"}} <a href="{{.}}" target="_blank" rel="noopener noreferrer me">{{$.locale.Tr "packages.details.project_site"}}</a></div>{{end}}
+{{end}}
diff --git a/templates/package/view.tmpl b/templates/package/view.tmpl
index 5285a0838d..aadaaa412a 100644
--- a/templates/package/view.tmpl
+++ b/templates/package/view.tmpl
@@ -26,6 +26,7 @@
{{template "package/content/conan" .}}
{{template "package/content/conda" .}}
{{template "package/content/container" .}}
+ {{template "package/content/cran" .}}
{{template "package/content/debian" .}}
{{template "package/content/generic" .}}
{{template "package/content/go" .}}
@@ -57,6 +58,7 @@
{{template "package/metadata/conan" .}}
{{template "package/metadata/conda" .}}
{{template "package/metadata/container" .}}
+ {{template "package/metadata/cran" .}}
{{template "package/metadata/debian" .}}
{{template "package/metadata/generic" .}}
{{template "package/metadata/helm" .}}
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl
index 3859eb5567..3c56fc9efb 100644
--- a/templates/swagger/v1_json.tmpl
+++ b/templates/swagger/v1_json.tmpl
@@ -2416,6 +2416,7 @@
"conan",
"conda",
"container",
+ "cran",
"debian",
"generic",
"go",