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 citation suppresses title when no author provided #144

Merged
merged 2 commits into from
Apr 8, 2024

Conversation

AstrickHarren
Copy link
Contributor

@AstrickHarren AstrickHarren commented Mar 20, 2024

From typst/citationberg#4 (comment)

I found the problem is due to substitute and choose working together. (Its actually a problem of typst/hayagriva)

  1. substitute will cause any subsequent query to variables, in this case, the title, suppressed if that variable is queried once before.

  2. choose actually calls query to title two times, the first time to find out which branch makes sense and the second to render.

  3. therefore the second time is suppressed and resulting in no title.

A simple fix can be to do a silent lookup on the first query of choose, much like what is done in Test::will_have_info(..).

This is the output from OP's bib after applying the fix:

Definition and objectives of systems development. (2016, January 19). https://www.opentextbooks.org.hk/ditatopic/25323

However, the journal part does not seem to be there, which I think is not there even with author specified.

Fixes typst/citationberg#4
Fixes #139

@AstrickHarren
Copy link
Contributor Author

As tests seems to build up, I think I can help with reorganizing them into functions/macros as well :)

@reknih reknih merged commit 4c97279 into typst:main Apr 8, 2024
1 check passed
@reknih
Copy link
Member

reknih commented Apr 8, 2024

Thank you!

As tests seems to build up, I think I can help with reorganizing them into functions/macros as well :)

That would be fantastic! I also aim to increase compliance with the citeproc test suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants