レポジトリーはテーブル化

このコミットが含まれているのは:
守矢諏訪子 2023-06-06 21:32:02 +09:00
コミット 48551ec762
3個のファイルの変更42行の追加15行の削除

ファイルの表示

@ -38,6 +38,8 @@ type Repo struct {
type RepoFiles struct {
Name string
Path string
Commit string
Date string
Type string
Username string
Reponame string
@ -120,9 +122,15 @@ func HandleRepo(c *fiber.Ctx) error {
} else {
FileType = "file"
}
tstring := strings.ReplaceAll(el.ChildAttr("relative-time", "datetime"), "T", "、")
tstring = strings.Split(tstring, "+")[0]
tstrings := strings.Split(tstring, "-")
tstring = tstrings[0] + "-" + tstrings[1] + "-" + tstrings[2]
repoFilesArray = append(repoFilesArray, RepoFiles{
Name: el.ChildText("div.flex-auto span.d-block a.js-navigation-open"),
Path: el.ChildText("div.flex-auto span.d-block a.js-navigation-open"),
Commit: el.ChildText("div.flex-auto span.d-block a.Link--secondary"),
Date: tstring,
Type: FileType,
Username: Scrape.Username,
Reponame: Scrape.Reponame,

ファイルの表示

@ -5,6 +5,7 @@
--background-darker: #2f1b2e;
--accent: #00b7c3;
--yellow: #8B8000;
--repo-hover: #b762b7;
color-scheme: dark;
}
@ -190,6 +191,10 @@ a:hover {
margin-top: 0;
}
.file-table {
width: 100%;
}
.social-links {
display: flex;
flex-direction: column;
@ -255,6 +260,10 @@ a:hover {
list-style-type: none;
}
.file-u-list:hover {
background-color: var(--repo-hover);
}
/* URI: /file/:user/:repo/:file */
.user-readme pre {
padding: 8px;

ファイルの表示

@ -42,21 +42,31 @@
{{end}} {{ if .files}}
<div class="user-readme">
<h3>Files</h3>
<div class="user-readme-text">
<ul class="file-u-list">
{{ range $key, $value := .files}} {{ if eq .Type "dir" }}
<li class="file-list">
📁
<a href="/{{.Username}}/{{.Reponame}}/tree/{{.DefaultBranch}}/{{.Path}}" class="filesA">{{.Path}}</a>
</li>
{{ else }}
<li class="file-list">
🗒️
<a href="/{{.Username}}/{{.Reponame}}/blob/{{.DefaultBranch}}/{{.Path}}">{{.Path}}</a>
</li>
{{ end }} {{ end }}
</ul>
</div>
<table class="user-readme-text file-table">
<tbody>
{{ range $key, $value := .files}}
<tr class="file-u-list">
{{ if eq .Type "dir" }}
<td class="file-list">
📁
<a href="/{{.Username}}/{{.Reponame}}/tree/{{.DefaultBranch}}/{{.Path}}" class="filesA">{{.Path}}</a>
</td>
{{ else }}
<td class="file-list">
🗒️
<a href="/{{.Username}}/{{.Reponame}}/blob/{{.DefaultBranch}}/{{.Path}}">{{.Path}}</a>
</td>
{{ end }}
<td class="file-list">
{{.Commit}}
</td>
<td class="file-list" style="text-align: right;">
{{.Date}}
</td>
</tr>
{{ end }}
</tbody>
</table>
</div>
{{ end }} {{ if .readme}}
<div class="user-readme">