Skip to content

Commit

Permalink
Merge branch 'main' into csl-page
Browse files Browse the repository at this point in the history
  • Loading branch information
DerDrodt authored Jan 12, 2024
2 parents dbd9e1a + 6d8ff35 commit 0e1ac3d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2516,14 +2516,21 @@ impl InheritableNameOptions {
impl NameOptions<'_> {
/// Whether the nth name is suppressed given the number of names and this
/// configuration.
pub fn is_suppressed(&self, idx: usize, length: usize) -> bool {
pub fn is_suppressed(&self, idx: usize, length: usize, is_subsequent: bool) -> bool {
// This is not suppressed if we print the last element and this is it.
if self.et_al_use_last && idx + 1 >= length {
return false;
}

let et_al_min = self.et_al_min.map_or(usize::MAX, |u| u as usize);
let et_al_use_first = self.et_al_use_first.map_or(usize::MAX, |u| u as usize);
// If this is a subsequnt citation of the same item, use other CSL options
let (et_al_min, et_al_use_first) = if is_subsequent {
(self.et_al_subsequent_min, self.et_al_subsequent_use_first)
} else {
(self.et_al_min, self.et_al_use_first)
};

let et_al_min = et_al_min.map_or(usize::MAX, |u| u as usize);
let et_al_use_first = et_al_use_first.map_or(usize::MAX, |u| u as usize);

length >= et_al_min && idx + 1 > et_al_use_first
}
Expand Down

0 comments on commit 0e1ac3d

Please sign in to comment.