mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-17 00:06:27 +03:00
renamed sorter to byDate.
This commit is contained in:
parent
7b29568eb1
commit
aa89f30f2a
1 changed files with 6 additions and 6 deletions
|
@ -28,12 +28,12 @@ type PageLink struct {
|
|||
Url string
|
||||
}
|
||||
|
||||
// pageLinkSorter sorts PageLink by newest date to oldest.
|
||||
type pageLinkSorter []PageLink
|
||||
// byDate sorts PageLink by newest date to oldest.
|
||||
type byDate []PageLink
|
||||
|
||||
func (p pageLinkSorter) Len() int { return len(p) }
|
||||
func (p pageLinkSorter) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
|
||||
func (p pageLinkSorter) Less(i, j int) bool { return p[i].Date.After(p[j].Date) }
|
||||
func (p byDate) Len() int { return len(p) }
|
||||
func (p byDate) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
|
||||
func (p byDate) Less(i, j int) bool { return p[i].Date.After(p[j].Date) }
|
||||
|
||||
type linkGen struct {
|
||||
generating bool
|
||||
|
@ -120,7 +120,7 @@ func (l *linkGen) generateLinks(md Markdown, cfg *Config) {
|
|||
})
|
||||
|
||||
// sort by newest date
|
||||
sort.Sort(pageLinkSorter(cfg.Links))
|
||||
sort.Sort(byDate(cfg.Links))
|
||||
cfg.Unlock()
|
||||
|
||||
l.Lock()
|
||||
|
|
Loading…
Reference in a new issue