mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 07:18:54 +00:00
Rename common/maps to common/hmaps (#14384)
Go's stdlid now has a maps package, which is very useful. We have been using imports on the form `xmaps "maps"`, but auto import tools doesn't handle this, which is annoying. I have been thinking about this for some time, but have been holding back because of all the import changes. However, now is a good time to do this, with very little unmerged code.
This commit is contained in:
committed by
GitHub
parent
94f1ede3aa
commit
608ed09a0a
@@ -31,9 +31,9 @@ import (
|
||||
|
||||
"github.com/gohugoio/hugo/markup/markup_config"
|
||||
|
||||
"github.com/gohugoio/hugo/common/hmaps"
|
||||
"github.com/gohugoio/hugo/common/hugio"
|
||||
"github.com/gohugoio/hugo/common/loggers"
|
||||
"github.com/gohugoio/hugo/common/maps"
|
||||
|
||||
"github.com/gohugoio/hugo/markup/converter"
|
||||
|
||||
@@ -398,7 +398,7 @@ func TestConvertAttributes(t *testing.T) {
|
||||
}
|
||||
data, err := toml.Marshal(mconf)
|
||||
c.Assert(err, qt.IsNil)
|
||||
m := maps.Params{
|
||||
m := hmaps.Params{
|
||||
"markup": config.FromTOMLConfigString(string(data)).Get(""),
|
||||
}
|
||||
conf := testconfig.GetTestConfig(nil, config.NewFrom(m))
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
package markup_config
|
||||
|
||||
import (
|
||||
"github.com/gohugoio/hugo/common/maps"
|
||||
"github.com/gohugoio/hugo/common/hmaps"
|
||||
"github.com/gohugoio/hugo/config"
|
||||
"github.com/gohugoio/hugo/markup/asciidocext/asciidocext_config"
|
||||
"github.com/gohugoio/hugo/markup/goldmark/goldmark_config"
|
||||
@@ -52,7 +52,7 @@ func Decode(cfg config.Provider) (conf Config, err error) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
m = maps.CleanConfigStringMap(m)
|
||||
m = hmaps.CleanConfigStringMap(m)
|
||||
|
||||
normalizeConfig(m)
|
||||
|
||||
@@ -73,9 +73,9 @@ func Decode(cfg config.Provider) (conf Config, err error) {
|
||||
}
|
||||
|
||||
func normalizeConfig(m map[string]any) {
|
||||
v, err := maps.GetNestedParam("goldmark.parser", ".", m)
|
||||
v, err := hmaps.GetNestedParam("goldmark.parser", ".", m)
|
||||
if err == nil {
|
||||
vm := maps.ToStringMap(v)
|
||||
vm := hmaps.ToStringMap(v)
|
||||
// Changed from a bool in 0.81.0
|
||||
if vv, found := vm["attribute"]; found {
|
||||
if vvb, ok := vv.(bool); ok {
|
||||
@@ -87,9 +87,9 @@ func normalizeConfig(m map[string]any) {
|
||||
}
|
||||
|
||||
// Handle changes to the Goldmark configuration.
|
||||
v, err = maps.GetNestedParam("goldmark.extensions", ".", m)
|
||||
v, err = hmaps.GetNestedParam("goldmark.extensions", ".", m)
|
||||
if err == nil {
|
||||
vm := maps.ToStringMap(v)
|
||||
vm := hmaps.ToStringMap(v)
|
||||
|
||||
// We changed the typographer extension config from a bool to a struct in 0.112.0.
|
||||
migrateGoldmarkConfig(vm, "typographer", goldmark_config.Typographer{Disable: true})
|
||||
|
||||
Reference in New Issue
Block a user