sort all non-md files at the end in nav

This commit is contained in:
Tomáš Mládek 2021-03-06 12:09:34 +01:00
parent 7f0ad4c71b
commit c452dc8535

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."));