Add formatting implementation for TechReport

Signed-off-by: trivernis <trivernis@protonmail.com>
feature/epub-rendering
trivernis 4 years ago
parent 9c7c89bcb0
commit 1fbdbda538
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -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)
}

Loading…
Cancel
Save