feat: Print filenames in webpage, not full paths

This commit is contained in:
Dendy 2024-09-19 08:16:54 +02:00
parent 6983603a77
commit 90c6839d5d
2 changed files with 13 additions and 1 deletions

View File

@ -27,6 +27,17 @@ pub struct FileEntry {
pub tags: Vec<String>,
}
impl FileEntry {
pub fn filename(&self) -> &str {
Path::new(&self.path)
.file_name()
.to_owned()
.unwrap()
.to_str()
.unwrap()
}
}
fn load_tag_file(path: &PathBuf) -> Result<TagFile, Box<dyn std::error::Error>> {
let mut file = File::open(path)?;
let mut contents = String::new();

View File

@ -4,6 +4,7 @@
<style>
ul, p, h1, h2, h3, h4 {
margin: 0px;
padding: 0px;
}
li {
@ -30,7 +31,7 @@
<ul style="display: flex; flex-direction: column; gap: 20px;">
{% for file in files -%}
<li>
<p>{{ file.path }}<p>
<p>{{ file.filename() }}<p>
<ul
style="
display: flex;