summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Nigmatzianov <albertnigma@gmail.com>2016-10-24 20:56:00 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-10-24 20:56:00 +0200
commitf21e2f25c99c547a2f35d209935f8f1c52fa2671 (patch)
treef2bb860213e88b0244c31144cfcd872665096f06
parentd9f54a13c14f12ccc8af33e9dbd611c2cd113324 (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.
-rw-r--r--commands/convert.go2
-rw-r--r--commands/hugo.go106
-rw-r--r--commands/import_jekyll.go6
-rw-r--r--commands/list.go6
-rw-r--r--commands/new.go4
-rw-r--r--commands/server.go28
-rw-r--r--commands/server_test.go2
-rw-r--r--create/content.go6
-rw-r--r--create/content_test.go2
-rw-r--r--docs/content/content/multilingual.md12
-rw-r--r--docs/content/extras/aliases.md2
-rw-r--r--docs/content/extras/menus.md6
-rw-r--r--docs/content/extras/urls.md12
-rw-r--r--docs/content/meta/release-notes.md6
-rw-r--r--docs/content/overview/configuration.md34
-rw-r--r--docs/content/overview/introduction.md2
-rw-r--r--docs/content/overview/quickstart.md8
-rw-r--r--docs/content/templates/content.md12
-rw-r--r--docs/content/templates/go-templates.md4
-rw-r--r--docs/content/templates/variables.md2
-rw-r--r--docs/content/tutorials/create-a-multilingual-site.md28
-rw-r--r--docs/content/tutorials/creating-a-new-theme.md6
-rw-r--r--docs/content/tutorials/github-pages-blog.md30
-rw-r--r--docs/content/tutorials/migrate-from-jekyll.md2
-rw-r--r--examples/blog/config.toml4
-rw-r--r--examples/multilingual/config.toml4
-rw-r--r--helpers/configProvider.go2
-rw-r--r--helpers/content.go8
-rw-r--r--helpers/content_renderer.go6
-rw-r--r--helpers/content_renderer_test.go6
-rw-r--r--helpers/language.go4
-rw-r--r--helpers/path.go6
-rw-r--r--helpers/path_test.go12
-rw-r--r--helpers/pygments.go21
-rw-r--r--helpers/pygments_test.go10
-rw-r--r--helpers/url.go4
-rw-r--r--helpers/url_test.go20
-rw-r--r--hugofs/fs.go2
-rw-r--r--hugofs/fs_test.go5
-rw-r--r--hugolib/config.go106
-rw-r--r--hugolib/config_test.go2
-rw-r--r--hugolib/embedded_shortcodes_test.go6
-rw-r--r--hugolib/handler_page.go2
-rw-r--r--hugolib/handler_test.go2
-rw-r--r--hugolib/hugo_sites.go6
-rw-r--r--hugolib/hugo_sites_test.go46
-rw-r--r--hugolib/menu_test.go18
-rw-r--r--hugolib/page.go18
-rw-r--r--hugolib/page_permalink_test.go6
-rw-r--r--hugolib/page_test.go8
-rw-r--r--hugolib/pagination_test.go2
-rw-r--r--hugolib/robotstxt_test.go4
-rw-r--r--hugolib/rss_test.go4
-rw-r--r--hugolib/shortcode_test.go16
-rw-r--r--hugolib/site.go110
-rw-r--r--hugolib/site_show_plan_test.go8
-rw-r--r--hugolib/site_test.go82
-rw-r--r--hugolib/site_url_test.go4
-rw-r--r--hugolib/sitemap_test.go2
-rw-r--r--source/file.go2
-rw-r--r--source/filesystem.go2
-rw-r--r--tpl/template_funcs.go2
-rw-r--r--tpl/template_funcs_test.go10
-rw-r--r--tpl/template_i18n.go6
-rw-r--r--tpl/template_i18n_test.go6
-rw-r--r--tpl/template_resources.go10
-rw-r--r--tpl/template_resources_test.go6
67 files changed, 469 insertions, 469 deletions
diff --git a/commands/convert.go b/commands/convert.go
index a0decf25d..a0424c4a9 100644
--- a/commands/convert.go
+++ b/commands/convert.go
@@ -134,7 +134,7 @@ func convertContents(mark rune) (err error) {
metadata = newmetadata
}
- page.SetDir(filepath.Join(helpers.AbsPathify(viper.GetString("ContentDir")), file.Dir()))
+ page.SetDir(filepath.Join(helpers.AbsPathify(viper.GetString("contentDir")), file.Dir()))
page.SetSourceContent(psr.Content())
if err = page.SetSourceMetaData(metadata, mark); err != nil {
jww.ERROR.Printf("Failed to set source metadata for file %q: %s. For more info see For more info see https://github.com/spf13/hugo/issues/2458", page.FullFilePath(), err)
diff --git a/commands/hugo.go b/commands/hugo.go
index 3192baf44..376438fcb 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -117,7 +117,7 @@ Complete documentation is available at http://gohugo.io/.`,
}
if buildWatch {
- viper.Set("DisableLiveReload", true)
+ viper.Set("disableLiveReload", true)
watchConfig()
}
@@ -284,55 +284,55 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
for _, cmdV := range append([]*cobra.Command{hugoCmdV}, subCmdVs...) {
if flagChanged(cmdV.PersistentFlags(), "verbose") {
- viper.Set("Verbose", verbose)
+ viper.Set("verbose", verbose)
}
if flagChanged(cmdV.PersistentFlags(), "logFile") {
- viper.Set("LogFile", logFile)
+ viper.Set("logFile", logFile)
}
if flagChanged(cmdV.Flags(), "cleanDestinationDir") {
viper.Set("cleanDestinationDir", cleanDestination)
}
if flagChanged(cmdV.Flags(), "buildDrafts") {
- viper.Set("BuildDrafts", draft)
+ viper.Set("buildDrafts", draft)
}
if flagChanged(cmdV.Flags(), "buildFuture") {
- viper.Set("BuildFuture", future)
+ viper.Set("buildFuture", future)
}
if flagChanged(cmdV.Flags(), "buildExpired") {
- viper.Set("BuildExpired", expired)
+ viper.Set("buildExpired", expired)
}
if flagChanged(cmdV.Flags(), "uglyURLs") {
- viper.Set("UglyURLs", uglyURLs)
+ viper.Set("uglyURLs", uglyURLs)
}
if flagChanged(cmdV.Flags(), "canonifyURLs") {
- viper.Set("CanonifyURLs", canonifyURLs)
+ viper.Set("canonifyURLs", canonifyURLs)
}
if flagChanged(cmdV.Flags(), "disable404") {
- viper.Set("Disable404", disable404)
+ viper.Set("disable404", disable404)
}
if flagChanged(cmdV.Flags(), "disableRSS") {
- viper.Set("DisableRSS", disableRSS)
+ viper.Set("disableRSS", disableRSS)
}
if flagChanged(cmdV.Flags(), "disableSitemap") {
- viper.Set("DisableSitemap", disableSitemap)
+ viper.Set("disableSitemap", disableSitemap)
}
if flagChanged(cmdV.Flags(), "enableRobotsTXT") {
- viper.Set("EnableRobotsTXT", enableRobotsTXT)
+ viper.Set("enableRobotsTXT", enableRobotsTXT)
}
if flagChanged(cmdV.Flags(), "pluralizeListTitles") {
- viper.Set("PluralizeListTitles", pluralizeListTitles)
+ viper.Set("pluralizeListTitles", pluralizeListTitles)
}
if flagChanged(cmdV.Flags(), "preserveTaxonomyNames") {
- viper.Set("PreserveTaxonomyNames", preserveTaxonomyNames)
+ viper.Set("preserveTaxonomyNames", preserveTaxonomyNames)
}
if flagChanged(cmdV.Flags(), "ignoreCache") {
- viper.Set("IgnoreCache", ignoreCache)
+ viper.Set("ignoreCache", ignoreCache)
}
if flagChanged(cmdV.Flags(), "forceSyncStatic") {
- viper.Set("ForceSyncStatic", forceSync)
+ viper.Set("forceSyncStatic", forceSync)
}
if flagChanged(cmdV.Flags(), "noTimes") {
- viper.Set("NoTimes", noTimes)
+ viper.Set("noTimes", noTimes)
}
}
@@ -341,10 +341,10 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
if !strings.HasSuffix(baseURL, "/") {
baseURL = baseURL + "/"
}
- viper.Set("BaseURL", baseURL)
+ viper.Set("baseURL", baseURL)
}
- if !viper.GetBool("RelativeURLs") && viper.GetString("BaseURL") == "" {
+ if !viper.GetBool("relativeURLs") && viper.GetString("baseURL") == "" {
jww.ERROR.Println("No 'baseurl' set in configuration or as a flag. Features like page menus will not work without one.")
}
@@ -353,27 +353,27 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
}
if destination != "" {
- viper.Set("PublishDir", destination)
+ viper.Set("publishDir", destination)
}
+ var dir string
if source != "" {
- dir, _ := filepath.Abs(source)
- viper.Set("WorkingDir", dir)
+ dir, _ = filepath.Abs(source)
} else {
- dir, _ := os.Getwd()
- viper.Set("WorkingDir", dir)
+ dir, _ = os.Getwd()
}
+ viper.Set("workingDir", dir)
if contentDir != "" {
- viper.Set("ContentDir", contentDir)
+ viper.Set("contentDir", contentDir)
}
if layoutDir != "" {
- viper.Set("LayoutDir", layoutDir)
+ viper.Set("layoutDir", layoutDir)
}
if cacheDir != "" {
- viper.Set("CacheDir", cacheDir)
+ viper.Set("cacheDir", cacheDir)
}
cacheDir = viper.GetString("cacheDir")
@@ -386,14 +386,14 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
if isDir == false {
mkdir(cacheDir)
}
- viper.Set("CacheDir", cacheDir)
+ viper.Set("cacheDir", cacheDir)
} else {
- viper.Set("CacheDir", helpers.GetTempDir("hugo_cache", hugofs.Source()))
+ viper.Set("cacheDir", helpers.GetTempDir("hugo_cache", hugofs.Source()))
}
- if verboseLog || logging || (viper.IsSet("LogFile") && viper.GetString("LogFile") != "") {
- if viper.IsSet("LogFile") && viper.GetString("LogFile") != "" {
- jww.SetLogFile(viper.GetString("LogFile"))
+ if verboseLog || logging || (viper.IsSet("logFile") && viper.GetString("logFile") != "") {
+ if viper.IsSet("logFile") && viper.GetString("logFile") != "" {
+ jww.SetLogFile(viper.GetString("logFile"))
} else {
jww.UseTempLogFile("hugo")
}
@@ -448,7 +448,7 @@ func watchConfig() {
fmt.Println("Config file changed:", e.Name)
// Force a full rebuild
utils.CheckErr(reCreateAndbuildSites(true))
- if !viper.GetBool("DisableLiveReload") {
+ if !viper.GetBool("disableLiveReload") {
// Will block forever trying to write to a channel that nobody is reading if livereload isn't initialized
livereload.ForceRefresh()
}
@@ -463,11 +463,11 @@ func build(watches ...bool) error {
if renderToMemory {
hugofs.SetDestination(new(afero.MemMapFs))
// Rendering to memoryFS, publish to Root regardless of publishDir.
- viper.Set("PublishDir", "/")
+ viper.Set("publishDir", "/")
}
if err := copyStatic(); err != nil {
- return fmt.Errorf("Error copying static files to %s: %s", helpers.AbsPathify(viper.GetString("PublishDir")), err)
+ return fmt.Errorf("Error copying static files to %s: %s", helpers.AbsPathify(viper.GetString("publishDir")), err)
}
watch := false
if len(watches) > 0 && watches[0] {
@@ -478,7 +478,7 @@ func build(watches ...bool) error {
}
if buildWatch {
- jww.FEEDBACK.Println("Watching for changes in", helpers.AbsPathify(viper.GetString("ContentDir")))
+ jww.FEEDBACK.Println("Watching for changes in", helpers.AbsPathify(viper.GetString("contentDir")))
jww.FEEDBACK.Println("Press Ctrl+C to stop")
utils.CheckErr(NewWatcher(0))
}
@@ -532,7 +532,7 @@ func getStaticSourceFs() afero.Fs {
}
func copyStatic() error {
- publishDir := helpers.AbsPathify(viper.GetString("PublishDir")) + helpers.FilePathSeparator
+ publishDir := helpers.AbsPathify(viper.GetString("publishDir")) + helpers.FilePathSeparator
// If root, remove the second '/'
if publishDir == "//" {
@@ -567,10 +567,10 @@ func copyStatic() error {
// getDirList provides NewWatcher() with a list of directories to watch for changes.
func getDirList() []string {
var a []string
- dataDir := helpers.AbsPathify(viper.GetString("DataDir"))
- i18nDir := helpers.AbsPathify(viper.GetString("I18nDir"))
- layoutDir := helpers.AbsPathify(viper.GetString("LayoutDir"))
- staticDir := helpers.AbsPathify(viper.GetString("StaticDir"))
+ dataDir := helpers.AbsPathify(viper.GetString("dataDir"))
+ i18nDir := helpers.AbsPathify(viper.GetString("i18nDir"))
+ layoutDir := helpers.AbsPathify(viper.GetString("layoutDir"))
+ staticDir := helpers.AbsPathify(viper.GetString("staticDir"))
var themesDir string
if helpers.ThemeSet() {
@@ -580,22 +580,22 @@ func getDirList() []string {
walker := func(path string, fi os.FileInfo, err error) error {
if err != nil {
if path == dataDir && os.IsNotExist(err) {
- jww.WARN.Println("Skip DataDir:", err)
+ jww.WARN.Println("Skip dataDir:", err)
return nil
}
if path == i18nDir && os.IsNotExist(err) {
- jww.WARN.Println("Skip I18nDir:", err)
+ jww.WARN.Println("Skip i18nDir:", err)
return nil
}
if path == layoutDir && os.IsNotExist(err) {
- jww.WARN.Println("Skip LayoutDir:", err)
+ jww.WARN.Println("Skip layoutDir:", err)
return nil
}
if path == staticDir && os.IsNotExist(err) {
- jww.WARN.Println("Skip StaticDir:", err)
+ jww.WARN.Println("Skip staticDir:", err)
return nil
}
@@ -636,9 +636,9 @@ func getDirList() []string {
}
helpers.SymbolicWalk(hugofs.Source(), dataDir, walker)
- helpers.SymbolicWalk(hugofs.Source(), helpers.AbsPathify(viper.GetString("ContentDir")), walker)
+ helpers.SymbolicWalk(hugofs.Source(), helpers.AbsPathify(viper.GetString("contentDir")), walker)
helpers.SymbolicWalk(hugofs.Source(), i18nDir, walker)
- helpers.SymbolicWalk(hugofs.Source(), helpers.AbsPathify(viper.GetString("LayoutDir")), walker)
+ helpers.SymbolicWalk(hugofs.Source(), helpers.AbsPathify(viper.GetString("layoutDir")), walker)
helpers.SymbolicWalk(hugofs.Source(), staticDir, walker)
if helpers.ThemeSet() {
@@ -801,7 +801,7 @@ func NewWatcher(port int) error {
}
if len(staticEvents) > 0 {
- publishDir := helpers.AbsPathify(viper.GetString("PublishDir")) + helpers.FilePathSeparator
+ publishDir := helpers.AbsPathify(viper.GetString("publishDir")) + helpers.FilePathSeparator
// If root, remove the second '/'
if publishDir == "//" {
@@ -812,11 +812,11 @@ func NewWatcher(port int) error {
const layout = "2006-01-02 15:04 -0700"
fmt.Println(time.Now().Format(layout))
- if viper.GetBool("ForceSyncStatic") {
+ if viper.GetBool("forceSyncStatic") {
jww.FEEDBACK.Printf("Syncing all static files\n")
err := copyStatic()
if err != nil {
- utils.StopOnErr(err, fmt.Sprintf("Error copying static files to %s", helpers.AbsPathify(viper.GetString("PublishDir"))))
+ utils.StopOnErr(err, fmt.Sprintf("Error copying static files to %s", helpers.AbsPathify(viper.GetString("publishDir"))))
}
} else {
staticSourceFs := getStaticSourceFs()
@@ -896,7 +896,7 @@ func NewWatcher(port int) error {
}
}
- if !buildWatch && !viper.GetBool("DisableLiveReload") {
+ if !buildWatch && !viper.GetBool("disableLiveReload") {
// Will block forever trying to write to a channel that nobody is reading if livereload isn't initialized
// force refresh when more than one file
@@ -919,7 +919,7 @@ func NewWatcher(port int) error {
rebuildSites(dynamicEvents)
- if !buildWatch && !viper.GetBool("DisableLiveReload") {
+ if !buildWatch && !viper.GetBool("disableLiveReload") {
// Will block forever trying to write to a channel that nobody is reading if livereload isn't initialized
livereload.ForceRefresh()
}
@@ -933,7 +933,7 @@ func NewWatcher(port int) error {
}()
if port > 0 {
- if !viper.GetBool("DisableLiveReload") {
+ if !viper.GetBool("disableLiveReload") {
livereload.Initialize()
http.HandleFunc("/livereload.js", livereload.ServeJS)
http.HandleFunc("/livereload", livereload.Handler)
diff --git a/commands/import_jekyll.go b/commands/import_jekyll.go
index ca65acb7c..8e74fa8d1 100644
--- a/commands/import_jekyll.go
+++ b/commands/import_jekyll.go
@@ -221,7 +221,7 @@ func loadJekyllConfig(jekyllRoot string) map[string]interface{} {
func createConfigFromJekyll(inpath string, kind string, jekyllConfig map[string]interface{}) (err error) {
title := "My New Hugo Site"
- baseurl := "http://example.org/"
+ baseURL := "http://example.org/"
for key, value := range jekyllConfig {
lowerKey := strings.ToLower(key)
@@ -234,13 +234,13 @@ func createConfigFromJekyll(inpath string, kind string, jekyllConfig map[string]
case "url":
if str, ok := value.(string); ok {
- baseurl = str
+ baseURL = str
}
}
}
in := map[string]interface{}{
- "baseurl": baseurl,
+ "baseURL": baseURL,
"title": title,
"languageCode": "en-us",
"disablePathToLower": true,
diff --git a/commands/list.go b/commands/list.go
index 423f1868f..fdf72a67e 100644
--- a/commands/list.go
+++ b/commands/list.go
@@ -49,7 +49,7 @@ var listDraftsCmd = &cobra.Command{
return err
}
- viper.Set("BuildDrafts", true)
+ viper.Set("buildDrafts", true)
sites, err := hugolib.NewHugoSitesFromConfiguration()
@@ -84,7 +84,7 @@ posted in the future.`,
return err
}
- viper.Set("BuildFuture", true)