Some godoc adjustments and image struct renames

This commit is contained in:
Bjørn Erik Pedersen
2022-04-21 10:59:13 +02:00
parent 11047534e4
commit fa80fe3c8a
23 changed files with 193 additions and 90 deletions

View File

@@ -20,9 +20,16 @@ var _ Dated = Dates{}
// Dated wraps a "dated resource". These are the 4 dates that makes
// the date logic in Hugo.
type Dated interface {
// Date returns the date of the resource.
Date() time.Time
// Lastmod returns the last modification date of the resource.
Lastmod() time.Time
// PublishDate returns the publish date of the resource.
PublishDate() time.Time
// ExpiryDate returns the expiration date of the resource.
ExpiryDate() time.Time
}

View File

@@ -14,12 +14,9 @@
package resource
import (
"image"
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/langs"
"github.com/gohugoio/hugo/media"
"github.com/gohugoio/hugo/resources/images/exif"
"github.com/gohugoio/hugo/common/hugio"
)
@@ -82,26 +79,6 @@ type Resource interface {
ErrProvider
}
// Image represents an image resource.
type Image interface {
Resource
ImageOps
}
type ImageOps interface {
Height() int
Width() int
Crop(spec string) (Image, error)
Fill(spec string) (Image, error)
Fit(spec string) (Image, error)
Resize(spec string) (Image, error)
Filter(filters ...any) (Image, error)
Exif() *exif.Exif
// Internal
DecodeImage() (image.Image, error)
}
type ResourceTypeProvider interface {
// ResourceType is the resource type. For most file types, this is the main
// part of the MIME type, e.g. "image", "application", "text" etc.