1
0
mirror of https://git.sr.ht/~adnano/kiln synced 2024-12-04 06:38:18 +01:00

Fix post ordering by Weight, reversed Date and FilePath.

This commit is contained in:
Ian M. Jones 2021-05-18 20:00:16 +01:00 committed by adnano
parent 4b23a11d0b
commit 5592026db7

13
dir.go

@ -262,8 +262,17 @@ func (d *Dir) write(dstDir string, task *Task) error {
func (d *Dir) sort() {
sort.Slice(d.Pages, func(i, j int) bool {
pi, pj := d.Pages[i], d.Pages[j]
return pi.Weight < pj.Weight || pi.Date.After(pj.Date) ||
pi.FilePath < pj.FilePath
return pi.FilePath < pj.FilePath
})
sort.SliceStable(d.Pages, func(i, j int) bool {
pi, pj := d.Pages[i], d.Pages[j]
return pi.Date.After(pj.Date)
})
sort.SliceStable(d.Pages, func(i, j int) bool {
pi, pj := d.Pages[i], d.Pages[j]
return pi.Weight < pj.Weight
})
for i := range d.Pages {