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,10 +282,12 @@ fn update_garden<P: AsRef<Path>>(
None None
}) })
.collect(); .collect();
files.sort(); files.sort_by(move |a, b| {
files.sort_by_key(|p| { let a_sort = a.file_stem().unwrap_or_else(|| a.as_os_str());
println!("{:?}", p); let b_sort = b.file_stem().unwrap_or_else(|| b.as_os_str());
match p.extension() { a_sort.cmp(b_sort)
});
files.sort_by_key(|p| match p.extension() {
None => -1, None => -1,
Some(ext) => { Some(ext) => {
if ext == "md" { if ext == "md" {
@ -294,7 +296,6 @@ fn update_garden<P: AsRef<Path>>(
1 1
} }
} }
}
}); });
if files.is_empty() { if files.is_empty() {