summaryrefslogtreecommitdiffhomepage
path: root/deps
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2017-04-30 21:52:56 +0200
committerBjørn Erik Pedersen <[email protected]>2017-05-01 15:13:41 +0200
commit8a49c0b3b8b5a374a64b639f46806192cd663fc9 (patch)
tree540b8ae405e69829957f8cb75832d82977adca61 /deps
parenta3bf118eaa0796892047bb7456fe89824e423f27 (diff)
downloadhugo-8a49c0b3b8b5a374a64b639f46806192cd663fc9.tar.gz
hugo-8a49c0b3b8b5a374a64b639f46806192cd663fc9.zip
tpl/collections: Make it a package that stands on its own
See #3042
Diffstat (limited to 'deps')
-rw-r--r--deps/deps.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/deps/deps.go b/deps/deps.go
index 99763c115..5f016c4d7 100644
--- a/deps/deps.go
+++ b/deps/deps.go
@@ -20,8 +20,8 @@ type Deps struct {
// The logger to use.
Log *jww.Notepad `json:"-"`
- // The templates to use.
- Tmpl tpl.TemplateHandler `json:"-"`
+ // The templates to use. This will usually implement the full tpl.TemplateHandler.
+ Tmpl tpl.TemplateFinder `json:"-"`
// The file systems to use.
Fs *hugofs.Fs `json:"-"`
@@ -55,6 +55,10 @@ type ResourceProvider interface {
Clone(deps *Deps) error
}
+func (d *Deps) TemplateHandler() tpl.TemplateHandler {
+ return d.Tmpl.(tpl.TemplateHandler)
+}
+
func (d *Deps) LoadResources() error {
// Note that the translations need to be loaded before the templates.
if err := d.translationProvider.Update(d); err != nil {
@@ -64,7 +68,10 @@ func (d *Deps) LoadResources() error {
if err := d.templateProvider.Update(d); err != nil {
return err
}
- d.Tmpl.PrintErrors()
+
+ if th, ok := d.Tmpl.(tpl.TemplateHandler); ok {
+ th.PrintErrors()
+ }
return nil
}