mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-01 22:42:45 +02:00
output: Add output formats decoder
And clean up the output package.
This commit is contained in:
@@ -15,10 +15,20 @@ package media
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Types []Type
|
||||
|
||||
func (t Types) GetByType(tp string) (Type, bool) {
|
||||
for _, tt := range t {
|
||||
if strings.EqualFold(tt.Type(), tp) {
|
||||
return tt, true
|
||||
}
|
||||
}
|
||||
return Type{}, false
|
||||
}
|
||||
|
||||
// A media type (also known as MIME type and content type) is a two-part identifier for
|
||||
// file formats and format contents transmitted on the Internet.
|
||||
// For Hugo's use case, we use the top-level type name / subtype name + suffix.
|
||||
|
Reference in New Issue
Block a user