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:
55 - main
66 - v1.0.0
77 desc: pico services - prose.sh, lists.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
8- hide_tree_last_commit: true
98 - path: /home/erock/dev/pico/pico-ops
109 refs:
1110 - main
1211 desc: infra for pico services
13- hide_tree_last_commit: true
1412 - path: /home/erock/dev/app-ui
1513 refs:
1614 - main
+1, -2
......@@ -4,7 +4,6 @@
44 {{define "content"}}
55 {{template "header" .}}
66
7- <h1>{{.Name}}</h1>
8-
7+ <h1 class="text-lg">{{.Data.Path}}</h1>
98 {{.Data.Contents}}
109 {{end }}
+5, -4
......@@ -116,7 +116,7 @@ type DiffRenderFile struct {
116116
117117 type FileData struct {
118118 Contents template.HTML
119- Name string
119+ Path string
120120 }
121121
122122 type RefInfo struct {
......@@ -327,13 +327,14 @@ func writeHTMLTreeFiles(data *PageData) string {
327327
328328 file.IsTextFile = shared.IsTextFile(str)
329329
330+ contents := "binary file, cannot display"
330331 if file.IsTextFile {
331332 file.NumLines = len(strings.Split(str, "\n"))
333+ contents, err = pastes.ParseText(file.Entry.Name(), string(b))
334+ bail(err)
332335 }
333336
334337 d := filepath.Dir(file.Path)
335- contents, err := pastes.ParseText(file.Entry.Name(), string(b))
336- bail(err)
337338
338339 nameLower := strings.ToLower(file.Entry.Name())
339340 summary := readmeFile(data.Repo)
......@@ -346,7 +347,7 @@ func writeHTMLTreeFiles(data *PageData) string {
346347 Template: "./html/file.page.tmpl",
347348 Data: &FileData{
348349 Contents: template.HTML(contents),
349- Name: file.Entry.Name(),
350+ Path: file.Path,
350351 },
351352 RepoName: data.Repo.Name,
352353 Subdir: filepath.Join("tree", data.RevName, "item", d),