Sort working
Former-commit-id: 82fb8c7c1e2fe754e7da9a26a800a7814e562033 [formerly 4bca5432790eef9a06bda1a3779b060c0ee8717c] [formerly 2dd333885a261827f95692a8d68dfdf81f81a303 [formerly ce6557997ab17440253e8649b7c0209942475a4b]] Former-commit-id: cfbf8f1a49e5cde20ec71edd1d61389bd1f820c6 [formerly 94762c33a82b2b1a8fbd1c1969dc8d0f4dfce1d5] Former-commit-id: 623a70bda4ea4b7a821ca756234addcb97dfb1c3
This commit is contained in:
16
file.go
16
file.go
@@ -313,8 +313,6 @@ func (l listing) ApplySort() {
|
||||
sort.Sort(sort.Reverse(byName(l)))
|
||||
case "size":
|
||||
sort.Sort(sort.Reverse(bySize(l)))
|
||||
case "time":
|
||||
sort.Sort(sort.Reverse(byTime(l)))
|
||||
default:
|
||||
// If not one of the above, do nothing
|
||||
return
|
||||
@@ -325,8 +323,6 @@ func (l listing) ApplySort() {
|
||||
sort.Sort(byName(l))
|
||||
case "size":
|
||||
sort.Sort(bySize(l))
|
||||
case "time":
|
||||
sort.Sort(byTime(l))
|
||||
default:
|
||||
sort.Sort(byName(l))
|
||||
return
|
||||
@@ -337,7 +333,6 @@ func (l listing) ApplySort() {
|
||||
// Implement sorting for listing
|
||||
type byName listing
|
||||
type bySize listing
|
||||
type byTime listing
|
||||
|
||||
// By Name
|
||||
func (l byName) Len() int {
|
||||
@@ -382,17 +377,6 @@ func (l bySize) Less(i, j int) bool {
|
||||
return iSize < jSize
|
||||
}
|
||||
|
||||
// By Time
|
||||
func (l byTime) Len() int {
|
||||
return len(l.Items)
|
||||
}
|
||||
func (l byTime) Swap(i, j int) {
|
||||
l.Items[i], l.Items[j] = l.Items[j], l.Items[i]
|
||||
}
|
||||
func (l byTime) Less(i, j int) bool {
|
||||
return l.Items[i].ModTime.Before(l.Items[j].ModTime)
|
||||
}
|
||||
|
||||
var textExtensions = [...]string{
|
||||
".md", ".markdown", ".mdown", ".mmark",
|
||||
".asciidoc", ".adoc", ".ad",
|
||||
|
||||
Reference in New Issue
Block a user