🎨 Format of the code

This commit is contained in:
Maxim Lebedev 2023-11-19 19:02:25 +06:00
parent fa1faa3bc3
commit bd4a14b38b
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
3 changed files with 10 additions and 10 deletions

View File

@ -165,7 +165,7 @@ func NewApp(logger *log.Logger, config *domain.Config) (*App, error) {
w.Header().Set(common.HeaderContentLanguage, strings.Join(contentLanguage, ", "))
pageTemplate, err := themer.Do(r.Context(), s, p)
template, err := themer.Do(r.Context(), s, p)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
@ -173,7 +173,7 @@ func NewApp(logger *log.Logger, config *domain.Config) (*App, error) {
}
w.Header().Set(common.HeaderContentType, common.MIMETextHTMLCharsetUTF8)
if err = pageTemplate(w); err != nil {
if err = template(w); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
})

View File

@ -71,9 +71,9 @@ func New(partialsDir fs.FS, site *domain.Site) template.FuncMap {
Name: "collections",
Handler: func(v ...any) any { return collectionsNamespace },
Methods: template.FuncMap{
"slice": collectionsNamespace.Slice,
"seq": collectionsNamespace.Seq,
"index": collectionsNamespace.Index,
"seq": collectionsNamespace.Seq,
"slice": collectionsNamespace.Slice,
},
})

View File

@ -12,19 +12,19 @@ import (
)
type themeUseCase struct {
dir fs.FS
themes theme.Repository
partials fs.FS
themes theme.Repository
}
func NewThemeUseCase(dir fs.FS, themes theme.Repository) theme.UseCase {
func NewThemeUseCase(partials fs.FS, themes theme.Repository) theme.UseCase {
return &themeUseCase{
dir: dir,
themes: themes,
partials: partials,
themes: themes,
}
}
func (ucase *themeUseCase) Do(ctx context.Context, site *domain.Site, page *domain.Page) (theme.Writer, error) {
out, err := ucase.themes.Get(ctx, templateutil.New(ucase.dir, site))
out, err := ucase.themes.Get(ctx, templateutil.New(ucase.partials, site))
if err != nil {
return nil, fmt.Errorf("cannot find theme: %w", err)
}