Commit f0e0594
Eric Bower
·
2023-09-01 11:19:08 -0400 EDT
parent 8f24577
doc: update readme
+6,
-1
| ... | ... | @@ -1,6 +1,11 @@ | |
| 1 | 1 | # pgit | |
| 2 | 2 | ||
| 3 | - | A static site generator for git | |
| 3 | + | A static site generator for git. | |
| 4 | + | ||
| 5 | + | This golang binary will generate a commit log, files, and references based | |
| 6 | + | on a git repository and the provided revisions. | |
| 7 | + | ||
| 8 | + | It will only generate a commit log and files for the provided revisions. | |
| 4 | 9 | ||
| 5 | 10 | # usage | |
| 6 | 11 |
M
main.go
+20,
-20
| ... | ... | @@ -123,13 +123,13 @@ type TreeItem struct { | |
| 123 | 123 | Name string | |
| 124 | 124 | Path string | |
| 125 | 125 | URL template.URL | |
| 126 | - | CommitID string | |
| 126 | + | CommitID string | |
| 127 | 127 | CommitURL template.URL | |
| 128 | 128 | Summary string | |
| 129 | 129 | When string | |
| 130 | - | Author *git.Signature | |
| 130 | + | Author *git.Signature | |
| 131 | 131 | Entry *git.TreeEntry | |
| 132 | - | Crumbs []*Breadcrumb | |
| 132 | + | Crumbs []*Breadcrumb | |
| 133 | 133 | } | |
| 134 | 134 | ||
| 135 | 135 | type DiffRender struct { |
| ... | ... | @@ -193,7 +193,7 @@ type LogPageData struct { | |
| 193 | 193 | type FilePageData struct { | |
| 194 | 194 | *PageData | |
| 195 | 195 | Contents template.HTML | |
| 196 | - | Item *TreeItem | |
| 196 | + | Item *TreeItem | |
| 197 | 197 | } | |
| 198 | 198 | ||
| 199 | 199 | type CommitPageData struct { |
| ... | ... | @@ -421,7 +421,7 @@ func (c *Config) writeHTMLTreeFile(pageData *PageData, treeItem *TreeItem) strin | |
| 421 | 421 | Data: &FilePageData{ | |
| 422 | 422 | PageData: pageData, | |
| 423 | 423 | Contents: template.HTML(contents), | |
| 424 | - | Item: treeItem, | |
| 424 | + | Item: treeItem, | |
| 425 | 425 | }, | |
| 426 | 426 | Subdir: getFileURL(pageData.RevData, d), | |
| 427 | 427 | }) |
| ... | ... | @@ -684,8 +684,8 @@ func (c *Config) writeRepo() *BranchOutput { | |
| 684 | 684 | } | |
| 685 | 685 | ||
| 686 | 686 | type TreeRoot struct { | |
| 687 | - | Path string | |
| 688 | - | Items []*TreeItem | |
| 687 | + | Path string | |
| 688 | + | Items []*TreeItem | |
| 689 | 689 | Crumbs []*Breadcrumb | |
| 690 | 690 | } | |
| 691 | 691 |
| ... | ... | @@ -698,8 +698,8 @@ type TreeWalker struct { | |
| 698 | 698 | } | |
| 699 | 699 | ||
| 700 | 700 | type Breadcrumb struct { | |
| 701 | - | Text string | |
| 702 | - | URL template.URL | |
| 701 | + | Text string | |
| 702 | + | URL template.URL | |
| 703 | 703 | IsLast bool | |
| 704 | 704 | } | |
| 705 | 705 |
| ... | ... | @@ -716,8 +716,8 @@ func (tw *TreeWalker) calcBreadcrumbs(curpath string) []*Breadcrumb { | |
| 716 | 716 | ) | |
| 717 | 717 | ||
| 718 | 718 | crumbs := make([]*Breadcrumb, len(parts)+1) | |
| 719 | - | crumbs[0] = &Breadcrumb { | |
| 720 | - | URL: rootURL, | |
| 719 | + | crumbs[0] = &Breadcrumb{ | |
| 720 | + | URL: rootURL, | |
| 721 | 721 | Text: tw.PageData.Repo.RepoName, | |
| 722 | 722 | } | |
| 723 | 723 |
| ... | ... | @@ -725,9 +725,9 @@ func (tw *TreeWalker) calcBreadcrumbs(curpath string) []*Breadcrumb { | |
| 725 | 725 | for idx, d := range parts { | |
| 726 | 726 | crumbs[idx+1] = &Breadcrumb{ | |
| 727 | 727 | Text: d, | |
| 728 | - | URL: template.URL(filepath.Join(getFileBaseDir(tw.PageData.RevData), cur, d, "index.html")), | |
| 728 | + | URL: template.URL(filepath.Join(getFileBaseDir(tw.PageData.RevData), cur, d, "index.html")), | |
| 729 | 729 | } | |
| 730 | - | if idx == len(parts) - 1 { | |
| 730 | + | if idx == len(parts)-1 { | |
| 731 | 731 | crumbs[idx+1].IsLast = true | |
| 732 | 732 | } | |
| 733 | 733 | cur = filepath.Join(cur, d) |
| ... | ... | @@ -740,11 +740,11 @@ func (tw *TreeWalker) NewTreeItem(entry *git.TreeEntry, curpath string, crumbs [ | |
| 740 | 740 | typ := entry.Type() | |
| 741 | 741 | fname := filepath.Join(curpath, entry.Name()) | |
| 742 | 742 | item := &TreeItem{ | |
| 743 | - | Size: toPretty(entry.Size()), | |
| 744 | - | Name: entry.Name(), | |
| 745 | - | Path: fname, | |
| 746 | - | Entry: entry, | |
| 747 | - | URL: template.URL(getFileURL(tw.PageData.RevData, fname)), | |
| 743 | + | Size: toPretty(entry.Size()), | |
| 744 | + | Name: entry.Name(), | |
| 745 | + | Path: fname, | |
| 746 | + | Entry: entry, | |
| 747 | + | URL: template.URL(getFileURL(tw.PageData.RevData, fname)), | |
| 748 | 748 | Crumbs: crumbs, | |
| 749 | 749 | } | |
| 750 | 750 |