aboutsummaryrefslogtreecommitdiffhomepage
path: root/deps
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2018-12-21 16:21:13 +0100
committerBjørn Erik Pedersen <[email protected]>2018-12-23 10:02:42 +0100
commit822dc627a1cfdf1f97882f27761675ac6ace7669 (patch)
treeb453158c329495fa59dc38374eb8296995ba0ce0 /deps
parent43f9df0194d229805d80b13c9e38a7a0fec12cf4 (diff)
downloadhugo-822dc627a1cfdf1f97882f27761675ac6ace7669.tar.gz
hugo-822dc627a1cfdf1f97882f27761675ac6ace7669.zip
tpl/transform: Add transform.Unmarshal func
Fixes #5428
Diffstat (limited to 'deps')
-rw-r--r--deps/deps.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/deps/deps.go b/deps/deps.go
index 46f4f7730..7fba0e153 100644
--- a/deps/deps.go
+++ b/deps/deps.go
@@ -123,6 +123,9 @@ type Listeners struct {
// Add adds a function to a Listeners instance.
func (b *Listeners) Add(f func()) {
+ if b == nil {
+ return
+ }
b.Lock()
defer b.Unlock()
b.listeners = append(b.listeners, f)
@@ -192,6 +195,14 @@ func New(cfg DepsCfg) (*Deps, error) {
fs = hugofs.NewDefault(cfg.Language)
}
+ if cfg.MediaTypes == nil {
+ cfg.MediaTypes = media.DefaultTypes
+ }
+
+ if cfg.OutputFormats == nil {
+ cfg.OutputFormats = output.DefaultFormats
+ }
+
ps, err := helpers.NewPathSpec(fs, cfg.Language)
if err != nil {