🗃️ Removed template.FuncMap setup from theme repository

This commit is contained in:
Maxim Lebedev 2023-11-09 07:52:51 +06:00
parent db68a8d768
commit df55414167
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
1 changed files with 2 additions and 8 deletions

View File

@ -6,7 +6,6 @@ import (
"html/template" "html/template"
"io/fs" "io/fs"
"source.toby3d.me/toby3d/home/internal/templateutil"
"source.toby3d.me/toby3d/home/internal/theme" "source.toby3d.me/toby3d/home/internal/theme"
) )
@ -15,16 +14,11 @@ type fileSystemThemeRepository struct {
funcMap template.FuncMap funcMap template.FuncMap
} }
func NewFileSystemThemeRepository(dir fs.FS) (theme.Repository, error) { func NewFileSystemThemeRepository(dir fs.FS, funcMap template.FuncMap) theme.Repository {
funcMap, err := templateutil.New(dir)
if err != nil {
return nil, fmt.Errorf("cannot setup template.FuncMap for theme templates: %w", err)
}
return &fileSystemThemeRepository{ return &fileSystemThemeRepository{
dir: dir, dir: dir,
funcMap: funcMap, funcMap: funcMap,
}, nil }
} }
func (repo *fileSystemThemeRepository) Get(ctx context.Context) (*template.Template, error) { func (repo *fileSystemThemeRepository) Get(ctx context.Context) (*template.Template, error) {