fix nav sorting (sort files by their stems)
also remove forgotten debug println
This commit is contained in:
parent
51cd56f351
commit
77859cd2ee
1 changed files with 12 additions and 11 deletions
23
src/main.rs
23
src/main.rs
|
@ -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
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue