Fix some recently broken embedded templates

And add tests for them.

Fixes #4757
This commit is contained in:
Bjørn Erik Pedersen
2018-05-23 10:03:11 +02:00
parent 4ddcf52ccc
commit 35ccf06dae
11 changed files with 111 additions and 21 deletions

6
deps/deps.go vendored
View File

@@ -23,6 +23,9 @@ type Deps struct {
// The logger to use.
Log *jww.Notepad `json:"-"`
// Used to log errors that may repeat itself many times.
DistinctErrorLog *helpers.DistinctLogger
// The templates to use. This will usually implement the full tpl.TemplateHandler.
Tmpl tpl.TemplateFinder `json:"-"`
@@ -137,9 +140,12 @@ func New(cfg DepsCfg) (*Deps, error) {
timeoutms = 3000
}
distinctErrorLogger := helpers.NewDistinctLogger(logger.ERROR)
d := &Deps{
Fs: fs,
Log: logger,
DistinctErrorLog: distinctErrorLogger,
templateProvider: cfg.TemplateProvider,
translationProvider: cfg.TranslationProvider,
WithTemplate: cfg.WithTemplate,