commit b15eb889e8c05885d6a58dc4f49eb5005e8b9c0b
parent 41b28462e8f427a6a2a9e4efa81a48eee7e0124b
Author: spf13 <steve.francia@gmail.com>
Date: Fri, 29 Aug 2014 23:50:25 -0400
Adding .Reverse() to PagesGroup
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/hugolib/pageGroup.go b/hugolib/pageGroup.go
@@ -17,6 +17,7 @@ import (
"errors"
"reflect"
"sort"
+ "strings"
)
type PageGroup struct {
@@ -62,6 +63,16 @@ func sortKeys(v []reflect.Value, order string) []reflect.Value {
}
func (p Pages) GroupBy(key, order string) ([]PageGroup, error) {
+type PagesGroup []PageGroup
+
+func (p PagesGroup) Reverse() PagesGroup {
+ for i, j := 0, len(p)-1; i < j; i, j = i+1, j-1 {
+ p[i], p[j] = p[j], p[i]
+ }
+
+ return p
+}
+
if len(p) < 1 {
return nil, nil
}