Skip to content

Commit

Permalink
feat: switch to Chicago style
Browse files Browse the repository at this point in the history
  • Loading branch information
kmaasrud committed May 26, 2023
1 parent dffd117 commit 988f842
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/pdf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::{
time::SystemTime,
};

use hayagriva::style::{Citation, Database, Ieee, Numerical};
use hayagriva::style::{Citation, Database, ChicagoAuthorDate};
use jotdown::{Container, Event, Parser, Render};
use rayon::prelude::*;

Expand Down Expand Up @@ -144,7 +144,7 @@ impl Builder {
}

let db = Arc::new(Mutex::new(Database::from_entries(self.bib.iter())));
let bib_style = Arc::new(Mutex::new(Numerical::new()));
let bib_style = Arc::new(Mutex::new(ChicagoAuthorDate::new()));
writeln!(w, r"\begin{{document}}")?;

if self.add_title {
Expand Down Expand Up @@ -189,9 +189,15 @@ impl Builder {
.into_iter()
.try_for_each(|s| w.write_all(&s))?;

for reference in db.lock().unwrap().bibliography(&Ieee::new(), None) {
writeln!(w, "{}", reference.display.value)?;
writeln!(w, r"\begin{{itemize}}")?;
for reference in db.lock().unwrap().bibliography(&ChicagoAuthorDate::new(), None) {
write!(w, r"\item")?;
if let Some(prefix) = reference.prefix {
write!(w, r"[{}]", prefix.value.replace('[', "\\["))?;
}
writeln!(w, r" {}", reference.display.value)?;
}
writeln!(w, r"\end{{itemize}}")?;

writeln!(w, r"\end{{document}}")?;

Expand Down

0 comments on commit 988f842

Please sign in to comment.