From e7c2253ff51c477edf54869420c7f442c058d97b Mon Sep 17 00:00:00 2001 From: trivernis Date: Tue, 1 Sep 2020 21:17:52 +0200 Subject: [PATCH] Add Website source type Signed-off-by: trivernis --- src/bibliography/bib_types/mod.rs | 4 +++- src/bibliography/bib_types/website.rs | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/bibliography/bib_types/website.rs diff --git a/src/bibliography/bib_types/mod.rs b/src/bibliography/bib_types/mod.rs index d53ffb9..6cb70ad 100644 --- a/src/bibliography/bib_types/mod.rs +++ b/src/bibliography/bib_types/mod.rs @@ -8,6 +8,7 @@ use crate::bibliography::bib_types::misc::Misc; use crate::bibliography::bib_types::tech_report::TechReport; use crate::bibliography::bib_types::thesis::Thesis; use crate::bibliography::bib_types::unpublished::Unpublished; +use crate::bibliography::bib_types::website::Website; use chrono::{Date, Local}; pub mod article; @@ -20,6 +21,7 @@ pub mod misc; pub mod tech_report; pub mod thesis; pub mod unpublished; +pub mod website; pub type LocalDate = Date; @@ -36,6 +38,6 @@ pub enum BibliographyType { TechReport(TechReport), Unpublished(Unpublished), Misc(Misc), - Url, + Website(Website), Repository, } diff --git a/src/bibliography/bib_types/website.rs b/src/bibliography/bib_types/website.rs new file mode 100644 index 0000000..816870a --- /dev/null +++ b/src/bibliography/bib_types/website.rs @@ -0,0 +1,24 @@ +use crate::bibliography::bib_types::LocalDate; + +/// A website source that can only consists of an url +#[derive(Clone, Debug)] +pub struct Website { + pub url: String, + pub title: Option, + pub author: Option, + pub accessed_at: Option, + pub date: Option, +} + +impl Website { + /// Creates a new website source + pub fn new(url: String) -> Self { + Self { + url, + title: None, + author: None, + accessed_at: None, + date: None, + } + } +}