mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
Remove unnecessary type conversions
This commit is contained in:
@@ -328,7 +328,7 @@ func Seq(args ...interface{}) ([]int, error) {
|
||||
if last < -100000 {
|
||||
return nil, errors.New("size of result exeeds limit")
|
||||
}
|
||||
size := int(((last - first) / inc) + 1)
|
||||
size := ((last - first) / inc) + 1
|
||||
|
||||
// sanity check
|
||||
if size <= 0 || size > 2000 {
|
||||
|
@@ -411,12 +411,12 @@ func (p *Page) analyzePage() {
|
||||
p.WordCount = len(p.PlainWords())
|
||||
}
|
||||
|
||||
p.FuzzyWordCount = int((p.WordCount+100)/100) * 100
|
||||
p.FuzzyWordCount = (p.WordCount + 100) / 100 * 100
|
||||
|
||||
if p.isCJKLanguage {
|
||||
p.ReadingTime = int((p.WordCount + 500) / 501)
|
||||
p.ReadingTime = (p.WordCount + 500) / 501
|
||||
} 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":
|
||||
return p.Date.Month().String(), nil
|
||||
case "day":
|
||||
return fmt.Sprintf("%02d", int(p.Date.Day())), nil
|
||||
return fmt.Sprintf("%02d", p.Date.Day()), nil
|
||||
case "weekday":
|
||||
return strconv.Itoa(int(p.Date.Weekday())), nil
|
||||
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 {
|
||||
|
@@ -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 {
|
||||
target = file
|
||||
break
|
||||
@@ -1899,7 +1899,7 @@ func (s *Site) permalink(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 {
|
||||
|
@@ -197,7 +197,7 @@ func checkCandidateSrcset(l *absurllexer) {
|
||||
section := l.content[l.pos+len(m.quote) : l.pos+posLastQuote+1]
|
||||
|
||||
fields := bytes.Fields(section)
|
||||
l.w.Write([]byte(m.quote))
|
||||
l.w.Write(m.quote)
|
||||
for i, f := range fields {
|
||||
if f[0] == '/' {
|
||||
l.w.Write(l.path)
|
||||
|
Reference in New Issue
Block a user