Add article source

main
trivernis 4 years ago
parent 3efe9df1c4
commit dec84de7ce

@ -7,3 +7,4 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
chrono = "0.4.15"

@ -0,0 +1,28 @@
use chrono::{Local, Date};
/// An article source
#[derive(Clone, Debug)]
pub struct Article {
pub author: String,
pub title: String,
pub journal: String,
pub date: Date<Local>,
pub volume: Option<String>,
pub number: Option<String>,
pub pages: Option<String>,
}
impl Article {
/// Creates a new article with the mandatory fields filled
pub fn new(author: String, title: String, journal: String, date: Date<Local>) -> Self {
Self {
author,
title,
journal,
date,
volume: None,
number: None,
pages: None,
}
}
}

@ -1,7 +1,11 @@
use crate::bibliography::bib_types::article::Article;
pub mod article;
/// A type of bibliography entry /// A type of bibliography entry
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum BibliographyType { pub enum BibliographyType {
Article, Article(Article),
Book, Book,
Booklet, Booklet,
InBook, InBook,

@ -5,8 +5,8 @@ use crate::bibliography::bib_types::BibliographyType;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct BibliographyEntry { pub struct BibliographyEntry {
key: String, key: String,
note: Option<String>, pub note: Option<String>,
bib_type: BibliographyType, pub bib_type: BibliographyType,
} }
pub type BibliographyEntryReference = Arc<Mutex<BibliographyEntry>>; pub type BibliographyEntryReference = Arc<Mutex<BibliographyEntry>>;

Loading…
Cancel
Save