mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Remove unnecessary type conversions
This commit is contained in:
parent
3a82ae7114
commit
70739c972e
6 changed files with 9 additions and 9 deletions
|
@ -328,7 +328,7 @@ func Seq(args ...interface{}) ([]int, error) {
|
||||||
if last < -100000 {
|
if last < -100000 {
|
||||||
return nil, errors.New("size of result exeeds limit")
|
return nil, errors.New("size of result exeeds limit")
|
||||||
}
|
}
|
||||||
size := int(((last - first) / inc) + 1)
|
size := ((last - first) / inc) + 1
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
if size <= 0 || size > 2000 {
|
if size <= 0 || size > 2000 {
|
||||||
|
|
|
@ -411,12 +411,12 @@ func (p *Page) analyzePage() {
|
||||||
p.WordCount = len(p.PlainWords())
|
p.WordCount = len(p.PlainWords())
|
||||||
}
|
}
|
||||||
|
|
||||||
p.FuzzyWordCount = int((p.WordCount+100)/100) * 100
|
p.FuzzyWordCount = (p.WordCount + 100) / 100 * 100
|
||||||
|
|
||||||
if p.isCJKLanguage {
|
if p.isCJKLanguage {
|
||||||
p.ReadingTime = int((p.WordCount + 500) / 501)
|
p.ReadingTime = (p.WordCount + 500) / 501
|
||||||
} else {
|
} else {
|
||||||
p.ReadingTime = int((p.WordCount + 212) / 213)
|
p.ReadingTime = (p.WordCount + 212) / 213
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ func pageToPermalinkDate(p *Page, dateField string) (string, error) {
|
||||||
case "monthname":
|
case "monthname":
|
||||||
return p.Date.Month().String(), nil
|
return p.Date.Month().String(), nil
|
||||||
case "day":
|
case "day":
|
||||||
return fmt.Sprintf("%02d", int(p.Date.Day())), nil
|
return fmt.Sprintf("%02d", p.Date.Day()), nil
|
||||||
case "weekday":
|
case "weekday":
|
||||||
return strconv.Itoa(int(p.Date.Weekday())), nil
|
return strconv.Itoa(int(p.Date.Weekday())), nil
|
||||||
case "weekdayname":
|
case "weekdayname":
|
||||||
|
|
|
@ -155,7 +155,7 @@ func HandleShortcodes(stringToParse string, page *Page, t tpl.Template) (string,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return string(tmpContent), nil
|
return tmpContent, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var isInnerShortcodeCache = struct {
|
var isInnerShortcodeCache = struct {
|
||||||
|
|
|
@ -358,7 +358,7 @@ func (s *SiteInfo) githubFileLink(ref string, currentPage *Page, relative bool)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, file := range []*source.File(*s.Files) {
|
for _, file := range *s.Files {
|
||||||
if file.Path() == refPath {
|
if file.Path() == refPath {
|
||||||
target = file
|
target = file
|
||||||
break
|
break
|
||||||
|
@ -1899,7 +1899,7 @@ func (s *Site) permalink(plink string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Site) permalinkStr(plink string) string {
|
func (s *Site) permalinkStr(plink string) string {
|
||||||
return helpers.MakePermalink(string(viper.GetString("BaseURL")), helpers.URLizeAndPrep(plink)).String()
|
return helpers.MakePermalink(viper.GetString("BaseURL"), helpers.URLizeAndPrep(plink)).String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Site) NewNode() *Node {
|
func (s *Site) NewNode() *Node {
|
||||||
|
|
|
@ -197,7 +197,7 @@ func checkCandidateSrcset(l *absurllexer) {
|
||||||
section := l.content[l.pos+len(m.quote) : l.pos+posLastQuote+1]
|
section := l.content[l.pos+len(m.quote) : l.pos+posLastQuote+1]
|
||||||
|
|
||||||
fields := bytes.Fields(section)
|
fields := bytes.Fields(section)
|
||||||
l.w.Write([]byte(m.quote))
|
l.w.Write(m.quote)
|
||||||
for i, f := range fields {
|
for i, f := range fields {
|
||||||
if f[0] == '/' {
|
if f[0] == '/' {
|
||||||
l.w.Write(l.path)
|
l.w.Write(l.path)
|
||||||
|
|
Loading…
Reference in a new issue