hugolib: Update deprecation vs Hugo 0.20

Fixes #3271
This commit is contained in:
Bjørn Erik Pedersen 2017-04-07 10:48:09 +02:00
parent af99a59021
commit 9580872459
2 changed files with 1 additions and 35 deletions

View file

@ -1507,7 +1507,7 @@ func (p *Page) copy() *Page {
func (p *Page) Now() time.Time { func (p *Page) Now() time.Time {
// Delete in Hugo 0.21 // Delete in Hugo 0.21
helpers.Deprecated("Page", "Now", "Use now (the template func)", false) helpers.Deprecated("Page", "Now", "Use now (the template func)", true)
return time.Now() return time.Now()
} }
@ -1515,13 +1515,6 @@ func (p *Page) Hugo() *HugoInfo {
return hugoInfo return hugoInfo
} }
func (p *Page) RSSlink() template.URL {
// TODO(bep) we cannot have two of these
// Remove in Hugo 0.20
helpers.Deprecated(".Page", "RSSlink", "Use RSSLink", true)
return p.RSSLink()
}
func (p *Page) Ref(refs ...string) (string, error) { func (p *Page) Ref(refs ...string) (string, error) {
if len(refs) == 0 { if len(refs) == 0 {
return "", nil return "", nil

View file

@ -376,33 +376,6 @@ func (s *SiteInfo) Param(key interface{}) (interface{}, error) {
return s.Params[keyStr], nil return s.Params[keyStr], nil
} }
// GetParam gets a site parameter value if found, nil if not.
func (s *SiteInfo) GetParam(key string) interface{} {
// Remove in Hugo 0.20
helpers.Deprecated("SiteInfo", ".GetParam", "Use .Param", true)
v := s.Params[strings.ToLower(key)]
if v == nil {
return nil
}
switch val := v.(type) {
case bool:
return val
case string:
return val
case int64, int32, int16, int8, int:
return cast.ToInt(v)
case float64, float32:
return cast.ToFloat64(v)
case time.Time:
return val
case []string:
return v
}
return nil
}
func (s *SiteInfo) IsMultiLingual() bool { func (s *SiteInfo) IsMultiLingual() bool {
return len(s.Languages) > 1 return len(s.Languages) > 1
} }