apkdoc @ 66791d940bc60d004835307a86dd98a14cbc9553

feat: Provide the all fields to be used format
 1diff --git a/example.md b/example.md
 2index 8c5c0eb742c679931b7cacb13d419e64e9411413..dbcbc5133864ea9b48de9b1d3be926009901a504 100644
 3--- a/example.md
 4+++ b/example.md
 5@@ -3,6 +3,7 @@
 6 {{ range $e := . }}
 7 ## {{ $e.Name  }}
 8 
 9-{{ range $name, $value := ($e.Properties) }}- **{{$name}}**: {{ $value }}
10+{{ range $name, $value := ($e.Properties) }}- **{{$name}}:** {{ $value }}
11 {{ end }}
12+**Link:** {{Format $e "https://git.gabrielgio.me/apkbuilds/tree/apk/%{name}s?id=%{commit}s"}}
13 {{ end }}
14diff --git a/parser.go b/parser.go
15index 344efcab3bf3b5e1388d95237d1bbbbb00e3f62a..196dc94d5000f968230a1d9ac7f52bce36c25e5d 100644
16--- a/parser.go
17+++ b/parser.go
18@@ -1,7 +1,6 @@
19 package main
20 
21 import (
22-	"fmt"
23 	"strconv"
24 	"strings"
25 	"time"
26@@ -29,11 +28,6 @@ 		Provides         []string   // p
27 		InstallIf        []string   // i
28 	}
29 )
30-
31-func (e *Entry) FomartLink(format string) string {
32-	c := strings.Replace(*e.Commit, "-dirty", "", -1)
33-	return fmt.Sprintf(format, c, *e.Origin)
34-}
35 
36 func (e *Entry) Properties() map[string]string {
37 	p := make(map[string]string)
38diff --git a/template.go b/template.go
39index 8d84f2e684864cebc79d98effb421d48cdcf831e..bb8d5020633d21695dca5300b57d0142e3c34ab3 100644
40--- a/template.go
41+++ b/template.go
42@@ -5,6 +5,7 @@ 	"errors"
43 	html "html/template"
44 	"io"
45 	"os"
46+	"strings"
47 	text "text/template"
48 )
49 
50@@ -16,6 +17,11 @@ var (
51 	templateFunc = map[string]any{
52 		"DerefI": func(i *int) int { return *i },
53 		"DerefS": func(i *string) string { return *i },
54+		"Format": func(e *Entry, format string) string {
55+			p := e.Properties()
56+			p["commit"] = strings.Replace(*e.Commit, "-dirty", "", -1)
57+			return tsprintf(format, p)
58+		},
59 	}
60 )
61 
62@@ -43,3 +49,10 @@ 	default:
63 		return nil, errors.New("Invalid template type")
64 	}
65 }
66+
67+func tsprintf(format string, params map[string]string) string {
68+	for key, val := range params {
69+		format = strings.Replace(format, "%{"+key+"}s", val, -1)
70+	}
71+	return format
72+}