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

@@ -330,7 +330,7 @@ func PathPrep(ugly bool, in string) string {
return PrettifyPath(in)
}
// Same as PrettifyUrlPath() but for file paths.
// Same as PrettifyURLPath() but for file paths.
// /section/name.html becomes /section/name/index.html
// /section/name/ becomes /section/name/index.html
// /section/name/index.html becomes /section/name/index.html

View File

@@ -69,7 +69,7 @@ func sanitizeURLWithFlags(in string, f purell.NormalizationFlags) string {
// in issues #157, #622, etc., without forcing
// relative URLs to begin with '/'.
// Once the fixes are in, let's remove this kludge
// and restore SanitizeUrl() to the way it was.
// and restore SanitizeURL() to the way it was.
// -- @anthonyfok, 2015-02-16
//
// Begin temporary kludge
@@ -87,12 +87,12 @@ func sanitizeURLWithFlags(in string, f purell.NormalizationFlags) string {
}
// SanitizeUrl sanitizes the input URL string.
// SanitizeURL sanitizes the input URL string.
func SanitizeURL(in string) string {
return sanitizeURLWithFlags(in, purell.FlagsSafe|purell.FlagRemoveTrailingSlash|purell.FlagRemoveDotSegments|purell.FlagRemoveDuplicateSlashes|purell.FlagRemoveUnnecessaryHostDots|purell.FlagRemoveEmptyPortSeparator)
}
// SanitizeUrlKeepTrailingSlash is the same as SanitizeUrl, but will keep any trailing slash.
// SanitizeURLKeepTrailingSlash is the same as SanitizeURL, but will keep any trailing slash.
func SanitizeURLKeepTrailingSlash(in string) string {
return sanitizeURLWithFlags(in, purell.FlagsSafe|purell.FlagRemoveDotSegments|purell.FlagRemoveDuplicateSlashes|purell.FlagRemoveUnnecessaryHostDots|purell.FlagRemoveEmptyPortSeparator)
}
@@ -147,7 +147,7 @@ func MakePermalink(host, plink string) *url.URL {
// AddContextRoot adds the context root to an URL if it's not already set.
// For relative URL entries on sites with a base url with a context root set (i.e. http://example.com/mysite),
// relative URLs must not include the context root if canonifyUrls is enabled. But if it's disabled, it must be set.
// relative URLs must not include the context root if canonifyURLs is enabled. But if it's disabled, it must be set.
func AddContextRoot(baseURL, relativePath string) string {
url, err := url.Parse(baseURL)
@@ -185,7 +185,7 @@ func URLPrep(ugly bool, in string) string {
return url
}
// PrettifyUrl takes a URL string and returns a semantic, clean URL.
// PrettifyURL takes a URL string and returns a semantic, clean URL.
func PrettifyURL(in string) string {
x := PrettifyURLPath(in)
@@ -200,7 +200,7 @@ func PrettifyURL(in string) string {
return x
}
// PrettifyUrlPath takes a URL path to a content and converts it
// PrettifyURLPath takes a URL path to a content and converts it
// to enable pretty URLs.
// /section/name.html becomes /section/name/index.html
// /section/name/ becomes /section/name/index.html
@@ -209,7 +209,7 @@ func PrettifyURLPath(in string) string {
return PrettiyPath(in, pathBridge)
}
// Uglify does the opposite of PrettifyUrlPath().
// Uglify does the opposite of PrettifyURLPath().
// /section/name/index.html becomes /section/name.html
// /section/name/ becomes /section/name.html
// /section/name.html becomes /section/name.html

View File

@@ -6,7 +6,7 @@ import (
"testing"
)
func TestUrlize(t *testing.T) {
func TestURLize(t *testing.T) {
tests := []struct {
input string
expected string
@@ -26,7 +26,7 @@ func TestUrlize(t *testing.T) {
}
}
func TestSanitizeUrl(t *testing.T) {
func TestSanitizeURL(t *testing.T) {
tests := []struct {
input string
expected string
@@ -76,7 +76,7 @@ func TestMakePermalink(t *testing.T) {
}
}
func TestUrlPrep(t *testing.T) {
func TestURLPrep(t *testing.T) {
type test struct {
ugly bool
input string