Add Website source type

Signed-off-by: trivernis <trivernis@protonmail.com>
main
trivernis 4 years ago
parent cbdc84ba79
commit e7c2253ff5
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -8,6 +8,7 @@ use crate::bibliography::bib_types::misc::Misc;
use crate::bibliography::bib_types::tech_report::TechReport; use crate::bibliography::bib_types::tech_report::TechReport;
use crate::bibliography::bib_types::thesis::Thesis; use crate::bibliography::bib_types::thesis::Thesis;
use crate::bibliography::bib_types::unpublished::Unpublished; use crate::bibliography::bib_types::unpublished::Unpublished;
use crate::bibliography::bib_types::website::Website;
use chrono::{Date, Local}; use chrono::{Date, Local};
pub mod article; pub mod article;
@ -20,6 +21,7 @@ pub mod misc;
pub mod tech_report; pub mod tech_report;
pub mod thesis; pub mod thesis;
pub mod unpublished; pub mod unpublished;
pub mod website;
pub type LocalDate = Date<Local>; pub type LocalDate = Date<Local>;
@ -36,6 +38,6 @@ pub enum BibliographyType {
TechReport(TechReport), TechReport(TechReport),
Unpublished(Unpublished), Unpublished(Unpublished),
Misc(Misc), Misc(Misc),
Url, Website(Website),
Repository, Repository,
} }

@ -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<String>,
pub author: Option<String>,
pub accessed_at: Option<LocalDate>,
pub date: Option<String>,
}
impl Website {
/// Creates a new website source
pub fn new(url: String) -> Self {
Self {
url,
title: None,
author: None,
accessed_at: None,
date: None,
}
}
}
Loading…
Cancel
Save