repos / pgit

static site generator for git
git clone https://github.com/picosh/pgit.git

commit
0095d5a
parent
fae1d37
author
Eric Bower
date
2023-08-07 14:28:46 +0000 UTC
cleanup
3 files changed,  +6, -8
M config.yaml
+0, -2
 1@@ -5,12 +5,10 @@ repos:
 2       - main
 3       - v1.0.0
 4     desc: pico services - prose.sh, lists.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
 5-    hide_tree_last_commit: true
 6   - path: /home/erock/dev/pico/pico-ops
 7     refs:
 8       - main
 9     desc: infra for pico services
10-    hide_tree_last_commit: true
11   - path: /home/erock/dev/app-ui
12     refs:
13       - main
M html/file.page.tmpl
+1, -2
1@@ -4,7 +4,6 @@
2 {{define "content"}}
3   {{template "header" .}}
4 
5-  <h1>{{.Name}}</h1>
6-
7+  <h1 class="text-lg">{{.Data.Path}}</h1>
8   {{.Data.Contents}}
9 {{end }}
M main.go
+5, -4
 1@@ -116,7 +116,7 @@ type DiffRenderFile struct {
 2 
 3 type FileData struct {
 4 	Contents template.HTML
 5-	Name     string
 6+	Path     string
 7 }
 8 
 9 type RefInfo struct {
10@@ -327,13 +327,14 @@ func writeHTMLTreeFiles(data *PageData) string {
11 
12 		file.IsTextFile = shared.IsTextFile(str)
13 
14+		contents := "binary file, cannot display"
15 		if file.IsTextFile {
16 			file.NumLines = len(strings.Split(str, "\n"))
17+			contents, err = pastes.ParseText(file.Entry.Name(), string(b))
18+			bail(err)
19 		}
20 
21 		d := filepath.Dir(file.Path)
22-		contents, err := pastes.ParseText(file.Entry.Name(), string(b))
23-		bail(err)
24 
25 		nameLower := strings.ToLower(file.Entry.Name())
26 		summary := readmeFile(data.Repo)
27@@ -346,7 +347,7 @@ func writeHTMLTreeFiles(data *PageData) string {
28 			Template: "./html/file.page.tmpl",
29 			Data: &FileData{
30 				Contents: template.HTML(contents),
31-				Name:     file.Entry.Name(),
32+				Path:     file.Path,
33 			},
34 			RepoName: data.Repo.Name,
35 			Subdir:   filepath.Join("tree", data.RevName, "item", d),