media: Add DecodeTypes

And clean up the media package.
This commit is contained in:
Bjørn Erik Pedersen
2017-04-03 22:39:37 +02:00
parent c9aee467d3
commit f8d555cca5
4 changed files with 202 additions and 14 deletions

View File

@@ -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)

View File

@@ -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 {