aboutsummaryrefslogtreecommitdiffhomepage
path: root/docshelper/docs.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2023-08-07 10:52:52 +0200
committerBjørn Erik Pedersen <[email protected]>2023-08-07 13:42:54 +0200
commit851bf3515e61141cda6209fb196f4505c826607c (patch)
tree4c227fb57c849638059836a4f490d0c5c0da0a42 /docshelper/docs.go
parentd4a6c16c17b8804c13c9c0a5526be01fc238c67a (diff)
downloadhugo-851bf3515e61141cda6209fb196f4505c826607c.tar.gz
hugo-851bf3515e61141cda6209fb196f4505c826607c.zip
Add all config to docshelper.json
Also consolidate so the mediaTypes and outputFormats are listed once only. Fixes #11328
Diffstat (limited to 'docshelper/docs.go')
-rw-r--r--docshelper/docs.go20
1 files changed, 8 insertions, 12 deletions
diff --git a/docshelper/docs.go b/docshelper/docs.go
index 1e1594120..b138ff81e 100644
--- a/docshelper/docs.go
+++ b/docshelper/docs.go
@@ -15,9 +15,11 @@
// is of limited interest for the general Hugo user.
package docshelper
+import "fmt"
+
type (
DocProviderFunc = func() DocProvider
- DocProvider map[string]map[string]any
+ DocProvider map[string]any
)
var docProviderFuncs []DocProviderFunc
@@ -32,20 +34,14 @@ func GetDocProvider() DocProvider {
for _, fn := range docProviderFuncs {
p := fn()
for k, v := range p {
- if prev, found := provider[k]; !found {
- provider[k] = v
- } else {
- merge(prev, v)
+ if _, found := provider[k]; found {
+ // We use to merge config, but not anymore.
+ // These constructs will eventually go away, so just make it simple.
+ panic(fmt.Sprintf("Duplicate doc provider key: %q", k))
}
+ provider[k] = v
}
}
return provider
}
-
-// Shallow merge
-func merge(dst, src map[string]any) {
- for k, v := range src {
- dst[k] = v
- }
-}