diff options
| author | lukeflo | 2024-10-07 16:15:49 +0200 |
|---|---|---|
| committer | lukeflo | 2024-10-12 22:41:38 +0200 |
| commit | c9e749f811b16f7ec352d2aa8773105af046fad8 (patch) | |
| tree | 812d5917d968226fb532aad5c6c2d2198d6a4c29 /src/backend/bib.rs | |
| parent | ff539341267df56d99d379066396f63fd7991bd6 (diff) | |
| download | bibiman-c9e749f811b16f7ec352d2aa8773105af046fad8.tar.gz bibiman-c9e749f811b16f7ec352d2aa8773105af046fad8.zip | |
add func for entry items, UI enhancement
- add functions to get url/doi and filepath
- get values for entry info from structs not by calling funcs again
Diffstat (limited to 'src/backend/bib.rs')
| -rw-r--r-- | src/backend/bib.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/backend/bib.rs b/src/backend/bib.rs index 957adb1..3e0e844 100644 --- a/src/backend/bib.rs +++ b/src/backend/bib.rs @@ -15,10 +15,10 @@ // along with this program. If not, see <https://www.gnu.org/licenses/>. ///// -use std::{fs, path::PathBuf}; - use biblatex::{self, Bibliography}; use biblatex::{ChunksExt, Type}; +use color_eyre::eyre::ErrReport; +use std::{fs, path::PathBuf}; // Set necessary fields // TODO: can surely be made more efficient/simpler @@ -128,6 +128,8 @@ pub struct BibiEntry { pub pubtype: String, pub keywords: String, pub citekey: String, + pub weblink: String, + pub filepath: String, } impl BibiEntry { @@ -139,6 +141,9 @@ impl BibiEntry { Self::get_pubtype(&citekey, &biblio), Self::get_keywords(&citekey, &biblio), citekey.to_string(), + Self::get_abstract(&citekey, &biblio), + Self::get_weblink(&citekey, &biblio), + Self::get_filepath(&citekey, &biblio), ] } @@ -265,13 +270,13 @@ impl BibiEntry { } } - pub fn get_filepath(citekey: &str, biblio: &Bibliography) -> PathBuf { + pub fn get_filepath(citekey: &str, biblio: &Bibliography) -> String { if let true = biblio.get(&citekey).unwrap().file().is_ok() { let file = biblio.get(&citekey).unwrap().file().unwrap(); - file.into() + file } else { let file = "".to_string(); - file.into() + file } } } |
