mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 00:32:07 -05:00
hugolib: Simplify some code
This commit is contained in:
parent
0665a3951b
commit
e38e881248
4 changed files with 15 additions and 21 deletions
|
@ -1440,9 +1440,7 @@ func (p *Page) update(frontmatter map[string]interface{}) error {
|
||||||
resources = append(resources, cast.ToStringMap(vvv))
|
resources = append(resources, cast.ToStringMap(vvv))
|
||||||
}
|
}
|
||||||
case []map[string]interface{}:
|
case []map[string]interface{}:
|
||||||
for _, vvv := range vv {
|
resources = append(resources, vv...)
|
||||||
resources = append(resources, vvv)
|
|
||||||
}
|
|
||||||
case []interface{}:
|
case []interface{}:
|
||||||
for _, vvv := range vv {
|
for _, vvv := range vv {
|
||||||
switch vvvv := vvv.(type) {
|
switch vvvv := vvv.(type) {
|
||||||
|
|
|
@ -580,11 +580,9 @@ func testAllMarkdownEnginesForPages(t *testing.T,
|
||||||
|
|
||||||
cfg, fs := newTestCfg()
|
cfg, fs := newTestCfg()
|
||||||
|
|
||||||
if settings != nil {
|
|
||||||
for k, v := range settings {
|
for k, v := range settings {
|
||||||
cfg.Set(k, v)
|
cfg.Set(k, v)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
contentDir := "content"
|
contentDir := "content"
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,6 @@ func newFrontmatterConfig(cfg config.Provider) (frontmatterConfig, error) {
|
||||||
|
|
||||||
if cfg.IsSet("frontmatter") {
|
if cfg.IsSet("frontmatter") {
|
||||||
fm := cfg.GetStringMap("frontmatter")
|
fm := cfg.GetStringMap("frontmatter")
|
||||||
if fm != nil {
|
|
||||||
for k, v := range fm {
|
for k, v := range fm {
|
||||||
loki := strings.ToLower(k)
|
loki := strings.ToLower(k)
|
||||||
switch loki {
|
switch loki {
|
||||||
|
@ -214,7 +213,6 @@ func newFrontmatterConfig(cfg config.Provider) (frontmatterConfig, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
expander := func(c, d []string) []string {
|
expander := func(c, d []string) []string {
|
||||||
out := expandDefaultValues(c, d)
|
out := expandDefaultValues(c, d)
|
||||||
|
|
|
@ -70,7 +70,7 @@ func createSiteOutputFormats(allFormats output.Formats, cfg config.Provider) (ma
|
||||||
|
|
||||||
outputs := cfg.GetStringMap("outputs")
|
outputs := cfg.GetStringMap("outputs")
|
||||||
|
|
||||||
if outputs == nil || len(outputs) == 0 {
|
if len(outputs) == 0 {
|
||||||
return outFormats, nil
|
return outFormats, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue