shithub: hugo

Download patch

ref: 627d016cc95d355f54e9565c44bfef419e0c7044
parent: 40a92a062ddc6204db6e2c6cbdb5094c1068fc72
author: Ariejan de Vroom <[email protected]>
date: Wed Jun 10 19:58:57 EDT 2015

Refactor var name limit to index

--- a/tpl/template_funcs.go
+++ b/tpl/template_funcs.go
@@ -390,19 +390,19 @@
 
 // After is exposed to templates, to iterate over all the items after N in a
 // rangeable list. It's meant to accompany First
-func After(limit interface{}, seq interface{}) (interface{}, error) {
+func After(index interface{}, seq interface{}) (interface{}, error) {
 
-	if limit == nil || seq == nil {
+	if index == nil || seq == nil {
 		return nil, errors.New("both limit and seq must be provided")
 	}
 
-	limitv, err := cast.ToIntE(limit)
+	indexv, err := cast.ToIntE(index)
 
 	if err != nil {
 		return nil, err
 	}
 
-	if limitv < 1 {
+	if indexv < 1 {
 		return nil, errors.New("can't return negative/empty count of items from sequence")
 	}
 
@@ -418,10 +418,10 @@
 	default:
 		return nil, errors.New("can't iterate over " + reflect.ValueOf(seq).Type().String())
 	}
-	if limitv >= seqv.Len() {
+	if indexv >= seqv.Len() {
 		return nil, errors.New("no items left")
 	}
-	return seqv.Slice(limitv, seqv.Len()).Interface(), nil
+	return seqv.Slice(indexv, seqv.Len()).Interface(), nil
 }
 
 var (