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

Only first key in multiple key if-clause is parsed #258

Open
PancakeFriday opened this issue Dec 12, 2024 · 5 comments
Open

Only first key in multiple key if-clause is parsed #258

PancakeFriday opened this issue Dec 12, 2024 · 5 comments

Comments

@PancakeFriday
Copy link

Description

I am using the american-physics-society bibliography style and I noticed that webpages aren't formatted correctly. So I downloaded the csl file and it has the following else-if clause:

<else-if type="post-weblog interview manuscript pamphlet personal_communication post post-weblog speech webpage">

However, in the bibtex file @online or @webpage does not descend into this block and is instead caught in the else at the very end. If I modify the else-if to the following:

<else-if type="webpage">

then the entry is parsed correctly; the typst pdf now renders the url as well.

@Drodt
Copy link
Contributor

Drodt commented Dec 16, 2024

The problem seems to me that the else-if has the match="all" attribute implicitly. This means that all conditions must be met and the way havagriva checks this is by treating all types as unique conditions. So, for this to work, the entry must have the type "post-weblob, interview, ..." all at the same time.

This seems wrong to me, but the spec is unclear. I'll check how citeproc does it.

@Drodt
Copy link
Contributor

Drodt commented Dec 16, 2024

As a quick work-around: Just add match="any"

@Drodt
Copy link
Contributor

Drodt commented Dec 16, 2024

Hayagriva's behavior seems right. You should add the match=any part. Maybe raise an issue in the CSL styles repository so it can be fixed over there as well.

@PancakeFriday
Copy link
Author

Okay I think there is some confusion with the specs, but I agree with you and I will raise the issue. I used the visual editor https://editor.citationstyles.org/codeEditor/ and there, this works:

<else-if type="figure interview manuscript pamphlet personal_communication post post-weblog speech webpage" match="all">

This works (since URL is present)

<else-if type="figure interview manuscript pamphlet personal_communication post post-weblog speech webpage" match="all" variable="URL">

This does not work (since collection-title is not present)

<else-if type="figure interview manuscript pamphlet personal_communication post post-weblog speech webpage" match="all" variable="URL collection-title">

I'm wondering if match always only matches one of the types (since at least for BibTeX you can only have one type anyways). But I couldn't find that in the specs. However in either case, the american-physics-society.csl is incosistent because it has match="any" on all other else-ifs. Thanks for your help, I'll post the issue here https://github.com/citation-style-language/styles

@PancakeFriday
Copy link
Author

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

No branches or pull requests

2 participants