diff options
-rw-r--r-- | templates.go | 8 | ||||
-rw-r--r-- | templates/ref.gmi | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/templates.go b/templates.go index e31f06f..3f8cf42 100644 --- a/templates.go +++ b/templates.go @@ -5,9 +5,11 @@ import ( "text/template" ) -//go:embed templates/*.gmi -var geminiTemplateFS embed.FS -var geminiTemplate = template.Must(template.ParseFS(geminiTemplateFS, "templates/*.gmi")) +var ( + //go:embed templates/*.gmi + geminiTemplateFS embed.FS + geminiTemplate = template.Must(template.ParseFS(geminiTemplateFS, "templates/*.gmi")) +) func addTemplates(base *template.Template, additions *template.Template) (*template.Template, error) { base, err := base.Clone() diff --git a/templates/ref.gmi b/templates/ref.gmi index 909690f..61296b8 100644 --- a/templates/ref.gmi +++ b/templates/ref.gmi @@ -35,15 +35,13 @@ => mailto:{{.CommitterEmail}} {{.CommitterName}} {{.CommitDate.Format "Mon Jan _2 15:04:05 MST 2006"}} -{{ if ne .Parents nil -}} -{{ with index .Parents 0 -}} ```diffstat +{{ if eq .Parents nil -}} +{{$.Repo.Diffstat $.Ctx "4b825dc642cb6eb9a060e54bf8d69288fbee4904" $.Params.ref}} +{{ else -}} +{{ with index .Parents 0 -}} {{$.Repo.Diffstat $.Ctx . $.Params.ref}} -``` {{ end -}} -{{ else -}} -```diffstat -{{$.Repo.Diffstat $.Ctx "4b825dc642cb6eb9a060e54bf8d69288fbee4904" $.Params.ref}} ``` {{ end -}} {{ end -}} |