diff options
author | Albert Nigmatzianov <albertnigma@gmail.com> | 2016-10-24 20:56:00 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-10-24 20:56:00 +0200 |
commit | f21e2f25c99c547a2f35d209935f8f1c52fa2671 (patch) | |
tree | f2bb860213e88b0244c31144cfcd872665096f06 /hugolib | |
parent | d9f54a13c14f12ccc8af33e9dbd611c2cd113324 (diff) |
all: Unify case of config variable names
All config variables starts with low-case and uses camelCase.
If there is abbreviation at the beginning of the name, the whole
abbreviation will be written in low-case.
If there is abbreviation at the end of the name, the
whole abbreviation will be written in upper-case.
For example, rssURI.
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/config.go | 106 | ||||
-rw-r--r-- | hugolib/config_test.go | 2 | ||||
-rw-r--r-- | hugolib/embedded_shortcodes_test.go | 6 | ||||
-rw-r--r-- | hugolib/handler_page.go | 2 | ||||
-rw-r--r-- | hugolib/handler_test.go | 2 | ||||
-rw-r--r-- | hugolib/hugo_sites.go | 6 | ||||
-rw-r--r-- | hugolib/hugo_sites_test.go | 46 | ||||
-rw-r--r-- | hugolib/menu_test.go | 18 | ||||
-rw-r--r-- | hugolib/page.go | 18 | ||||
-rw-r--r-- | hugolib/page_permalink_test.go | 6 | ||||
-rw-r--r-- | hugolib/page_test.go | 8 | ||||
-rw-r--r-- | hugolib/pagination_test.go | 2 | ||||
-rw-r--r-- | hugolib/robotstxt_test.go | 4 | ||||
-rw-r--r-- | hugolib/rss_test.go | 4 | ||||
-rw-r--r-- | hugolib/shortcode_test.go | 16 | ||||
-rw-r--r-- | hugolib/site.go | 110 | ||||
-rw-r--r-- | hugolib/site_show_plan_test.go | 8 | ||||
-rw-r--r-- | hugolib/site_test.go | 82 | ||||
-rw-r--r-- | hugolib/site_url_test.go | 4 | ||||
-rw-r--r-- | hugolib/sitemap_test.go | 2 |
20 files changed, 226 insertions, 226 deletions
diff --git a/hugolib/config.go b/hugolib/config.go index 86c35964c..2dfe128a6 100644 --- a/hugolib/config.go +++ b/hugolib/config.go @@ -53,57 +53,57 @@ func LoadGlobalConfig(relativeSourcePath, configFilename string) error { func loadDefaultSettings() { viper.SetDefault("cleanDestinationDir", false) - viper.SetDefault("Watch", false) - viper.SetDefault("MetaDataFormat", "toml") - viper.SetDefault("Disable404", false) - viper.SetDefault("DisableRSS", false) - viper.SetDefault("DisableSitemap", false) - viper.SetDefault("DisableRobotsTXT", false) - viper.SetDefault("ContentDir", "content") - viper.SetDefault("LayoutDir", "layouts") - viper.SetDefault("StaticDir", "static") - viper.SetDefault("ArchetypeDir", "archetypes") - viper.SetDefault("PublishDir", "public") - viper.SetDefault("DataDir", "data") - viper.SetDefault("I18nDir", "i18n") - viper.SetDefault("ThemesDir", "themes") - viper.SetDefault("DefaultLayout", "post") - viper.SetDefault("BuildDrafts", false) - viper.SetDefault("BuildFuture", false) - viper.SetDefault("BuildExpired", false) - viper.SetDefault("UglyURLs", false) - viper.SetDefault("Verbose", false) - viper.SetDefault("IgnoreCache", false) - viper.SetDefault("CanonifyURLs", false) - viper.SetDefault("RelativeURLs", false) - viper.SetDefault("RemovePathAccents", false) - viper.SetDefault("Taxonomies", map[string]string{"tag": "tags", "category": "categories"}) - viper.SetDefault("Permalinks", make(PermalinkOverrides, 0)) - viper.SetDefault("Sitemap", Sitemap{Priority: -1, Filename: "sitemap.xml"}) - viper.SetDefault("DefaultExtension", "html") - viper.SetDefault("PygmentsStyle", "monokai") - viper.SetDefault("PygmentsUseClasses", false) - viper.SetDefault("PygmentsCodeFences", false) - viper.SetDefault("PygmentsOptions", "") - viper.SetDefault("DisableLiveReload", false) - viper.SetDefault("PluralizeListTitles", true) - viper.SetDefault("PreserveTaxonomyNames", false) - viper.SetDefault("ForceSyncStatic", false) - viper.SetDefault("FootnoteAnchorPrefix", "") - viper.SetDefault("FootnoteReturnLinkContents", "") - viper.SetDefault("NewContentEditor", "") - viper.SetDefault("Paginate", 10) - viper.SetDefault("PaginatePath", "page") - viper.SetDefault("Blackfriday", helpers.NewBlackfriday(viper.GetViper())) - viper.SetDefault("RSSUri", "index.xml") - viper.SetDefault("SectionPagesMenu", "") - viper.SetDefault("DisablePathToLower", false) - viper.SetDefault("HasCJKLanguage", false) - viper.SetDefault("EnableEmoji", false) - viper.SetDefault("PygmentsCodeFencesGuessSyntax", false) - viper.SetDefault("UseModTimeAsFallback", false) - viper.SetDefault("CurrentContentLanguage", helpers.NewDefaultLanguage()) - viper.SetDefault("DefaultContentLanguage", "en") - viper.SetDefault("DefaultContentLanguageInSubdir", false) - viper.SetDefault("EnableMissingTranslationPlaceholders", false) + viper.SetDefault("watch", false) + viper.SetDefault("metaDataFormat", "toml") + viper.SetDefault("disable404", false) + viper.SetDefault("disableRSS", false) + viper.SetDefault("disableSitemap", false) + viper.SetDefault("disableRobotsTXT", false) + viper.SetDefault("contentDir", "content") + viper.SetDefault("layoutDir", "layouts") + viper.SetDefault("staticDir", "static") + viper.SetDefault("archetypeDir", "archetypes") + viper.SetDefault("publishDir", "public") + viper.SetDefault("dataDir", "data") + viper.SetDefault("i18nDir", "i18n") + viper.SetDefault("themesDir", "themes") + viper.SetDefault("defaultLayout", "post") + viper.SetDefault("buildDrafts", false) + viper.SetDefault("buildFuture", false) + viper.SetDefault("buildExpired", false) + viper.SetDefault("uglyURLs", false) + viper.SetDefault("verbose", false) + viper.SetDefault("ignoreCache", false) + viper.SetDefault("canonifyURLs", false) + viper.SetDefault("relativeURLs", false) + viper.SetDefault("removePathAccents", false) + viper.SetDefault("taxonomies", map[string]string{"tag": "tags", "category": "categories"}) + viper.SetDefault("permalinks", make(PermalinkOverrides, 0)) + viper.SetDefault("sitemap", Sitemap{Priority: -1, Filename: "sitemap.xml"}) + viper.SetDefault("defaultExtension", "html") + viper.SetDefault("pygmentsStyle", "monokai") + viper.SetDefault("pygmentsUseClasses", false) + viper.SetDefault("pygmentsCodeFences", false) + viper.SetDefault("pygmentsOptions", "") + viper.SetDefault("disableLiveReload", false) + viper.SetDefault("pluralizeListTitles", true) + viper.SetDefault("preserveTaxonomyNames", false) + viper.SetDefault("forceSyncStatic", false) + viper.SetDefault("footnoteAnchorPrefix", "") + viper.SetDefault("footnoteReturnLinkContents", "") + viper.SetDefault("newContentEditor", "") + viper.SetDefault("paginate", 10) + viper.SetDefault("paginatePath", "page") + viper.SetDefault("blackfriday", helpers.NewBlackfriday(viper.GetViper())) + viper.SetDefault("rSSUri", "index.xml") + viper.SetDefault("sectionPagesMenu", "") + viper.SetDefault("disablePathToLower", false) + viper.SetDefault("hasCJKLanguage", false) + viper.SetDefault("enableEmoji", false) + viper.SetDefault("pygmentsCodeFencesGuessSyntax", false) + viper.SetDefault("useModTimeAsFallback", false) + viper.SetDefault("currentContentLanguage", helpers.NewDefaultLanguage()) + viper.SetDefault("defaultContentLanguage", "en") + viper.SetDefault("defaultContentLanguageInSubdir", false) + viper.SetDefault("enableMissingTranslationPlaceholders", false) } diff --git a/hugolib/config_test.go b/hugolib/config_test.go index 8c307bd25..6a2325fc9 100644 --- a/hugolib/config_test.go +++ b/hugolib/config_test.go @@ -35,5 +35,5 @@ func TestLoadGlobalConfig(t *testing.T) { require.NoError(t, LoadGlobalConfig("", "hugo.toml")) assert.Equal(t, "side", helpers.Config().GetString("paginatePath")) // default - assert.Equal(t, "layouts", viper.GetString("LayoutDir")) + assert.Equal(t, "layouts", viper.GetString("layoutDir")) } diff --git a/hugolib/embedded_shortcodes_test.go b/hugolib/embedded_shortcodes_test.go index e2d2f6d2e..f5f4d1eeb 100644 --- a/hugolib/embedded_shortcodes_test.go +++ b/hugolib/embedded_shortcodes_test.go @@ -81,8 +81,8 @@ func TestShortcodeHighlight(t *testing.T) { if !helpers.HasPygments() { t.Skip("Skip test as Pygments is not installed") } - viper.Set("PygmentsStyle", "bw") - viper.Set("PygmentsUseClasses", false) + viper.Set("pygmentsStyle", "bw") + viper.Set("pygmentsUseClasses", false) for i, this := range []struct { in, expected string @@ -311,7 +311,7 @@ func TestShortcodeTweet(t *testing.T) { templ.Lookup("").Funcs(tweetFuncMap) p, _ := pageFromString(simplePage, "simple.md") - cacheFileID := viper.GetString("CacheDir") + url.QueryEscape("https://api.twitter.com/1/statuses/oembed.json?id=666616452582129664") + cacheFileID := viper.GetString("cacheDir") + url.QueryEscape("https://api.twitter.com/1/statuses/oembed.json?id=666616452582129664") defer os.Remove(cacheFileID) output, err := HandleShortcodes(this.in, p, templ) diff --git a/hugolib/handler_page.go b/hugolib/handler_page.go index c1f83d716..c71936954 100644 --- a/hugolib/handler_page.go +++ b/hugolib/handler_page.go @@ -114,7 +114,7 @@ func commonConvert(p *Page, t tpl.Template) HandledResult { // TODO(bep) these page handlers need to be re-evaluated, as it is hard to // process a page in isolation. See the new preRender func. - if viper.GetBool("EnableEmoji") { + if viper.GetBool("enableEmoji") { p.rawContent = helpers.Emojify(p.rawContent) } diff --git a/hugolib/handler_test.go b/hugolib/handler_test.go index 0e59510d3..ba5daa8c2 100644 --- a/hugolib/handler_test.go +++ b/hugolib/handler_test.go @@ -40,7 +40,7 @@ func TestDefaultHandler(t *testing.T) { {Name: filepath.FromSlash("sect/doc8.html"), Content: []byte("---\nmarkup: md\n---\n# title\nsome *content*")}, } - viper.Set("DefaultExtension", "html") + viper.Set("defaultExtension", "html") viper.Set("verbose", true) s := &Site{ diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go index ae31132c3..b96a13bbf 100644 --- a/hugolib/hugo_sites.go +++ b/hugolib/hugo_sites.go @@ -73,7 +73,7 @@ func NewHugoSitesFromConfiguration() (*HugoSites, error) { func createSitesFromConfig() ([]*Site, error) { var sites []*Site - multilingual := viper.GetStringMap("Languages") + multilingual := viper.GetStringMap("languages") if len(multilingual) == 0 { sites = append(sites, newSite(helpers.NewDefaultLanguage())) } @@ -339,12 +339,12 @@ func (h *HugoSites) render() error { return nil } - if viper.GetBool("DisableSitemap") { + if viper.GetBool("disableSitemap") { return nil } // TODO(bep) DRY - sitemapDefault := parseSitemap(viper.GetStringMap("Sitemap")) + sitemapDefault := parseSitemap(viper.GetStringMap("sitemap")) s := h.Sites[0] diff --git a/hugolib/hugo_sites_test.go b/hugolib/hugo_sites_test.go index dbbcd0277..66c818acf 100644 --- a/hugolib/hugo_sites_test.go +++ b/hugolib/hugo_sites_test.go @@ -40,7 +40,7 @@ func testCommonResetState() { loadDefaultSettings() // Default is false, but true is easier to use as default in tests - viper.Set("DefaultContentLanguageInSubdir", true) + viper.Set("defaultContentLanguageInSubdir", true) if err := hugofs.Source().Mkdir("content", 0755); err != nil { panic("Content folder creation failed.") @@ -56,7 +56,7 @@ func TestMultiSitesMainLangInRoot(t *testing.T) { func doTestMultiSitesMainLangInRoot(t *testing.T, defaultInSubDir bool) { testCommonResetState() - viper.Set("DefaultContentLanguageInSubdir", defaultInSubDir) + viper.Set("defaultContentLanguageInSubdir", defaultInSubDir) siteConfig := testSiteConfig{DefaultContentLanguage: "fr"} sites := createMultiTestSites(t, siteConfig, multiSiteTOMLConfigTemplate) @@ -155,7 +155,7 @@ func doTestMultiSitesMainLangInRoot(t *testing.T, defaultInSubDir bool) { } func replaceDefaultContentLanguageValue(value string, defaultInSubDir bool) string { - replace := viper.GetString("DefaultContentLanguage") + "/" + replace := viper.GetString("defaultContentLanguage") + "/" if !defaultInSubDir { value = strings.Replace(value, replace, "", 1) @@ -639,7 +639,7 @@ title = "Svenska" func TestChangeDefaultLanguage(t *testing.T) { testCommonResetState() - viper.Set("DefaultContentLanguageInSubdir", false) + viper.Set("defaultContentLanguageInSubdir", false) sites := createMultiTestSites(t, testSiteConfig{DefaultContentLanguage: "fr"}, multiSiteTOMLConfigTemplate) cfg := BuildCfg{} @@ -771,14 +771,14 @@ var tocPageWithShortcodesInHeadingsExpected = `<nav id="TableOfContents"> </nav>` var multiSiteTOMLConfigTemplate = ` -DefaultExtension = "html" -baseurl = "http://example.com/blog" -DisableSitemap = false -DisableRSS = false -RSSUri = "index.xml" +defaultExtension = "html" +baseURL = "http://example.com/blog" +disableSitemap = false +disableRSS = false +rssURI = "index.xml" paginate = 1 -DefaultContentLanguage = "{{ .DefaultContentLanguage }}" +defaultContentLanguage = "{{ .DefaultContentLanguage }}" [permalinks] other = "/somewhere/else/:filename" @@ -830,14 +830,14 @@ lag = "lag" ` var multiSiteYAMLConfig = ` -DefaultExtension: "html" -baseurl: "http://example.com/blog" -DisableSitemap: false -DisableRSS: false -RSSUri: "index.xml" +defaultExtension: "html" +baseURL: "http://example.com/blog" +disableSitemap: false +disableRSS: false +rssURI: "index.xml" paginate: 1 -DefaultContentLanguage: "fr" +defaultContentLanguage: "fr" permalinks: other: "/somewhere/else/:filename" @@ -890,13 +890,13 @@ Languages: var multiSiteJSONConfig = ` { - "DefaultExtension": "html", - "baseurl": "http://example.com/blog", - "DisableSitemap": false, - "DisableRSS": false, - "RSSUri": "index.xml", + "defaultExtension": "html", + "baseURL": "http://example.com/blog", + "disableSitemap": false, + "disableRSS": false, + "rssURI": "index.xml", "paginate": 1, - "DefaultContentLanguage": "fr", + "defaultContentLanguage": "fr", "permalinks": { "other": "/somewhere/else/:filename" }, @@ -1080,7 +1080,7 @@ publishdate: "2000-01-05" --- # doc4 *du contenu francophone* -NOTE: should use the DefaultContentLanguage and mark this doc as 'fr'. +NOTE: should use the defaultContentLanguage and mark this doc as 'fr'. NOTE: doesn't have any corresponding translation in 'en' `)}, {Name: filepath.FromSlash("other/doc5.fr.md"), Content: []byte(`--- diff --git a/hugolib/menu_test.go b/hugolib/menu_test.go index 5ca8af8e5..38bcd1c05 100644 --- a/hugolib/menu_test.go +++ b/hugolib/menu_test.go @@ -376,7 +376,7 @@ func TestMenuWithUnicodeURLs(t *testing.T) { func doTestMenuWithUnicodeURLs(t *testing.T, canonifyURLs bool) { testCommonResetState() - viper.Set("CanonifyURLs", canonifyURLs) + viper.Set("canonifyURLs", canonifyURLs) s := setupMenuTests(t, menuPageSources) @@ -398,12 +398,12 @@ func TestSectionPagesMenu(t *testing.T) { doTestSectionPagesMenu(false, t) } -func doTestSectionPagesMenu(canonifyUrls bool, t *testing.T) { +func doTestSectionPagesMenu(canonifyURLs bool, t *testing.T) { testCommonResetState() - viper.Set("SectionPagesMenu", "spm") + viper.Set("sectionPagesMenu", "spm") - viper.Set("CanonifyURLs", canonifyUrls) + viper.Set("canonifyURLs", canonifyURLs) s := setupMenuTests(t, menuPageSectionsSources) assert.Equal(t, 3, len(s.Sections)) @@ -459,7 +459,7 @@ func doTestSectionPagesMenu(canonifyUrls bool, t *testing.T) { func TestTaxonomyNodeMenu(t *testing.T) { testCommonResetState() - viper.Set("CanonifyURLs", true) + viper.Set("canonifyURLs", true) s := setupMenuTests(t, menuPageSources) for i, this := range []struct { @@ -544,8 +544,8 @@ func TestMenuSortByN(t *testing.T) { func TestHomeNodeMenu(t *testing.T) { testCommonResetState() - viper.Set("CanonifyURLs", true) - viper.Set("UglyURLs", true) + viper.Set("canonifyURLs", true) + viper.Set("uglyURLs", true) s := setupMenuTests(t, menuPageSources) @@ -660,11 +660,11 @@ func setupTestMenuState(t *testing.T) { menus, err := tomlToMap(confMenu1) if err != nil { - t.Fatalf("Unable to Read menus: %v", err) + t.Fatalf("Unable to read menus: %v", err) } viper.Set("menu", menus["menu"]) - viper.Set("baseurl", "http://foo.local/Zoo/") + viper.Set("baseURL", "http://foo.local/Zoo/") } func setupMenuTests(t *testing.T, pageSources []source.ByteSource) *Site { diff --git a/hugolib/page.go b/hugolib/page.go index 484425697..f16e5ea33 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -588,10 +588,10 @@ func (p *Page) permalink() (*url.URL, error) { // fmt.Printf("have a section override for %q in section %s → %s\n", p.Title, p.Section, permalink) } else { if len(pSlug) > 0 { - permalink = helpers.URLPrep(viper.GetBool("UglyURLs"), path.Join(dir, p.Slug+"."+p.Extension())) + permalink = helpers.URLPrep(viper.GetBool("uglyURLs"), path.Join(dir, p.Slug+"."+p.Extension())) } else { t := p.Source.TranslationBaseName() - permalink = helpers.URLPrep(viper.GetBool("UglyURLs"), path.Join(dir, helpers.ReplaceExtension(strings.TrimSpace(t), p.Extension()))) + permalink = helpers.URLPrep(viper.GetBool("uglyURLs"), path.Join(dir, helpers.ReplaceExtension(strings.TrimSpace(t), p.Extension()))) } } @@ -604,7 +604,7 @@ func (p *Page) Extension() string { if p.extension != "" { return p.extension } - return viper.GetString("DefaultExtension") + return viper.GetString("defaultExtension") } // AllTranslations returns all translations, including the current Page. @@ -637,8 +637,8 @@ func (p *Page) LinkTitle() string { } func (p *Page) shouldBuild() bool { - return shouldBuild(viper.GetBool("BuildFuture"), viper.GetBool("BuildExpired"), - viper.GetBool("BuildDrafts"), p.Draft, p.PublishDate, p.ExpiryDate) + return shouldBuild(viper.GetBool("buildFuture"), viper.GetBool("buildExpired"), + viper.GetBool("buildDrafts"), p.Draft, p.PublishDate, p.ExpiryDate) } func shouldBuild(buildFuture bool, buildExpired bool, buildDrafts bool, Draft bool, @@ -697,7 +697,7 @@ func (p *Page) RelPermalink() (string, error) { return "", err } - if viper.GetBool("CanonifyURLs") { + if viper.GetBool("canonifyURLs") { // replacements for relpermalink with baseURL on the form http://myhost.com/sub/ will fail later on // have to return the URL relative from baseURL relpath, err := helpers.GetRelativePath(link.String(), string(p.Site.BaseURL)) @@ -842,8 +842,8 @@ func (p *Page) update(f interface{}) error { p.Draft = !*published } - if p.Date.IsZero() && viper.GetBool("UseModTimeAsFallback") { - fi, err := hugofs.Source().Stat(filepath.Join(helpers.AbsPathify(viper.GetString("ContentDir")), p.File.Path())) + if p.Date.IsZero() && viper.GetBool("useModTimeAsFallback") { + fi, err := hugofs.Source().Stat(filepath.Join(helpers.AbsPathify(viper.GetString("contentDir")), p.File.Path())) if err == nil { p.Date = fi.ModTime() } @@ -855,7 +855,7 @@ func (p *Page) update(f interface{}) error { if isCJKLanguage != nil { p.isCJKLanguage = *isCJKLanguage - } else if viper.GetBool("HasCJKLanguage") { + } else if viper.GetBool("hasCJKLanguage") { if cjk.Match(p.rawContent) { p.isCJKLanguage = true } else { diff --git a/hugolib/page_permalink_test.go b/hugolib/page_permalink_test.go index eb3a6c878..fd8f11dda 100644 --- a/hugolib/page_permalink_test.go +++ b/hugolib/page_permalink_test.go @@ -59,10 +59,10 @@ func TestPermalink(t *testing.T) { {"x/y/z/boofar.md", "", "", "/z/y/q/", false, false, "/z/y/q/", "/z/y/q/"}, } - viper.Set("DefaultExtension", "html") + viper.Set("defaultExtension", "html") for i, test := range tests { - viper.Set("uglyurls", test.uglyURLs) - viper.Set("canonifyurls", test.canonifyURLs) + viper.Set("uglyURLs", test.uglyURLs) + viper.Set("canonifyURLs", test.canonifyURLs) info := newSiteInfo(siteBuilderCfg{baseURL: string(test.base), language: helpers.NewDefaultLanguage()}) p := &Page{ diff --git a/hugolib/page_test.go b/hugolib/page_test.go index 342ff3bd5..16437d0f3 100644 --- a/hugolib/page_test.go +++ b/hugolib/page_test.go @@ -830,7 +830,7 @@ func TestWordCountWithAllCJKRunesWithoutHasCJKLanguage(t *testing.T) { func TestWordCountWithAllCJKRunesHasCJKLanguage(t *testing.T) { testCommonResetState() - viper.Set("HasCJKLanguage", true) + viper.Set("hasCJKLanguage", true) assertFunc := func(t *testing.T, ext string, pages Pages) { p := pages[0] @@ -844,7 +844,7 @@ func TestWordCountWithAllCJKRunesHasCJKLanguage(t *testing.T) { func TestWordCountWithMainEnglishWithCJKRunes(t *testing.T) { testCommonResetState() - viper.Set("HasCJKLanguage", true) + viper.Set("hasCJKLanguage", true) assertFunc := func(t *testing.T, ext string, pages Pages) { p := pages[0] @@ -863,7 +863,7 @@ func TestWordCountWithMainEnglishWithCJKRunes(t *testing.T) { func TestWordCountWithIsCJKLanguageFalse(t *testing.T) { testCommonResetState() - viper.Set("HasCJKLanguage", true) + viper.Set("hasCJKLanguage", true) assertFunc := func(t *testing.T, ext string, pages Pages) { p := pages[0] @@ -1099,7 +1099,7 @@ func TestSliceToLower(t *testing.T) { func TestPagePaths(t *testing.T) { testCommonResetState() - viper.Set("DefaultExtension", "html") + viper.Set("defaultExtension", "html") siteParmalinksSetting := PermalinkOverrides{ "post": ":year/:month/:day/:title/", } diff --git a/hugolib/pagination_test.go b/hugolib/pagination_test.go index 7bbc38058..7b599a80b 100644 --- a/hugolib/pagination_test.go +++ b/hugolib/pagination_test.go @@ -195,7 +195,7 @@ func doTestPagerNoPages(t *testing.T, paginator *paginator) { func TestPaginationURLFactory(t *testing.T) { testCommonResetState() - viper.Set("PaginatePath", "zoo") + viper.Set("paginatePath", "zoo") unicode := newPaginationURLFactory("новости проекта") fooBar := newPaginationURLFactory("foo", "bar") diff --git a/hugolib/robotstxt_test.go b/hugolib/robotstxt_test.go index 5b6c90826..2faabda7b 100644 --- a/hugolib/robotstxt_test.go +++ b/hugolib/robotstxt_test.go @@ -34,7 +34,7 @@ func TestRobotsTXTOutput(t *testing.T) { hugofs.InitMemFs() - viper.Set("baseurl", "http://auth/bub/") + viper.Set("baseURL", "http://auth/bub/") viper.Set("enableRobotsTXT", true) s := &Site{ @@ -54,6 +54,6 @@ func TestRobotsTXTOutput(t *testing.T) { robots := helpers.ReaderToBytes(robotsFile) if !bytes.HasPrefix(robots, []byte("User-agent: Googlebot")) { - t.Errorf("Robots file should start with 'User-agentL Googlebot'. %s", robots) + t.Errorf("Robots file should start with 'User-agent: Googlebot'. %s", robots) } } diff --git a/hugolib/rss_test.go b/hugolib/rss_test.go index f0ab1c2c3..2bf849f9e 100644 --- a/hugolib/rss_test.go +++ b/hugolib/rss_test.go @@ -45,8 +45,8 @@ func TestRSSOutput(t *testing.T) { testCommonResetState() rssURI := "public/customrss.xml" - viper.Set("baseurl", "http://auth/bub/") - viper.Set("RSSUri", rssURI) + viper.Set("baseURL", "http://auth/bub/") + viper.Set("rssURI", rssURI) for _, s := range weightedSources { writeSource(t, filepath.Join("content", s.Name), string(s.Content)) diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go index 54abdecd9..b2685e2ec 100644 --- a/hugolib/shortcode_test.go +++ b/hugolib/shortcode_test.go @@ -305,8 +305,8 @@ func TestHighlight(t *testing.T) { if !helpers.HasPygments() { t.Skip("Skip test as Pygments is not installed") } - viper.Set("PygmentsStyle", "bw") - viper.Set("PygmentsUseClasses", false) + viper.Set("pygmentsStyle", "bw") + viper.Set("pygmentsUseClasses", false) templ := tpl.New() @@ -455,14 +455,14 @@ func TestShortcodesInSite(t *testing.T) { testCommonResetState() baseURL := "http://foo/bar" - viper.Set("DefaultExtension", "html") - viper.Set("DefaultContentLanguage", "en") - viper.Set("baseurl", baseURL) - viper.Set("UglyURLs", false) + viper.Set("defaultExtension", "html") + viper.Set("defaultContentLanguage", "en") + viper.Set("baseURL", baseURL) + viper.Set("uglyURLs", false) viper.Set("verbose", true) - viper.Set("pygmentsuseclasses", true) - viper.Set("pygmentscodefences", true) + viper.Set("pygmentsUseClasses", true) + viper.Set("pygmentsCodefences", true) tests := []struct { contentPath string diff --git a/hugolib/site.go b/hugolib/site.go index 7f96bb5aa..b094142af 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -819,8 +819,8 @@ func (s *Site) setupPrevNext() { func (s *Site) setCurrentLanguageConfig() error { // There are sadly some global template funcs etc. that need the language information. - viper.Set("Multilingual", s.multilingualEnabled()) - viper.Set("CurrentContentLanguage", s.Language) + viper.Set("multilingual", s.multilingualEnabled()) + viper.Set("currentContentLanguage", s.Language) // Cache the current config. helpers.InitConfigProviderForCurrentContentLanguage() return tpl.SetTranslateLang(s.Language) @@ -886,7 +886,7 @@ func (s *Site) initialize() (err error) { return err } - staticDir := helpers.AbsPathify(viper.GetString("StaticDir") + "/") + staticDir := helpers.AbsPathify(viper.GetString("staticDir") + "/") s.Source = &source.Filesystem{ AvoidPaths: []string{staticDir}, @@ -907,7 +907,7 @@ func (s *SiteInfo) HomeAbsURL() string { // SitemapAbsURL is a convenience method giving the absolute URL to the sitemap. func (s *SiteInfo) SitemapAbsURL() string { - sitemapDefault := parseSitemap(viper.GetStringMap("Sitemap")) + sitemapDefault := parseSitemap(viper.GetStringMap("sitemap")) p := s.HomeAbsURL() if !strings.HasSuffix(p, "/") { p += "/" @@ -930,12 +930,12 @@ func (s *Site) initializeSiteInfo() { params := lang.Params() permalinks := make(PermalinkOverrides) - for k, v := range viper.GetStringMapString("Permalinks") { + for k, v := range viper.GetStringMapString("permalinks") { permalinks[k] = pathPattern(v) } - defaultContentInSubDir := viper.GetBool("DefaultContentLanguageInSubdir") - defaultContentLanguage := viper.GetString("DefaultContentLanguage") + defaultContentInSubDir := viper.GetBool("defaultContentLanguageInSubdir") + defaultContentLanguage := viper.GetString("defaultContentLanguage") languagePrefix := "" if s.multilingualEnabled() && (defaultContentIn |