mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
media: Add DecodeTypes
And clean up the media package.
This commit is contained in:
@@ -216,9 +216,9 @@ func (formats Formats) FromFilename(filename string) (f Format, found bool) {
|
||||
return
|
||||
}
|
||||
|
||||
// DecodeOutputFormats takes a list of output format configurations and merges those,
|
||||
// DecodeFormats takes a list of output format configurations and merges those,
|
||||
// in ther order given, with the Hugo defaults as the last resort.
|
||||
func DecodeOutputFormats(mediaTypes media.Types, maps ...map[string]interface{}) (Formats, error) {
|
||||
func DecodeFormats(mediaTypes media.Types, maps ...map[string]interface{}) (Formats, error) {
|
||||
f := make(Formats, len(DefaultFormats))
|
||||
copy(f, DefaultFormats)
|
||||
|
||||
|
@@ -174,7 +174,7 @@ func TestDecodeFormats(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
result, err := DecodeOutputFormats(mediaTypes, test.maps...)
|
||||
result, err := DecodeFormats(mediaTypes, test.maps...)
|
||||
if test.shouldError {
|
||||
require.Error(t, err, test.name)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user