Update implementation

This commit is contained in:
Svilen Markov
2025-05-04 16:49:20 +01:00
parent a2d8410fec
commit c2286f9a22
17 changed files with 583 additions and 402 deletions
+3 -3
View File
@@ -15,6 +15,7 @@ import (
)
var sequentialWhitespacePattern = regexp.MustCompile(`\s+`)
var whitespaceAtBeginningOfLinePattern = regexp.MustCompile(`(?m)^\s+`)
func percentChange(current, previous float64) float64 {
return (current/previous - 1) * 100
@@ -149,15 +150,14 @@ func fileServerWithCache(fs http.FileSystem, cacheDuration time.Duration) http.H
})
}
func executeTemplateToHTML(t *template.Template, data interface{}) (template.HTML, error) {
func executeTemplateToString(t *template.Template, data any) (string, error) {
var b bytes.Buffer
err := t.Execute(&b, data)
if err != nil {
return "", fmt.Errorf("executing template: %w", err)
}
return template.HTML(b.String()), nil
return b.String(), nil
}
func stringToBool(s string) bool {