summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-09-16 20:43:19 -0600
committertjpcc <tjp@ctrl-c.club>2023-09-16 20:43:19 -0600
commit90fa2795ad177b9add2fe46382576993e96ece4b (patch)
tree0e2847f8694fa66a914680329c4515101b5a45ab /templates
Initial commit
Gemini repository browsing
Diffstat (limited to 'templates')
-rw-r--r--templates/branch_list.gmi7
-rw-r--r--templates/diff.gmi1
-rw-r--r--templates/diffstat.gmi1
-rw-r--r--templates/ref.gmi49
-rw-r--r--templates/repo_home.gmi28
-rw-r--r--templates/repo_root.gmi5
-rw-r--r--templates/tag_list.gmi7
-rw-r--r--templates/tree.gmi6
8 files changed, 104 insertions, 0 deletions
diff --git a/templates/branch_list.gmi b/templates/branch_list.gmi
new file mode 100644
index 0000000..2a2e99e
--- /dev/null
+++ b/templates/branch_list.gmi
@@ -0,0 +1,7 @@
+# {{.Repo.Name}} Branches βŒ₯
+
+{{ range .Repo.Refs .Ctx -}}
+{{ if .IsBranch -}}
+=> ./refs/{{.Hash}}/ {{.ShortName}}
+{{ end -}}
+{{ end -}}
diff --git a/templates/diff.gmi b/templates/diff.gmi
new file mode 100644
index 0000000..f2b795b
--- /dev/null
+++ b/templates/diff.gmi
@@ -0,0 +1 @@
+{{.Repo.Diff .Ctx .Params.fromref .Params.toref}}
diff --git a/templates/diffstat.gmi b/templates/diffstat.gmi
new file mode 100644
index 0000000..a51e06b
--- /dev/null
+++ b/templates/diffstat.gmi
@@ -0,0 +1 @@
+{{.Repo.Diffstat .Ctx .Params.fromref .Params.toref}}
diff --git a/templates/ref.gmi b/templates/ref.gmi
new file mode 100644
index 0000000..e185ef1
--- /dev/null
+++ b/templates/ref.gmi
@@ -0,0 +1,49 @@
+# {{.Repo.Name}} {{slice .Params.ref 0 8}}
+
+{{ with .Repo.Commit .Ctx .Params.ref -}}
+## {{.ShortMessage}}
+
+{{ with .RestOfMessage -}}
+{{ if ne . "" -}}
+{{.}}
+
+{{ end -}}
+{{ end -}}
+=> ../../ πŸ—‚οΈ Repository
+=> ./tree/ πŸ“„ Files
+{{ if ne .Parents nil -}}
+=> ../../diff/{{.Hash}}^/{{.Hash}} πŸ”© Full Diff
+{{ else -}}
+=> ../../diff/4b825dc642cb6eb9a060e54bf8d69288fbee4904/{{.Hash}} πŸ”© Full Diff
+{{ end -}}
+{{ range .Parents -}}
+=> ../{{.}}/ πŸ‘€ Parent {{slice . 0 8}}
+{{ end -}}
+{{ range .Repo.Refs $.Ctx -}}
+{{ if .IsTag -}}
+{{ if eq $.Params.ref .Hash -}}
+=> ../{{.Hash}}/ 🏷️ {{.ShortName}}
+{{ end -}}
+{{ end -}}
+{{ end }}
+
+### Authored
+=> mailto:{{.AuthorEmail}} {{.AuthorName}}
+{{.AuthorDate.Format "Mon Jan _2 15:04:05 MST 2006"}}
+
+### Committed
+=> mailto:{{.CommitterEmail}} {{.CommitterName}}
+{{.CommitDate.Format "Mon Jan _2 15:04:05 MST 2006"}}
+
+{{ if ne .Parents nil -}}
+{{ with index .Parents 0 -}}
+```diffstat
+{{$.Repo.Diffstat $.Ctx . $.Params.ref}}
+```
+{{ end -}}
+{{ else -}}
+```diffstat
+{{$.Repo.Diffstat $.Ctx "4b825dc642cb6eb9a060e54bf8d69288fbee4904" $.Params.ref}}
+```
+{{ end -}}
+{{ end -}}
diff --git a/templates/repo_home.gmi b/templates/repo_home.gmi
new file mode 100644
index 0000000..a2af514
--- /dev/null
+++ b/templates/repo_home.gmi
@@ -0,0 +1,28 @@
+# {{.Repo.Name}}
+
+{{.Repo.Description}}
+
+=> ./branches βŒ₯ Branches
+=> ./tags 🏷️Tags
+=> ./refs/HEAD/tree/ πŸ“„ Files
+
+## Latest Commits
+
+{{ with .Repo.Commits .Ctx "HEAD" 5 -}}
+{{ range . -}}
+=> ./refs/{{.Hash}}/ {{.ShortMessage}}
+{{ end -}}
+{{ if len . | eq 0 -}}
+(no commits to show)
+{{ end -}}
+{{ end }}
+
+{{ with .Repo.Readme .Ctx "HEAD" -}}
+{{ if len .RawContents | ne 0 -}}
+## {{.Filename}}
+
+```{{.Filename}} contents
+{{.EscapedContents}}
+```
+{{ end -}}
+{{ end }}
diff --git a/templates/repo_root.gmi b/templates/repo_root.gmi
new file mode 100644
index 0000000..68b230b
--- /dev/null
+++ b/templates/repo_root.gmi
@@ -0,0 +1,5 @@
+# Repositories
+
+{{ range . -}}
+=> ./{{.}}/ {{.}}
+{{ end }}
diff --git a/templates/tag_list.gmi b/templates/tag_list.gmi
new file mode 100644
index 0000000..2fc0fe2
--- /dev/null
+++ b/templates/tag_list.gmi
@@ -0,0 +1,7 @@
+# {{.Repo.Name}} Tags 🏷️
+
+{{ range .Repo.Refs .Ctx -}}
+{{ if .IsTag -}}
+=> ./refs/{{.Hash}}/ {{.ShortName}}
+{{ end -}}
+{{ end -}}
diff --git a/templates/tree.gmi b/templates/tree.gmi
new file mode 100644
index 0000000..35d0d02
--- /dev/null
+++ b/templates/tree.gmi
@@ -0,0 +1,6 @@
+# {{.Params.ref}}:{{ if ne .Params.path "" }}{{.Params.path}}{{ else }}/{{ end }}
+
+=> ../ {{ if ne .Params.path "" }}../{{ else }}Commit{{ end }}
+{{ range .Repo.Tree .Ctx .Params.ref .Params.path -}}
+=> ./{{.Path}}{{if eq .Type "tree"}}/{{end}} {{if eq .Type "blob"}}πŸ“„{{else if eq .Type "tree"}}πŸ“‚{{end}} {{.Path}}
+{{ end -}}