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
|
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)
|
||||||
None => -1,
|
});
|
||||||
Some(ext) => {
|
files.sort_by_key(|p| match p.extension() {
|
||||||
if ext == "md" {
|
None => -1,
|
||||||
0
|
Some(ext) => {
|
||||||
} else {
|
if ext == "md" {
|
||||||
1
|
0
|
||||||
}
|
} else {
|
||||||
|
1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue