mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-11 20:03:58 +02: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:
@@ -7,15 +7,15 @@ import (
|
||||
var absURLInit sync.Once
|
||||
var ar *absURLReplacer
|
||||
|
||||
// for performance reasons, we reuse the first baseUrl given
|
||||
func initAbsurlReplacer(baseURL string) {
|
||||
// for performance reasons, we reuse the first baseURL given
|
||||
func initAbsURLReplacer(baseURL string) {
|
||||
absURLInit.Do(func() {
|
||||
ar = newAbsurlReplacer(baseURL)
|
||||
ar = newAbsURLReplacer(baseURL)
|
||||
})
|
||||
}
|
||||
|
||||
func AbsURL(absURL string) (trs []link, err error) {
|
||||
initAbsurlReplacer(absURL)
|
||||
initAbsURLReplacer(absURL)
|
||||
|
||||
trs = append(trs, func(content []byte) []byte {
|
||||
return ar.replaceInHTML(content)
|
||||
@@ -24,7 +24,7 @@ func AbsURL(absURL string) (trs []link, err error) {
|
||||
}
|
||||
|
||||
func AbsURLInXML(absURL string) (trs []link, err error) {
|
||||
initAbsurlReplacer(absURL)
|
||||
initAbsURLReplacer(absURL)
|
||||
|
||||
trs = append(trs, func(content []byte) []byte {
|
||||
return ar.replaceInXML(content)
|
||||
|
@@ -120,7 +120,7 @@ func checkCandidate(l *contentlexer) {
|
||||
}
|
||||
|
||||
if bytes.HasPrefix(l.content[l.pos:], m.match) {
|
||||
// check for schemaless urls
|
||||
// check for schemaless URLs
|
||||
posAfter := l.pos + len(m.match)
|
||||
if int(posAfter) >= len(l.content) {
|
||||
return
|
||||
@@ -196,7 +196,7 @@ type absURLReplacer struct {
|
||||
xmlMatchers []absURLMatcher
|
||||
}
|
||||
|
||||
func newAbsurlReplacer(baseURL string) *absURLReplacer {
|
||||
func newAbsURLReplacer(baseURL string) *absURLReplacer {
|
||||
u, _ := url.Parse(baseURL)
|
||||
base := strings.TrimRight(u.String(), "/")
|
||||
|
||||
|
Reference in New Issue
Block a user