1
0
mirror of https://github.com/gohugoio/hugo.git synced 2024-05-11 05:54:58 +00:00

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.
This commit is contained in:
Anthony Fok
2015-03-17 22:16:54 -07:00
committed by bep
parent ca69cad8aa
commit 8b8fb417ae
20 changed files with 184 additions and 129 deletions

View File

@@ -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":