Correct initialisms as suggested by golint

First step to use initialisms that golint suggests,
for example:

    Line 116: func GetHtmlRenderer should be GetHTMLRenderer

as see on http://goreportcard.com/report/spf13/hugo

Thanks to @bep for the idea!

Note that command-line flags (cobra and pflag)
as well as struct fields like .BaseUrl and .Url
that are used in Go HTML templates need more work
to maintain backward-compatibility, and thus
are NOT yet dealt with in this commit.

First step in fixing #959.
This commit is contained in:
Anthony Fok
2015-03-11 11:34:57 -06:00
committed by bep
parent 00f07c5374
commit 67df33f500
33 changed files with 310 additions and 303 deletions

View File

@@ -149,8 +149,8 @@ func (p *Page) Authors() AuthorList {
return al
}
func (p *Page) UniqueId() string {
return p.Source.UniqueId()
func (p *Page) UniqueID() string {
return p.Source.UniqueID()
}
func (p *Page) Ref(ref string) (string, error) {
@@ -200,12 +200,12 @@ func (p *Page) setSummary() {
func (p *Page) renderBytes(content []byte) []byte {
return helpers.RenderBytes(
&helpers.RenderingContext{Content: content, PageFmt: p.guessMarkupType(),
DocumentId: p.UniqueId(), Config: p.getRenderingConfig()})
DocumentID: p.UniqueID(), Config: p.getRenderingConfig()})
}
func (p *Page) renderContent(content []byte) []byte {
return helpers.RenderBytesWithTOC(&helpers.RenderingContext{Content: content, PageFmt: p.guessMarkupType(),
DocumentId: p.UniqueId(), Config: p.getRenderingConfig()})
DocumentID: p.UniqueID(), Config: p.getRenderingConfig()})
}
func (p *Page) getRenderingConfig() *helpers.Blackfriday {
@@ -341,15 +341,15 @@ func (p *Page) analyzePage() {
}
func (p *Page) permalink() (*url.URL, error) {
baseUrl := string(p.Site.BaseUrl)
baseURL := string(p.Site.BaseUrl)
dir := strings.TrimSpace(filepath.ToSlash(p.Source.Dir()))
pSlug := strings.TrimSpace(p.Slug)
pUrl := strings.TrimSpace(p.Url)
pURL := strings.TrimSpace(p.Url)
var permalink string
var err error
if len(pUrl) > 0 {
return helpers.MakePermalink(baseUrl, pUrl), nil
if len(pURL) > 0 {
return helpers.MakePermalink(baseURL, pURL), nil
}
if override, ok := p.Site.Permalinks[p.Section()]; ok {
@@ -361,14 +361,14 @@ 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 := filepath.Split(p.Source.LogicalName())
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())))
}
}
return helpers.MakePermalink(baseUrl, permalink), nil
return helpers.MakePermalink(baseURL, permalink), nil
}
func (p *Page) Extension() string {
@@ -419,7 +419,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))
@@ -452,12 +452,12 @@ func (p *Page) update(f interface{}) error {
case "description":
p.Description = cast.ToString(v)
case "slug":
p.Slug = helpers.Urlize(cast.ToString(v))
p.Slug = helpers.URLize(cast.ToString(v))
case "url":
if url := cast.ToString(v); strings.HasPrefix(url, "http://") || strings.HasPrefix(url, "https://") {
return fmt.Errorf("Only relative urls are supported, %v provided", url)
}
p.Url = helpers.Urlize(cast.ToString(v))
p.Url = helpers.URLize(cast.ToString(v))
case "type":
p.contentType = cast.ToString(v)
case "extension", "ext":