- commit
- 32c5e95
- parent
- 8573635
- author
- Eric Bower
- date
- 2025-08-10 09:41:11 -0400 EDT
fix: ensure readme is in root for summary page
2 files changed,
+12,
-15
1@@ -1,5 +1,5 @@
2 {{define "footer"}}
3 <div>
4- built with <a href="https://erock-git-pgit.pgs.sh">pgit</a> and published with <a href="https://pgs.sh">pgs.sh</a>
5+ built with <a href="https://pgit.pico.sh">pgit</a>
6 </div>
7 {{end}}
M
main.go
+11,
-14
1@@ -25,8 +25,11 @@ import (
2 git "github.com/gogs/git-module"
3 )
4
5-//go:embed html/*.tmpl static/*
6-var efs embed.FS
7+//go:embed html/*.tmpl
8+var embedFS embed.FS
9+
10+//go:embed static/*
11+var staticFS embed.FS
12
13 type Config struct {
14 // required params
15@@ -308,7 +311,7 @@ func readmeFile(repo *Config) string {
16
17 func (c *Config) writeHtml(writeData *WriteData) {
18 ts, err := template.ParseFS(
19- efs,
20+ embedFS,
21 writeData.Template,
22 "html/header.partial.tmpl",
23 "html/footer.partial.tmpl",
24@@ -331,7 +334,7 @@ func (c *Config) writeHtml(writeData *WriteData) {
25 }
26
27 func (c *Config) copyStatic(dir string) error {
28- entries, err := efs.ReadDir(dir)
29+ entries, err := staticFS.ReadDir(dir)
30 bail(err)
31
32 for _, e := range entries {
33@@ -340,7 +343,7 @@ func (c *Config) copyStatic(dir string) error {
34 continue
35 }
36
37- w, err := efs.ReadFile(infp)
38+ w, err := staticFS.ReadFile(infp)
39 bail(err)
40 fp := filepath.Join(c.Outdir, e.Name())
41 c.Logger.Info("writing", "filepath", fp)
42@@ -421,7 +424,7 @@ func (c *Config) writeHTMLTreeFile(pageData *PageData, treeItem *TreeItem) strin
43
44 nameLower := strings.ToLower(treeItem.Entry.Name())
45 summary := readmeFile(pageData.Repo)
46- if nameLower == summary {
47+ if d == "." && nameLower == summary {
48 readme = contents
49 }
50
51@@ -454,13 +457,7 @@ func (c *Config) writeLogDiff(repo *git.Repository, pageData *PageData, commit *
52 c.Mutex.Unlock()
53 }
54
55- diff, err := repo.Diff(
56- commitID,
57- 0,
58- 0,
59- 0,
60- git.DiffOptions{},
61- )
62+ diff, err := repo.Diff(commitID, 0, 0, 0, git.DiffOptions{})
63 bail(err)
64
65 rnd := &DiffRender{
66@@ -1022,7 +1019,7 @@ func (c *Config) writeRevision(repo *git.Repository, pageData *PageData, refs []
67 wg.Wait()
68
69 c.Logger.Info(
70- "compilation complete branch",
71+ "compilation complete",
72 "repoName", c.RepoName,
73 "revision", pageData.RevData.Name(),
74 )