-{{$CR := printf "\r"}}20 text/gemini{{$CR}}
+{{$Cfg := .Cfg -}}{{$CR := printf "\r"}}20 text/gemini{{$CR}}
# {{.Title}}
{{$.T.Get "What"}}: {{.Commit.Hash.String}}
{{$.T.Get "When"}}: {{.When}}
{{.Note}}
```
{{end -}}
+{{- if .Images}}
+{{range $idx, $img := .Images}}=> http://{{$Cfg.ImgDomain}}/{{$img.Path}} {{$img.Alt}}
+{{end}}
+{{end -}}
{{- if .Cfg.CommentsEmail}}
=> mailto:{{.Cfg.CommentsEmail}}?subject={{.TitleEscaped}} {{$.T.Get "leave a comment"}}
{{end}}{{range $idx, $comment := .Comments}}
{{- $dateCur := .Commit.Author.When.Format "2006-01-02" -}}
{{- if ne $dateCur $datePrev}}{{$datePrev = $dateCur}}## {{$dateCur}}
{{end -}}
-=> /{{.Commit.Hash.String}} [{{.Commit.Author.When.Format "15:04"}}] {{.Title}} ({{.LinesNum}}L){{with .CommentsNum}} ({{.}}C){{end}}{{if .Topics}}{{range .Topics}} {{.}}{{end}}{{end}}
+=> /{{.Commit.Hash.String}} [{{.Commit.Author.When.Format "15:04"}}] {{.Title}} ({{.LinesNum}}L){{with .ImagesNum}} ({{.}}I){{end}}{{with .CommentsNum}} ({{.}}C){{end}}{{if .Topics}}{{range .Topics}} {{.}}{{end}}{{end}}
{{end}}
{{range .Topics -}}=> /?topic={{.}} Topic: {{.}}
}
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,
))),
When string
Cfg *Cfg
Note string
+ Images []Img
Comments []string
Topics []string
Version 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,
-{{$.T.Get "What"}}: {{.Commit.Hash.String}}
+{{$Cfg := .Cfg -}}{{$.T.Get "What"}}: {{.Commit.Hash.String}}
{{$.T.Get "When"}}: {{.When}}
------------------------------------------------------------------------
{{if .Topics}}{{$.T.Get "Topics"}}:{{range .Topics}} {{.}}{{end}}{{end}}
------------------------------------------------------------------------
{{.Commit.Message -}}
+{{- if .Images}}
+------------------------------------------------------------------------
+{{range $idx, $img := .Images}}http://{{$Cfg.ImgDomain}}/{{$img.Path}}
+{{end}}{{end -}}
{{- if .Note}}
------------------------------------------------------------------------
{{$.T.Get "Note"}}:
{{- $dateCur := .Commit.Author.When.Format "2006-01-02" -}}
{{- if ne $dateCur $datePrev}}{{$datePrev = $dateCur}}
i{{$dateCur}} err{{template "domainPort" $Cfg}}{{$CR}}{{end}}
-0[{{.Commit.Author.When.Format "15:04"}}] {{.Title}} ({{.LinesNum}}L){{with .CommentsNum}} ({{.}}C){{end}}{{if .Topics}}{{range .Topics}} {{.}}{{end}}{{end}} /{{.Commit.Hash.String}}{{template "domainPort" $Cfg}}{{$CR}}{{end}}
+0[{{.Commit.Author.When.Format "15:04"}}] {{.Title}} ({{.LinesNum}}L){{with .ImagesNum}} ({{.}}I){{end}}{{with .CommentsNum}} ({{.}}C){{end}}{{if .Topics}}{{range .Topics}} {{.}}{{end}}{{end}} /{{.Commit.Hash.String}}{{template "domainPort" $Cfg}}{{$CR}}{{end}}
{{range .Topics}}
1{{$.T.Get "topic"}}: {{.}} {{.}}/offset/0{{template "domainPort" $Cfg}}{{$CR}}{{end}}
i{{$.T.Get "Generated by"}}: SGBlog {{.Version}} err{{template "domainPort" .Cfg}}{{$CR}}
Commit *object.Commit
Title string
LinesNum int
+ ImagesNum int
CommentsNum int
Topics []string
}
When string
Cfg *Cfg
Note string
+ Images []Img
Comments []string
Topics []string
Version 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,
}
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
<table border=1>
<tr>
<th>N</th><th>{{$.T.Get "When"}}</th><th>{{$.T.Get "Title"}}</th>
- <th size="5%"><a title="{{$.T.Get "Lines"}}">L</a></th>
- <th size="5%"><a title="{{$.T.Get "Comments"}}">C</a></th>
+ <th size="2%"><a title="{{$.T.Get "Lines"}}">L</a></th>
+ <th size="2%"><a title="{{$.T.Get "Images"}}">I</a></th>
+ <th size="2%"><a title="{{$.T.Get "Comments"}}">C</a></th>
<th>{{$.T.Get "Linked to"}}</th>
{{if .TopicsEnabled}}<th>{{$.T.Get "Topics"}}</th>{{end}}
</tr>
{{range .Entries -}}
{{- $dateCur := .Commit.Author.When.Format "2006-01-02" -}}
{{- if ne $dateCur $datePrev -}}
- <tr><td colspan={{if $TopicsEnabled}}7{{else}}7{{end}}><center><tt>{{$dateCur}}</tt></center></td></tr>
+ <tr><td colspan={{if $TopicsEnabled}}8{{else}}7{{end}}><center><tt>{{$dateCur}}</tt></center></td></tr>
{{- $datePrev = $dateCur -}}
{{- end -}}
<tr>
<td><tt>{{.Commit.Author.When.Format "15:04"}}</tt></td>
<td><a href="{{$.Cfg.URLPrefix}}/{{.Commit.Hash.String}}">{{.Title}}</a></td>
<td>{{.LinesNum}}</td>
+ <td>{{if .ImagesNum}}{{.ImagesNum}}{{else}} {{end}}</td>
<td>{{if .CommentsNum}}{{.CommentsNum}}{{else}} {{end}}</td>
<td>{{if .DomainURLs}}{{range .DomainURLs}} {{.}} {{end}}{{else}} {{end}}</td>
{{if $TopicsEnabled}}<td>{{if .Topics}}{{range .Topics}} <a href="{{$.Cfg.URLPrefix}}/?topic={{.}}">{{.}}</a> {{end}}{{else}} {{end}}</td>{{end}}
Title string
LinesNum int
CommentsNum int
+ ImagesNum int
DomainURLs []string
Topics []string
}
entry.DomainURLs = append(entry.DomainURLs, makeA(line, u.Host))
}
entry.CommentsNum = len(sgblog.ParseComments(entry.CommentsRaw))
+ entry.ImagesNum = len(listImgs(cfg, entry.Commit.Hash))
entry.Topics = sgblog.ParseTopics(entry.TopicsRaw)
entries[i] = entry
}
typ = "application/octet-stream"
}
out = append(out, Img{
- Path: path.Join(sub, ent.Name()),
+ Path: path.Join(sub, strings.ReplaceAll(ent.Name(), " ", "%20")),
Alt: strings.TrimSuffix(name, ext),
Size: info.Size(),
Typ: typ,
)
const (
- Version = "0.28.0"
+ Version = "0.29.0"
WhenFmt = "2006-01-02 15:04:05Z07:00"
)