feat: Print filenames in webpage, not full paths
This commit is contained in:
parent
6983603a77
commit
90c6839d5d
11
src/utils.rs
11
src/utils.rs
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue