natural sort (#474)
Former-commit-id: 9865271f38824fd4762253014a7855ee087d315f [formerly 17c1a5f7e2cbbea4f01ba394f6ae76ded22594f3] [formerly 2087a30cb8fa514b33d99fb9797a0751a8f532cd [formerly 202c9c97e5
]]
Former-commit-id: 513ed21a74e590d062f0974b0ea7af7381162df9 [formerly 3fb2617b7aa05abe93460e2ab25ba2369ce68095]
Former-commit-id: a038eda5003c044eeceeea46539f3673ebc16f95
pull/726/head
parent
bdfca1be33
commit
5e58c25aa4
|
@ -214,6 +214,12 @@
|
|||
revision = "c3beff4c2358b44d0493c7dda585e7db7ff28ae6"
|
||||
version = "v1.7.6"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/maruel/natural"
|
||||
packages = ["."]
|
||||
revision = "dbcb3e2e8cf10eb839718ba666ef1e21b1c8b847"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/mholt/archiver"
|
||||
packages = ["."]
|
||||
|
|
|
@ -61,6 +61,10 @@
|
|||
name = "gopkg.in/natefinch/lumberjack.v2"
|
||||
version = "2.1.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/maruel/natural"
|
||||
|
||||
[[override]]
|
||||
name = "github.com/russross/blackfriday"
|
||||
version = "^1.0.0"
|
||||
|
|
3
file.go
3
file.go
|
@ -20,6 +20,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/gohugoio/hugo/parser"
|
||||
"github.com/maruel/natural"
|
||||
)
|
||||
|
||||
// File contains the information about a particular file or directory.
|
||||
|
@ -372,7 +373,7 @@ func (l byName) Less(i, j int) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
return strings.ToLower(l.Items[i].Name) < strings.ToLower(l.Items[j].Name)
|
||||
return natural.Less(l.Items[i].Name, l.Items[j].Name)
|
||||
}
|
||||
|
||||
// By Size
|
||||
|
|
Loading…
Reference in New Issue