Skip to content

Commit

Permalink
Check if there is a date
Browse files Browse the repository at this point in the history
  • Loading branch information
reknih committed Oct 10, 2024
1 parent 63a02a1 commit a36ae16
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/csl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -759,9 +759,21 @@ fn disambiguate_year_suffix<F, T>(
F: FnMut(&T, DisambiguateState),
{
if renders.iter().flat_map(|r| r.items.iter()).any(|i| {
let entry_has_date = i
.entry
.resolve_date_variable(DateVariable::Issued)
.or_else(|| i.entry.resolve_date_variable(DateVariable::Accessed))
.or_else(|| i.entry.resolve_date_variable(DateVariable::AvailableDate))
.or_else(|| i.entry.resolve_date_variable(DateVariable::EventDate))
.or_else(|| i.entry.resolve_date_variable(DateVariable::Submitted))
.or_else(|| i.entry.resolve_date_variable(DateVariable::OriginalDate))
.is_some();

i.rendered
.find_elem_by(&|e| {
e.meta == Some(ElemMeta::Date) || e.meta == Some(ElemMeta::CitationLabel)
// The citation label will contain the date if there is one.
e.meta == Some(ElemMeta::Date)
|| (entry_has_date && e.meta == Some(ElemMeta::CitationLabel))
})
.is_some()
}) && group.iter().any(|&(cite_idx, item_idx)| {
Expand Down

0 comments on commit a36ae16

Please sign in to comment.