Skip to content

Assign year suffixes in bibliography sort order (#469) - #565

Open
jay23606 wants to merge 2 commits into
typst:mainfrom
jay23606:pr-go/469-when-using-chicago-style-year-suffixes-a
Open

jay23606 wants to merge 2 commits into
typst:mainfrom
jay23606:pr-go/469-when-using-chicago-style-year-suffixes-a

Conversation

@jay23606

Copy link
Copy Markdown
Contributor

Problem

For Chicago-style year suffixes, Hayagriva assigns the suffixes (a, b, c, ...) in citation order. Chicago requires them to follow bibliography sort order. As a result, the bibliography can list Smith 2020c "X.", Smith 2020b "Y.", Smith 2020a "Z.", which is out of order.

Change

  • src/csl/mod.rs: disambiguate_year_suffix now receives the bibliography position of each entry (the same citation_number lookup used for sorting) and sorts the ambiguous entries by it before assigning suffixes.
  • tests/citeproc-pass.txt: adds disambiguate_YearSuffixAndSort and sort_ChicagoYearSuffix2, which now pass.

Testing

  • New regression test tests/local/disamb_Issue469.txt: three same-author, same-year entries (titles X, Y, Z) cited in the order Y, X, Z with a bibliography sorted by title. The expected output is (Smith, 2020b; Smith, 2020a; Smith, 2020c).
  • cargo test --test citeproc --features csl-json test_local_files passes with the fix.
  • cargo test --test citeproc --features csl-json passes (6 passed, including the two newly passing upstream tests).
  • cargo test --lib --features csl-json passes (70 passed).
  • cargo fmt --check passes.

Fixes #469

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When using Chicago Style, year suffixes are assigned incorrectly

1 participant