summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-08-07 10:52:52 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-08-07 13:42:54 +0200
commit851bf3515e61141cda6209fb196f4505c826607c (patch)
tree4c227fb57c849638059836a4f490d0c5c0da0a42 /config
parentd4a6c16c17b8804c13c9c0a5526be01fc238c67a (diff)
Add all config to docshelper.json
Also consolidate so the mediaTypes and outputFormats are listed once only. Fixes #11328
Diffstat (limited to 'config')
-rw-r--r--config/allconfig/alldecoders.go13
-rw-r--r--config/allconfig/docshelper.go (renamed from config/docshelper.go)14
-rw-r--r--config/security/docshelper.go26
3 files changed, 18 insertions, 35 deletions
diff --git a/config/allconfig/alldecoders.go b/config/allconfig/alldecoders.go
index 6b8a4568c..24f9b9677 100644
--- a/config/allconfig/alldecoders.go
+++ b/config/allconfig/alldecoders.go
@@ -49,10 +49,11 @@ type decodeConfig struct {
}
type decodeWeight struct {
- key string
- decode func(decodeWeight, decodeConfig) error
- getCompiler func(c *Config) configCompiler
- weight int
+ key string
+ decode func(decodeWeight, decodeConfig) error
+ getCompiler func(c *Config) configCompiler
+ weight int
+ internalOrDeprecated bool // Hide it from the docs.
}
var allDecoderSetups = map[string]decodeWeight{
@@ -340,6 +341,7 @@ var allDecoderSetups = map[string]decodeWeight{
p.c.Author = maps.CleanConfigStringMap(p.p.GetStringMap(d.key))
return nil
},
+ internalOrDeprecated: true,
},
"social": {
key: "social",
@@ -347,6 +349,7 @@ var allDecoderSetups = map[string]decodeWeight{
p.c.Social = maps.CleanConfigStringMapString(p.p.GetStringMapString(d.key))
return nil
},
+ internalOrDeprecated: true,
},
"uglyurls": {
key: "uglyurls",
@@ -362,12 +365,14 @@ var allDecoderSetups = map[string]decodeWeight{
}
return nil
},
+ internalOrDeprecated: true,
},
"internal": {
key: "internal",
decode: func(d decodeWeight, p decodeConfig) error {
return mapstructure.WeakDecode(p.p.GetStringMap(d.key), &p.c.Internal)
},
+ internalOrDeprecated: true,
},
}
diff --git a/config/docshelper.go b/config/allconfig/docshelper.go
index e34c53c2b..48a09de51 100644
--- a/config/docshelper.go
+++ b/config/allconfig/docshelper.go
@@ -1,4 +1,4 @@
-// Copyright 2021 The Hugo Authors. All rights reserved.
+// Copyright 2023 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -11,10 +11,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package config
+package allconfig
import (
"github.com/gohugoio/hugo/common/maps"
+ "github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/docshelper"
)
@@ -22,8 +23,11 @@ import (
func init() {
docsProvider := func() docshelper.DocProvider {
- cfg := New()
- for _, configRoot := range ConfigRootKeys {
+ cfg := config.New()
+ for configRoot, v := range allDecoderSetups {
+ if v.internalOrDeprecated {
+ continue
+ }
cfg.Set(configRoot, make(maps.Params))
}
lang := maps.Params{
@@ -38,7 +42,7 @@ func init() {
configHelpers := map[string]any{
"mergeStrategy": cfg.Get(""),
}
- return docshelper.DocProvider{"config": configHelpers}
+ return docshelper.DocProvider{"config_helpers": configHelpers}
}
docshelper.AddDocProviderFunc(docsProvider)
diff --git a/config/security/docshelper.go b/config/security/docshelper.go
deleted file mode 100644
index ade03560e..000000000
--- a/config/security/docshelper.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2021 The Hugo Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package security
-
-import (
- "github.com/gohugoio/hugo/docshelper"
-)
-
-func init() {
- docsProvider := func() docshelper.DocProvider {
-
- return docshelper.DocProvider{"config": DefaultConfig.ToSecurityMap()}
- }
- docshelper.AddDocProviderFunc(docsProvider)
-}