Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sorting citation by citation number #168

Merged
merged 5 commits into from
Aug 6, 2024
Merged

Conversation

lluchs
Copy link
Contributor

@lluchs lluchs commented May 16, 2024

Citations with citation numbers currently aren't sorted properly, for example output from the test in the second commit:

Expected:
[1]–[4]
[1]–[4]

Got:
[1]–[4]
[2], [1], [4], [3]

This PR defers sorting the citations until finish is called and the citation numbers are determined.

Fixes #115

lluchs added 2 commits May 17, 2024 00:54
We need to defer sorting the citations until the citation numbers are
assigned.

Fixes typst#115
Citation number sorting is coverd in the test suite only by CITATIONS
tests which we do not support. This commit adds support for local test
cases and adapts one such test to use CITATION-ITEMS.
@AnsgarLichter
Copy link

I just wondered why my citations are not sorted properly and I have these weird combinations sometimes. Thanks for your PR, now I know that I should have configured my CSL in the right way. Hope this gets merged soon 👍

@Enivex
Copy link

Enivex commented Aug 1, 2024

I believe this would close #115

@PgBiel PgBiel merged commit f70041f into typst:main Aug 6, 2024
1 check passed
@PgBiel
Copy link
Contributor

PgBiel commented Aug 6, 2024

Thank you! 💙

danilasar pushed a commit to danilasar/hayagriva that referenced this pull request Dec 31, 2024
* Fix sorting citation by citation number

We need to defer sorting the citations until the citation numbers are
assigned.

* Add local test for sorting by citation number

Citation number sorting is coverd in the test suite only by CITATIONS
tests which we do not support. This commit adds support for local test
cases and adapts one such test to use CITATION-ITEMS.

* use generics for citation number

* move local tests to tests/local

---------

Co-authored-by: PgBiel <[email protected]>
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.

Merged citations aren't sorted in increasing order
4 participants