Aggiunto supporto per il markdown alle descrizioni degli item in storia e convertito a YAML

This commit is contained in:
2022-08-28 18:45:45 +02:00
parent 192d8ea944
commit 6cccf78e45
8 changed files with 79 additions and 77 deletions
+9 -2
View File
@@ -1,6 +1,7 @@
package templates
import (
"fmt"
"html/template"
"io"
"log"
@@ -23,7 +24,9 @@ func NewCacheTemplate(loadPatterns ...string) *CachedTemplate {
PreLoadTemplatePatterns: loadPatterns,
cachedTmpl: nil,
}
template.Must(cachedTemplate.Load(template.New("")))
template.Must(cachedTemplate.Load(nil))
return cachedTemplate
}
@@ -33,7 +36,11 @@ func (ct *CachedTemplate) Load(t *template.Template) (*template.Template, error)
return ct.cachedTmpl, nil
}
ct.cachedTmpl = t
ct.cachedTmpl = template.New("").Funcs(template.FuncMap{
"raw": func(value any) template.HTML {
return template.HTML(fmt.Sprint(value))
},
})
for _, pattern := range ct.PreLoadTemplatePatterns {
var err error