aboutsummaryrefslogtreecommitdiff
path: root/templates/index.md.qtpl
diff options
context:
space:
mode:
Diffstat (limited to 'templates/index.md.qtpl')
-rw-r--r--templates/index.md.qtpl12
1 files changed, 9 insertions, 3 deletions
diff --git a/templates/index.md.qtpl b/templates/index.md.qtpl
index 80439c9..434d640 100644
--- a/templates/index.md.qtpl
+++ b/templates/index.md.qtpl
@@ -1,13 +1,19 @@
-{% import "git.sr.ht/~gabrielgio/apkdoc/parser" %}
+{% import "fmt" %}
{% import "strings" %}
+{% import "git.sr.ht/~gabrielgio/apkdoc/parser" %}
{% code
func reduce(lines []string) string {
return strings.Join(lines, " ")
}
+
+func formatLink(e *parser.Entry, format string) string {
+ c := strings.Replace(*e.Commit, "-dirty", "", -1)
+ return fmt.Sprintf(format, c, *e.Origin)
+}
%}
-{% func MarkdownTemplate(entries []*parser.Entry) %}
+{% func MarkdownTemplate(entries []*parser.Entry, format string) %}
# Apks Alpine 3.18
{% for _, e := range entries %}
## {%s e.Name %}
@@ -23,7 +29,7 @@ func reduce(lines []string) string {
- **License**: {%s e.License%}{% if e.Origin != nil %}
- **Origin**: {%s *e.Origin%}{% endif %}{% if e.BuildTime != nil %}
- **Build time**: {%s e.BuildTime.String() %}{% endif %}{% if e.Commit != nil %}
-- **Commit**: {%s *e.Commit %}{% endif %}{% if e.ProviderPriority != nil %}
+- **Commit**: [{%s *e.Commit %}]({%s formatLink(e, format) %}){% endif %}{% if e.ProviderPriority != nil %}
- **Provider Priority**: {%d *e.ProviderPriority %}{% endif %}{% if len(e.Dependencies) > 0 %}
- **Dependencies:**: {%s reduce(e.Dependencies) %}{% endif %}{% if len(e.Provides) > 0 %}
- **Provides:**: {%s reduce(e.Provides) %}{% endif %}{% if len(e.InstallIf) > 0 %}