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>,
|
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>> {
|
fn load_tag_file(path: &PathBuf) -> Result<TagFile, Box<dyn std::error::Error>> {
|
||||||
let mut file = File::open(path)?;
|
let mut file = File::open(path)?;
|
||||||
let mut contents = String::new();
|
let mut contents = String::new();
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<style>
|
<style>
|
||||||
ul, p, h1, h2, h3, h4 {
|
ul, p, h1, h2, h3, h4 {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
li {
|
li {
|
||||||
|
@ -30,7 +31,7 @@
|
||||||
<ul style="display: flex; flex-direction: column; gap: 20px;">
|
<ul style="display: flex; flex-direction: column; gap: 20px;">
|
||||||
{% for file in files -%}
|
{% for file in files -%}
|
||||||
<li>
|
<li>
|
||||||
<p>{{ file.path }}<p>
|
<p>{{ file.filename() }}<p>
|
||||||
<ul
|
<ul
|
||||||
style="
|
style="
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
Loading…
Reference in New Issue