Commit 0095d5a
Eric Bower
·
2023-08-07 10:28:46 -0400 EDT
parent fae1d37
cleanup
3 files changed,
+6,
-8
+0,
-2
| ... | ... | @@ -5,12 +5,10 @@ repos: | |
| 5 | 5 | - main | |
| 6 | 6 | - v1.0.0 | |
| 7 | 7 | desc: pico services - prose.sh, lists.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh | |
| 8 | - | hide_tree_last_commit: true | |
| 9 | 8 | - path: /home/erock/dev/pico/pico-ops | |
| 10 | 9 | refs: | |
| 11 | 10 | - main | |
| 12 | 11 | desc: infra for pico services | |
| 13 | - | hide_tree_last_commit: true | |
| 14 | 12 | - path: /home/erock/dev/app-ui | |
| 15 | 13 | refs: | |
| 16 | 14 | - main |
+1,
-2
| ... | ... | @@ -4,7 +4,6 @@ | |
| 4 | 4 | {{define "content"}} | |
| 5 | 5 | {{template "header" .}} | |
| 6 | 6 | ||
| 7 | - | <h1>{{.Name}}</h1> | |
| 8 | - | ||
| 7 | + | <h1 class="text-lg">{{.Data.Path}}</h1> | |
| 9 | 8 | {{.Data.Contents}} | |
| 10 | 9 | {{end }} |
M
main.go
+5,
-4
| ... | ... | @@ -116,7 +116,7 @@ type DiffRenderFile struct { | |
| 116 | 116 | ||
| 117 | 117 | type FileData struct { | |
| 118 | 118 | Contents template.HTML | |
| 119 | - | Name string | |
| 119 | + | Path string | |
| 120 | 120 | } | |
| 121 | 121 | ||
| 122 | 122 | type RefInfo struct { |
| ... | ... | @@ -327,13 +327,14 @@ func writeHTMLTreeFiles(data *PageData) string { | |
| 327 | 327 | ||
| 328 | 328 | file.IsTextFile = shared.IsTextFile(str) | |
| 329 | 329 | ||
| 330 | + | contents := "binary file, cannot display" | |
| 330 | 331 | if file.IsTextFile { | |
| 331 | 332 | file.NumLines = len(strings.Split(str, "\n")) | |
| 333 | + | contents, err = pastes.ParseText(file.Entry.Name(), string(b)) | |
| 334 | + | bail(err) | |
| 332 | 335 | } | |
| 333 | 336 | ||
| 334 | 337 | d := filepath.Dir(file.Path) | |
| 335 | - | contents, err := pastes.ParseText(file.Entry.Name(), string(b)) | |
| 336 | - | bail(err) | |
| 337 | 338 | ||
| 338 | 339 | nameLower := strings.ToLower(file.Entry.Name()) | |
| 339 | 340 | summary := readmeFile(data.Repo) |
| ... | ... | @@ -346,7 +347,7 @@ func writeHTMLTreeFiles(data *PageData) string { | |
| 346 | 347 | Template: "./html/file.page.tmpl", | |
| 347 | 348 | Data: &FileData{ | |
| 348 | 349 | Contents: template.HTML(contents), | |
| 349 | - | Name: file.Entry.Name(), | |
| 350 | + | Path: file.Path, | |
| 350 | 351 | }, | |
| 351 | 352 | RepoName: data.Repo.Name, | |
| 352 | 353 | Subdir: filepath.Join("tree", data.RevName, "item", d), |