Lindenii Project Forge
Commit info | |
---|---|
ID | 9b20ef637095413a8e7bde6701b8ad2379b4e7aa |
Author | Runxi Yu<me@runxiyu.org> |
Author date | Thu, 13 Feb 2025 12:06:36 +0800 |
Committer | Runxi Yu<me@runxiyu.org> |
Committer date | Thu, 13 Feb 2025 12:06:36 +0800 |
Actions | Get patch |
repo_*_{dir,file}: Add ref params if not head
{{- define "repo_raw_dir" -}} <!DOCTYPE html> <html lang="en"> <head> {{ template "head_common" . }} <title>{{ .group_name }}/repos/{{ .repo_name }}/{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} – Lindenii Forge</title> </head> <body class="repo-raw-dir"> {{ template "header" . }} <div class="padding-wrapper scroll"> <table id="file-tree" class="wide"> <thead> <tr class="title-row"> <th colspan="3"> (Raw) /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }}{{ if .ref }} on {{ .ref }}{{ end }} </th> </tr> </thead> <tbody> {{- $path_spec := .path_spec }}
{{- $ref := .ref }} {{- $ref_type := .ref_type }}
{{- range .files }} <tr> <td class="file-mode">{{ .Mode }}</td>
<td class="file-name"><a href="{{ .Name }}{{ if not .Is_file }}/{{ end }}">{{ .Name }}</a>{{ if not .Is_file }}/{{ end }}</td>
<td class="file-name"><a href="{{ .Name }}{{ if not .Is_file }}/{{ end }}{{ if $ref }}?{{ $ref_type }}={{ $ref }}{{ end }}">{{ .Name }}</a>{{ if not .Is_file }}/{{ end }}</td>
<td class="file-size">{{ .Size }}</td> </tr> {{- end }} </tbody> </table> </div> <div class="padding-wrapper"> <div id="refs"> </div> </div> <footer> {{ template "footer" . }} </footer> </body> </html> {{- end -}}
{{- define "repo_tree_dir" -}} <!DOCTYPE html> <html lang="en"> <head> {{ template "head_common" . }} <title>{{ .group_name }}/repos/{{ .repo_name }}/{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} – Lindenii Forge</title> </head> <body class="repo-tree-dir"> {{ template "header" . }} <div class="padding-wrapper scroll"> <table id="file-tree" class="wide"> <thead> <tr class="title-row"> <th colspan="3"> /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }}{{ if .ref }} on {{ .ref }}{{ end }} </th> </tr> </thead> <tbody> {{- $path_spec := .path_spec }}
{{- $ref := .ref }} {{- $ref_type := .ref_type }}
{{- range .files }} <tr> <td class="file-mode">{{ .Mode }}</td>
<td class="file-name"><a href="{{ .Name }}{{ if not .Is_file }}/{{ end }}">{{ .Name }}</a>{{ if not .Is_file }}/{{ end }}</td>
<td class="file-name"><a href="{{ .Name }}{{ if not .Is_file }}/{{ end }}{{ if $ref }}?{{ $ref_type }}={{ $ref }}{{ end }}">{{ .Name }}</a>{{ if not .Is_file }}/{{ end }}</td>
<td class="file-size">{{ .Size }}</td> </tr> {{- end }} </tbody> </table> </div> <div class="padding-wrapper"> <div id="refs"> </div> </div> <div class="padding-wrapper"> {{ if .readme }} <table class="wide"> <thead> <tr class="title-row"> <th>{{ .readme_filename }}</th> </tr> </thead> <tbody> <tr> <td id="readme"> {{ .readme -}} </td> </tr> </tbody> </table> {{ end }} </div> <footer> {{ template "footer" . }} </footer> </body> </html> {{- end -}}
{{- define "repo_tree_file" -}} <!DOCTYPE html> <html lang="en"> <head> {{ template "head_common" . }} <link rel="stylesheet" href="/:/static/chroma.css" /> <title>{{ .group_name }}/repos/{{ .repo_name }}/{{ .path_spec }} – Lindenii Forge</title> </head> <body class="repo-tree-file"> {{ template "header" . }} <div class="padding"> <p>
/{{ .path_spec }} (<a href="/{{ .group_name }}/:/repos/{{ .repo_name }}/raw/{{ .path_spec }}{{ if not (eq .ref_type "head") }}?{{ .ref_type }}={{ .ref }}{{ end }}">raw</a>)
/{{ .path_spec }} (<a href="/{{ .group_name }}/:/repos/{{ .repo_name }}/raw/{{ .path_spec }}{{ if .ref }}?{{ .ref_type }}={{ .ref }}{{ end }}">raw</a>)
</p> {{ .file_contents }} </div> <footer> {{ template "footer" . }} </footer> </body> </html> {{- end -}}