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
View file

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