aboutsummaryrefslogtreecommitdiff
path: root/templates/index.md.qtpl
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-08-28 20:43:56 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-08-28 20:43:56 +0200
commit2b060e55e538a70f0edcd25d9a4c491a03d50149 (patch)
tree4b16ebea9d77ee5b587c2854466c6efd5c1e830c /templates/index.md.qtpl
parent6a97f945c72e3d7b6f34b906d9ae84f97dab5762 (diff)
downloadapkdoc-2b060e55e538a70f0edcd25d9a4c491a03d50149.tar.gz
apkdoc-2b060e55e538a70f0edcd25d9a4c491a03d50149.tar.bz2
apkdoc-2b060e55e538a70f0edcd25d9a4c491a03d50149.zip
feat: Add link to the commit for a given format
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 %}