natural sort (#474)

This commit is contained in:
Dawid 'DeyV' Polak 2018-07-29 13:22:11 +02:00 committed by 1138-4EB
parent c6f60d298a
commit 202c9c97e5
3 changed files with 12 additions and 1 deletions

6
Gopkg.lock generated
View File

@ -214,6 +214,12 @@
revision = "c3beff4c2358b44d0493c7dda585e7db7ff28ae6" revision = "c3beff4c2358b44d0493c7dda585e7db7ff28ae6"
version = "v1.7.6" version = "v1.7.6"
[[projects]]
branch = "master"
name = "github.com/maruel/natural"
packages = ["."]
revision = "dbcb3e2e8cf10eb839718ba666ef1e21b1c8b847"
[[projects]] [[projects]]
name = "github.com/mholt/archiver" name = "github.com/mholt/archiver"
packages = ["."] packages = ["."]

View File

@ -61,6 +61,10 @@
name = "gopkg.in/natefinch/lumberjack.v2" name = "gopkg.in/natefinch/lumberjack.v2"
version = "2.1.0" version = "2.1.0"
[[constraint]]
branch = "master"
name = "github.com/maruel/natural"
[[override]] [[override]]
name = "github.com/russross/blackfriday" name = "github.com/russross/blackfriday"
version = "^1.0.0" version = "^1.0.0"

View File

@ -20,6 +20,7 @@ import (
"time" "time"
"github.com/gohugoio/hugo/parser" "github.com/gohugoio/hugo/parser"
"github.com/maruel/natural"
) )
// File contains the information about a particular file or directory. // 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 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 // By Size