sort all non-md files at the end in nav

master
Tomáš Mládek 2021-03-06 12:09:34 +01:00
parent 7f0ad4c71b
commit c452dc8535
1 changed files with 13 additions and 0 deletions

View File

@ -283,6 +283,19 @@ fn update_garden<P: AsRef<Path>>(
})
.collect();
files.sort();
files.sort_by_key(|p| {
println!("{:?}", p);
match p.extension() {
None => -1,
Some(ext) => {
if ext == "md" {
0
} else {
1
}
}
}
});
if files.is_empty() {
return Err(anyhow!("Garden is empty."));