fix nav sorting (sort files by their stems)

also remove forgotten debug println
This commit is contained in:
Tomáš Mládek 2021-03-10 23:42:53 +01:00
parent 51cd56f351
commit 77859cd2ee

View file

@ -282,17 +282,18 @@ fn update_garden<P: AsRef<Path>>(
None
})
.collect();
files.sort();
files.sort_by_key(|p| {
println!("{:?}", p);
match p.extension() {
None => -1,
Some(ext) => {
if ext == "md" {
0
} else {
1
}
files.sort_by(move |a, b| {
let a_sort = a.file_stem().unwrap_or_else(|| a.as_os_str());
let b_sort = b.file_stem().unwrap_or_else(|| b.as_os_str());
a_sort.cmp(b_sort)
});
files.sort_by_key(|p| match p.extension() {
None => -1,
Some(ext) => {
if ext == "md" {
0
} else {
1
}
}
});