]> Sergey Matveev's repositories - sgblog.git/blobdiff - cmd/sgblog/gemini.go
Images in gopher/gemini
[sgblog.git] / cmd / sgblog / gemini.go
index 1d80fde836bfd45c63a9ec8cd81485192be947b1..527874eae26488228777311f4369c0745da12d73 100644 (file)
@@ -1,6 +1,6 @@
 /*
 SGBlog -- Git-backed CGI/UCSPI blogging/phlogging/gemlogging engine
-Copyright (C) 2020-2022 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2020-2023 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU Affero General Public License as
@@ -131,9 +131,10 @@ func serveGemini(cfgPath string) {
                        }
                        lines := msgSplit(commit.Message)
                        entries = append(entries, TableMenuEntry{
-                               Commit:   commit,
-                               Title:    lines[0],
-                               LinesNum: len(lines) - 2,
+                               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,
                                ))),
@@ -185,6 +186,7 @@ func serveGemini(cfgPath string) {
                        When         string
                        Cfg          *Cfg
                        Note         string
+                       Images       []Img
                        Comments     []string
                        Topics       []string
                        Version      string
@@ -196,6 +198,7 @@ func serveGemini(cfgPath string) {
                        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,