---
Thanks for adding reverse date ordering of posts Adnan.
However, it didn't work for me, looks like the sort isn't linear
enough. So the sorts need to be run one after the other starting
with the least important and using SortStable to keep progress.
Hope this makes sense. I'm very new to Go, so if there's a more
efficient way of doing this, please reject this patch!
Also, thanks so much for kiln, it's great stuff.
dir.go | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/dir.go b/dir.go
index d903761..e3437b1 100644
--- a/dir.go+++ b/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 {
--
2.17.1