[#97] Add framework for formal language & formal German translation (#98)

This commit is contained in:
Knut Ahlers 2023-07-05 22:52:09 +02:00 committed by GitHub
parent 6fdf184357
commit f4d16e912c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 377 additions and 28 deletions

View file

@ -5,16 +5,20 @@ import (
"encoding/base64"
"sync"
"text/template"
"github.com/Masterminds/sprig/v3"
)
var (
sriCacheStore = newSRICache()
tplFuncs = template.FuncMap{
"list": func(args ...string) []string { return args },
"assetSRI": assetSRIHash,
}
tplFuncs template.FuncMap
)
func init() {
tplFuncs = sprig.FuncMap()
tplFuncs["assetSRI"] = assetSRIHash
}
func assetSRIHash(assetName string) string {
if sri, ok := sriCacheStore.Get(assetName); ok {
return sri