projects
/
brevno-suite
/
hugo
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
be3a350
)
Allow to reverse taxonomy entries.
author
David Calavera
<david.calavera@gmail.com>
Sat, 9 May 2015 22:21:30 +0000
(15:21 -0700)
committer
bep
<bjorn.erik.pedersen@gmail.com>
Tue, 12 May 2015 16:26:40 +0000
(18:26 +0200)
hugolib/taxonomy.go
patch
|
blob
|
history
diff --git
a/hugolib/taxonomy.go
b/hugolib/taxonomy.go
index 0602e03b43f120d329d15ff0a05f495a71fdb615..1cab1a1ebeb7e265ec2ad972ab8e0499ca764687 100644
(file)
--- a/
hugolib/taxonomy.go
+++ b/
hugolib/taxonomy.go
@@
-116,6
+116,14
@@
func (ie OrderedTaxonomyEntry) Term() string {
return ie.Name
}
+func (t OrderedTaxonomy) Reverse() OrderedTaxonomy {
+ for i, j := 0, len(t)-1; i < j; i, j = i+1, j-1 {
+ t[i], t[j] = t[j], t[i]
+ }
+
+ return t
+}
+
/*
* Implementation of a custom sorter for OrderedTaxonomies
*/