🎨 Format of the code
This commit is contained in:
parent
fa1faa3bc3
commit
bd4a14b38b
|
@ -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)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
})
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue