summaryrefslogtreecommitdiffstats
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-10-16 19:28:21 +0200
committerGitHub <noreply@github.com>2016-10-16 19:28:21 +0200
commit40b1b8f70373dacf2458fbd9a67be32fc6830f91 (patch)
treefb03f4cde8daecd30c5e85c989a38a9fde5a2b3c /hugolib
parent4d6cd3cb2aa46df781adde8debf9f64d50973365 (diff)
downloadhugo-40b1b8f70373dacf2458fbd9a67be32fc6830f91.tar.gz
hugo-40b1b8f70373dacf2458fbd9a67be32fc6830f91.zip
Fix case issue Viper vs Blackfriday config
There are still work to be done in the case department, but that will have to be another day. Fixes #2581 See https://github.com/spf13/viper/issues/261
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/multilingual.go5
-rw-r--r--hugolib/page.go2
-rw-r--r--hugolib/site_test.go6
3 files changed, 8 insertions, 5 deletions
diff --git a/hugolib/multilingual.go b/hugolib/multilingual.go
index 2b0214e10..cf45e7233 100644
--- a/hugolib/multilingual.go
+++ b/hugolib/multilingual.go
@@ -17,7 +17,6 @@ import (
"sync"
"sort"
- "strings"
"errors"
"fmt"
@@ -84,6 +83,7 @@ func toSortedLanguages(l map[string]interface{}) (helpers.Languages, error) {
for lang, langConf := range l {
langsMap, err := cast.ToStringMapE(langConf)
+ helpers.ToLowerMap(langsMap)
if err != nil {
return nil, fmt.Errorf("Language config is not a map: %T", langConf)
@@ -91,8 +91,7 @@ func toSortedLanguages(l map[string]interface{}) (helpers.Languages, error) {
language := helpers.NewLanguage(lang)
- for k, v := range langsMap {
- loki := strings.ToLower(k)
+ for loki, v := range langsMap {
switch loki {
case "title":
language.Title = cast.ToString(v)
diff --git a/hugolib/page.go b/hugolib/page.go
index d2205e32f..99ef6e413 100644
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -392,9 +392,11 @@ func (p *Page) getRenderingConfig() *helpers.Blackfriday {
panic(fmt.Sprintf("nil language for %s with source lang %s", p.BaseFileName(), p.lang))
}
p.renderingConfig = helpers.NewBlackfriday(p.Language())
+
if err := mapstructure.Decode(pageParam, p.renderingConfig); err != nil {
jww.FATAL.Printf("Failed to get rendering config for %s:\n%s", p.BaseFileName(), err.Error())
}
+
})
return p.renderingConfig
diff --git a/hugolib/site_test.go b/hugolib/site_test.go
index b278456fc..9cf094e19 100644
--- a/hugolib/site_test.go
+++ b/hugolib/site_test.go
@@ -337,8 +337,9 @@ func doTestShouldAlwaysHaveUglyURLs(t *testing.T, uglyURLs bool) {
viper.Set("DisableRSS", false)
viper.Set("RSSUri", "index.xml")
viper.Set("blackfriday",
+ // TODO(bep) https://github.com/spf13/viper/issues/261
map[string]interface{}{
- "plainIDAnchors": true})
+ strings.ToLower("plainIDAnchors"): true})
viper.Set("UglyURLs", uglyURLs)
@@ -964,8 +965,9 @@ func setupLinkingMockSite(t *testing.T) *Site {
viper.Set("PluralizeListTitles", false)
viper.Set("CanonifyURLs", false)
viper.Set("blackfriday",
+ // TODO(bep) see https://github.com/spf13/viper/issues/261
map[string]interface{}{
- "sourceRelativeLinksProjectFolder": "/docs"})
+ strings.ToLower("sourceRelativeLinksProjectFolder"): "/docs"})
site := &Site{
Source: &source.InMemorySource{ByteSource: sources},