From 1fbdbda5380b09ebe547d8a89e2f706aed7aff92 Mon Sep 17 00:00:00 2001 From: trivernis Date: Fri, 4 Sep 2020 18:39:23 +0200 Subject: [PATCH] Add formatting implementation for TechReport Signed-off-by: trivernis --- src/references/bibliography.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/references/bibliography.rs b/src/references/bibliography.rs index 969ee45..445ccb6 100644 --- a/src/references/bibliography.rs +++ b/src/references/bibliography.rs @@ -8,6 +8,7 @@ use bibliographix::bibliography::bib_types::in_collection::InCollection; use bibliographix::bibliography::bib_types::manual::Manual; use bibliographix::bibliography::bib_types::misc::Misc; use bibliographix::bibliography::bib_types::repository::Repository; +use bibliographix::bibliography::bib_types::tech_report::TechReport; use bibliographix::bibliography::bib_types::BibliographyType; use bibliographix::bibliography::bibliography_entry::{ BibliographyEntry, BibliographyEntryReference, @@ -58,6 +59,7 @@ fn get_item_for_entry(entry: BibliographyEntryReference) -> ListItem { BibliographyType::Manual(m) => get_item_for_manual(&*entry, m), BibliographyType::Misc(m) => get_item_for_misc(&*entry, m), BibliographyType::Repository(r) => get_item_for_repository(&*entry, r), + BibliographyType::TechReport(tr) => get_item_for_tech_report(&*entry, tr), _ => unimplemented!(), } } @@ -291,3 +293,19 @@ fn get_item_for_repository(entry: &BibliographyEntry, r: &Repository) -> ListIte ListItem::new(Line::Text(text), 0, true) } + +fn get_item_for_tech_report(entry: &BibliographyEntry, tr: &TechReport) -> ListItem { + let mut text = TextLine::new(); + text.subtext + .push(bold_text!(format!("{}: ", entry.key().clone()))); + text.subtext + .push(plain_text!(format!("{}.", tr.author.clone()))); + text.subtext + .push(plain_text!(format!("\"{}\"", tr.title.clone()))); + text.subtext + .push(plain_text!(format!("by {}", tr.institution.clone()))); + text.subtext + .push(plain_text!(format!(" on {}", tr.date.format("%d.%m.%y")))); + + ListItem::new(Line::Text(text), 0, true) +}