mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
Some godoc adjustments and image struct renames
This commit is contained in:
@@ -22,9 +22,11 @@ import (
|
||||
"github.com/gohugoio/hugo/resources/resource"
|
||||
)
|
||||
|
||||
// Pages is a slice of pages. This is the most common list type in Hugo.
|
||||
// Pages is a slice of Page objects. This is the most common list type in Hugo.
|
||||
type Pages []Page
|
||||
|
||||
// String returns a string representation of the list.
|
||||
// For internal use.
|
||||
func (ps Pages) String() string {
|
||||
return fmt.Sprintf("Pages(%d)", len(ps))
|
||||
}
|
||||
@@ -37,7 +39,8 @@ func (ps Pages) shuffle() {
|
||||
}
|
||||
}
|
||||
|
||||
// ToResources wraps resource.ResourcesConverter
|
||||
// ToResources wraps resource.ResourcesConverter.
|
||||
// For internal use.
|
||||
func (pages Pages) ToResources() resource.Resources {
|
||||
r := make(resource.Resources, len(pages))
|
||||
for i, p := range pages {
|
||||
@@ -86,10 +89,12 @@ func ToPages(seq any) (Pages, error) {
|
||||
return nil, fmt.Errorf("cannot convert type %T to Pages", seq)
|
||||
}
|
||||
|
||||
// Group groups the pages in in by key.
|
||||
// This implements collections.Grouper.
|
||||
func (p Pages) Group(key any, in any) (any, error) {
|
||||
pages, err := ToPages(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return PageGroup{}, err
|
||||
}
|
||||
return PageGroup{Key: key, Pages: pages}, nil
|
||||
}
|
||||
@@ -100,6 +105,7 @@ func (p Pages) Len() int {
|
||||
}
|
||||
|
||||
// ProbablyEq wraps compare.ProbablyEqer
|
||||
// For internal use.
|
||||
func (pages Pages) ProbablyEq(other any) bool {
|
||||
otherPages, ok := other.(Pages)
|
||||
if !ok {
|
||||
|
Reference in New Issue
Block a user