Create a struct with all of Hugo's config options

Primary motivation is documentation, but it will also hopefully simplify the code.

Also,

* Lower case the default output format names; this is in line with the custom ones (map keys) and how
it's treated all the places. This avoids doing `stringds.EqualFold` everywhere.

Closes #10896
Closes #10620
This commit is contained in:
Bjørn Erik Pedersen
2023-01-04 18:24:36 +01:00
parent 6aededf6b4
commit 241b21b0fd
337 changed files with 13377 additions and 14898 deletions

View File

@@ -91,7 +91,7 @@ func TestCardinalityThreshold(t *testing.T) {
config := Config{
Threshold: 90,
IncludeNewer: false,
Indices: IndexConfigs{
Indices: IndicesConfig{
IndexConfig{Name: "tags", Weight: 50, CardinalityThreshold: 79},
IndexConfig{Name: "keywords", Weight: 65, CardinalityThreshold: 90},
},
@@ -125,7 +125,7 @@ func TestSearch(t *testing.T) {
config := Config{
Threshold: 90,
IncludeNewer: false,
Indices: IndexConfigs{
Indices: IndicesConfig{
IndexConfig{Name: "tags", Weight: 50},
IndexConfig{Name: "keywords", Weight: 65},
},
@@ -293,7 +293,7 @@ func BenchmarkRelatedNewIndex(b *testing.B) {
cfg := Config{
Threshold: 50,
Indices: IndexConfigs{
Indices: IndicesConfig{
IndexConfig{Name: "tags", Weight: 100},
IndexConfig{Name: "keywords", Weight: 200},
},
@@ -334,7 +334,7 @@ func BenchmarkRelatedMatchesIn(b *testing.B) {
cfg := Config{
Threshold: 20,
Indices: IndexConfigs{
Indices: IndicesConfig{
IndexConfig{Name: "tags", Weight: 100},
IndexConfig{Name: "keywords", Weight: 200},
},