1
0
Fork 0
mirror of https://git.sr.ht/~adnano/kiln synced 2024-06-01 09:36:06 +02: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 Adnan Maolood
parent 820ab25a26
commit 3667c41c57

13
dir.go
View File

@ -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 {