]> Sergey Matveev's repositories - sgblog.git/blobdiff - cmd/sgblog/gopher.go
Images in gopher/gemini
[sgblog.git] / cmd / sgblog / gopher.go
index ffa259c135a588e920c045b86fbc764fc01b26f4..c70a84d00bf40a364871c3a51b0a751097353c4f 100644 (file)
@@ -51,6 +51,7 @@ type TableMenuEntry struct {
        Commit      *object.Commit
        Title       string
        LinesNum    int
+       ImagesNum   int
        CommentsNum int
        Topics      []string
 }
@@ -103,6 +104,7 @@ Redirecting to <a href="%s">%s</a>...
                        When         string
                        Cfg          *Cfg
                        Note         string
+                       Images       []Img
                        Comments     []string
                        Topics       []string
                        Version      string
@@ -113,6 +115,7 @@ Redirecting to <a href="%s">%s</a>...
                        When:     commit.Author.When.Format(sgblog.WhenFmt),
                        Cfg:      cfg,
                        Note:     string(sgblog.GetNote(repo, notesTree, commit.Hash)),
+                       Images:   listImgs(cfg, commit.Hash),
                        Comments: sgblog.ParseComments(sgblog.GetNote(repo, commentsTree, commit.Hash)),
                        Topics:   sgblog.ParseTopics(sgblog.GetNote(repo, topicsTree, commit.Hash)),
                        Version:  sgblog.Version,
@@ -175,11 +178,16 @@ Redirecting to <a href="%s">%s</a>...
                        }
                        lines := msgSplit(commit.Message)
                        entries = append(entries, TableMenuEntry{
-                               Commit:      commit,
-                               Title:       lines[0],
-                               LinesNum:    len(lines) - 2,
-                               CommentsNum: len(sgblog.ParseComments(sgblog.GetNote(repo, commentsTree, commit.Hash))),
-                               Topics:      sgblog.ParseTopics(sgblog.GetNote(repo, topicsTree, commit.Hash)),
+                               Commit:    commit,
+                               Title:     lines[0],
+                               LinesNum:  len(lines) - 2,
+                               ImagesNum: len(listImgs(cfg, commit.Hash)),
+                               CommentsNum: len(sgblog.ParseComments(sgblog.GetNote(
+                                       repo, commentsTree, commit.Hash,
+                               ))),
+                               Topics: sgblog.ParseTopics(sgblog.GetNote(
+                                       repo, topicsTree, commit.Hash,
+                               )),
                        })
                }
                offsetPrev := offset - PageEntries