mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
tpl/data: Deprecate data.GetJSON and data.GetCSV
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gohugoio/hugo/cache/filecache"
|
"github.com/gohugoio/hugo/cache/filecache"
|
||||||
|
"github.com/gohugoio/hugo/common/hugo"
|
||||||
"github.com/gohugoio/hugo/common/maps"
|
"github.com/gohugoio/hugo/common/maps"
|
||||||
"github.com/gohugoio/hugo/config/security"
|
"github.com/gohugoio/hugo/config/security"
|
||||||
|
|
||||||
@@ -63,6 +64,8 @@ type Namespace struct {
|
|||||||
// If you provide multiple parts for the URL they will be joined together to the final URL.
|
// If you provide multiple parts for the URL they will be joined together to the final URL.
|
||||||
// GetCSV returns nil or a slice slice to use in a short code.
|
// GetCSV returns nil or a slice slice to use in a short code.
|
||||||
func (ns *Namespace) GetCSV(sep string, args ...any) (d [][]string, err error) {
|
func (ns *Namespace) GetCSV(sep string, args ...any) (d [][]string, err error) {
|
||||||
|
hugo.Deprecate("data.GetJSON", "use resources.Get or resources.GetRemote with transform.Unmarshal.", "v0.123.0")
|
||||||
|
|
||||||
url, headers := toURLAndHeaders(args)
|
url, headers := toURLAndHeaders(args)
|
||||||
cache := ns.cacheGetCSV
|
cache := ns.cacheGetCSV
|
||||||
|
|
||||||
@@ -102,6 +105,8 @@ func (ns *Namespace) GetCSV(sep string, args ...any) (d [][]string, err error) {
|
|||||||
// If you provide multiple parts they will be joined together to the final URL.
|
// If you provide multiple parts they will be joined together to the final URL.
|
||||||
// GetJSON returns nil or parsed JSON to use in a short code.
|
// GetJSON returns nil or parsed JSON to use in a short code.
|
||||||
func (ns *Namespace) GetJSON(args ...any) (any, error) {
|
func (ns *Namespace) GetJSON(args ...any) (any, error) {
|
||||||
|
hugo.Deprecate("data.GetJSON", "use resources.Get or resources.GetRemote with transform.Unmarshal.", "v0.123.0")
|
||||||
|
|
||||||
var v any
|
var v any
|
||||||
url, headers := toURLAndHeaders(args)
|
url, headers := toURLAndHeaders(args)
|
||||||
cache := ns.cacheGetJSON
|
cache := ns.cacheGetJSON
|
||||||
|
Reference in New Issue
Block a user