summaryrefslogtreecommitdiffstats
path: root/tpl
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-10-31 09:25:28 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-10-31 10:42:23 +0100
commitab21433689093a87db68666845d736ad492a056f (patch)
tree70828119c97f18143b41aa8bc904a2d889bf16c6 /tpl
parent23fcfb7f741a417f53a8ef4997bb68e64631df01 (diff)
Fix deprecation printing on info level
Fixes #11638
Diffstat (limited to 'tpl')
-rw-r--r--tpl/debug/debug.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/tpl/debug/debug.go b/tpl/debug/debug.go
index dd0593e27..f603dd94d 100644
--- a/tpl/debug/debug.go
+++ b/tpl/debug/debug.go
@@ -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 ""
+}