Fix deprecation printing on info level

Fixes #11638
This commit is contained in:
Bjørn Erik Pedersen
2023-10-31 09:25:28 +01:00
parent 23fcfb7f74
commit ab21433689
5 changed files with 56 additions and 6 deletions

View File

@@ -24,6 +24,7 @@ import (
"github.com/spf13/cast"
"github.com/yuin/goldmark/util"
"github.com/gohugoio/hugo/common/hugo"
"github.com/gohugoio/hugo/deps"
)
@@ -156,3 +157,26 @@ func (t *timer) Stop() string {
// This is used in templates, we need to return something.
return ""
}
// Internal template func, used in tests only.
func (ns *Namespace) TestDeprecationInfo(item, alternative string) string {
v := hugo.CurrentVersion
hugo.Deprecate(item, alternative, v.String())
return ""
}
// Internal template func, used in tests only.
func (ns *Namespace) TestDeprecationWarn(item, alternative string) string {
v := hugo.CurrentVersion
v.Minor -= 6
hugo.Deprecate(item, alternative, v.String())
return ""
}
// Internal template func, used in tests only.
func (ns *Namespace) TestDeprecationErr(item, alternative string) string {
v := hugo.CurrentVersion
v.Minor -= 12
hugo.Deprecate(item, alternative, v.String())
return ""
}