repos / pgit

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

commit
f0e0594
parent
8f24577
author
Eric Bower
date
2023-09-01 15:19:08 +0000 UTC
doc: update readme
2 files changed,  +26, -21
M README.md
+6, -1
 1@@ -1,6 +1,11 @@
 2 # pgit
 3 
 4-A static site generator for git
 5+A static site generator for git.
 6+
 7+This golang binary will generate a commit log, files, and references based
 8+on a git repository and the provided revisions.
 9+
10+It will only generate a commit log and files for the provided revisions.
11 
12 # usage
13 
M main.go
+20, -20
  1@@ -123,13 +123,13 @@ type TreeItem struct {
  2 	Name       string
  3 	Path       string
  4 	URL        template.URL
  5-	CommitID string
  6+	CommitID   string
  7 	CommitURL  template.URL
  8 	Summary    string
  9 	When       string
 10-	Author *git.Signature
 11+	Author     *git.Signature
 12 	Entry      *git.TreeEntry
 13-	Crumbs []*Breadcrumb
 14+	Crumbs     []*Breadcrumb
 15 }
 16 
 17 type DiffRender struct {
 18@@ -193,7 +193,7 @@ type LogPageData struct {
 19 type FilePageData struct {
 20 	*PageData
 21 	Contents template.HTML
 22-	Item *TreeItem
 23+	Item     *TreeItem
 24 }
 25 
 26 type CommitPageData struct {
 27@@ -421,7 +421,7 @@ func (c *Config) writeHTMLTreeFile(pageData *PageData, treeItem *TreeItem) strin
 28 		Data: &FilePageData{
 29 			PageData: pageData,
 30 			Contents: template.HTML(contents),
 31-			Item: treeItem,
 32+			Item:     treeItem,
 33 		},
 34 		Subdir: getFileURL(pageData.RevData, d),
 35 	})
 36@@ -684,8 +684,8 @@ func (c *Config) writeRepo() *BranchOutput {
 37 }
 38 
 39 type TreeRoot struct {
 40-	Path string
 41-	Items []*TreeItem
 42+	Path   string
 43+	Items  []*TreeItem
 44 	Crumbs []*Breadcrumb
 45 }
 46 
 47@@ -698,8 +698,8 @@ type TreeWalker struct {
 48 }
 49 
 50 type Breadcrumb struct {
 51-	Text string
 52-	URL template.URL
 53+	Text   string
 54+	URL    template.URL
 55 	IsLast bool
 56 }
 57 
 58@@ -716,8 +716,8 @@ func (tw *TreeWalker) calcBreadcrumbs(curpath string) []*Breadcrumb {
 59 	)
 60 
 61 	crumbs := make([]*Breadcrumb, len(parts)+1)
 62-	crumbs[0] = &Breadcrumb {
 63-		URL: rootURL,
 64+	crumbs[0] = &Breadcrumb{
 65+		URL:  rootURL,
 66 		Text: tw.PageData.Repo.RepoName,
 67 	}
 68 
 69@@ -725,9 +725,9 @@ func (tw *TreeWalker) calcBreadcrumbs(curpath string) []*Breadcrumb {
 70 	for idx, d := range parts {
 71 		crumbs[idx+1] = &Breadcrumb{
 72 			Text: d,
 73-			URL: template.URL(filepath.Join(getFileBaseDir(tw.PageData.RevData), cur, d, "index.html")),
 74+			URL:  template.URL(filepath.Join(getFileBaseDir(tw.PageData.RevData), cur, d, "index.html")),
 75 		}
 76-		if idx == len(parts) - 1 {
 77+		if idx == len(parts)-1 {
 78 			crumbs[idx+1].IsLast = true
 79 		}
 80 		cur = filepath.Join(cur, d)
 81@@ -740,11 +740,11 @@ func (tw *TreeWalker) NewTreeItem(entry *git.TreeEntry, curpath string, crumbs [
 82 	typ := entry.Type()
 83 	fname := filepath.Join(curpath, entry.Name())
 84 	item := &TreeItem{
 85-		Size:  toPretty(entry.Size()),
 86-		Name:  entry.Name(),
 87-		Path:  fname,
 88-		Entry: entry,
 89-		URL:   template.URL(getFileURL(tw.PageData.RevData, fname)),
 90+		Size:   toPretty(entry.Size()),
 91+		Name:   entry.Name(),
 92+		Path:   fname,
 93+		Entry:  entry,
 94+		URL:    template.URL(getFileURL(tw.PageData.RevData, fname)),
 95 		Crumbs: crumbs,
 96 	}
 97 
 98@@ -834,8 +834,8 @@ func (tw *TreeWalker) walk(tree *git.Tree, curpath string) {
 99 	}
100 
101 	tw.tree <- &TreeRoot{
102-		Path: fpath,
103-		Items: treeEntries,
104+		Path:   fpath,
105+		Items:  treeEntries,
106 		Crumbs: crumbs,
107 	}
108