diff options
author | Anthony Fok <foka@debian.org> | 2015-03-17 22:16:54 -0700 |
---|---|---|
committer | bep <bjorn.erik.pedersen@gmail.com> | 2015-03-18 11:30:37 +0100 |
commit | 8b8fb417ae065954a056ea018bd092748cc9127c (patch) | |
tree | a9160d1f6acc218bcb8728d729deaf1b532b56b3 /hugolib/menu.go | |
parent | ca69cad8aa5d8eefbce13abd97b2b979339a458c (diff) |
More initialism corrections (golint)
Thanks to @bep's new, brilliant helpers.Deprecated() function,
the following functions or variables are transitioned to their
new names, preserving backward compatibility for v0.14
and warning the user of upcoming obsolescence in v0.15:
* .Url → .URL (for node, menu and paginator)
* .Site.BaseUrl → .Site.BaseURL
* .Site.Indexes → .Site.Taxonomies
* .Site.Recent → .Site.Pages
* getJson → getJSON
* getCsv → getCSV
* safeHtml → safeHTML
* safeCss → safeCSS
* safeUrl → safeURL
Also fix related initialisms in strings and comments.
Continued effort in fixing #959.
Diffstat (limited to 'hugolib/menu.go')
-rw-r--r-- | hugolib/menu.go | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/hugolib/menu.go b/hugolib/menu.go index 4fdf315f0..95370062b 100644 --- a/hugolib/menu.go +++ b/hugolib/menu.go @@ -19,10 +19,11 @@ import ( "strings" "github.com/spf13/cast" + "github.com/spf13/hugo/helpers" ) type MenuEntry struct { - Url string + URL string Name string Menu string Identifier string @@ -37,6 +38,12 @@ type Menu []*MenuEntry type Menus map[string]*Menu type PageMenus map[string]*MenuEntry +// Url is deprecated. Will be removed in 0.15. +func (me *MenuEntry) Url() string { + helpers.Deprecated("MenuEntry", ".Url", ".URL") + return me.URL +} + func (me *MenuEntry) AddChild(child *MenuEntry) { me.Children = append(me.Children, child) me.Children.Sort() @@ -53,22 +60,22 @@ func (me *MenuEntry) KeyName() string { return me.Name } -func (me *MenuEntry) hopefullyUniqueId() string { +func (me *MenuEntry) hopefullyUniqueID() string { if me.Identifier != "" { return me.Identifier - } else if me.Url != "" { - return me.Url + } else if me.URL != "" { + return me.URL } else { return me.Name } } func (me *MenuEntry) IsEqual(inme *MenuEntry) bool { - return me.hopefullyUniqueId() == inme.hopefullyUniqueId() && me.Parent == inme.Parent + return me.hopefullyUniqueID() == inme.hopefullyUniqueID() && me.Parent == inme.Parent } func (me *MenuEntry) IsSameResource(inme *MenuEntry) bool { - return me.Url != "" && inme.Url != "" && me.Url == inme.Url + return me.URL != "" && inme.URL != "" && me.URL == inme.URL } func (me *MenuEntry) MarshallMap(ime map[string]interface{}) { @@ -76,7 +83,7 @@ func (me *MenuEntry) MarshallMap(ime map[string]interface{}) { loki := strings.ToLower(k) switch loki { case "url": - me.Url = cast.ToString(v) + me.URL = cast.ToString(v) case "weight": me.Weight = cast.ToInt(v) case "name": |