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

When calculating bibType, consider the exact match first #133

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

DmitrySharabin
Copy link
Contributor

Hey there,

Thank you for this excellent library!

There is one issue I'd love to address in this PR. I stumbled on it, trying to parse the following bib item:

@online{eleventy,
  title = {Eleventy Is a Simpler Static Site Generator},
  author = {Leatherman, Zach},
  url = {https://www.11ty.dev/},
  urldate = {2024-07-22}
}

Currently, for this item, the parser returns the post-weblog type since it's the first one for which the following condition is true:

BibTypes[bType]["biblatex"] === biblatexType &&
(!biblatexSubtype ||
BibTypes[bType]["biblatex-subtype"] === biblatexSubtype)

However, there is the exact (and expected) match for this bib item among all the supported types:

online: {
order: 42,
biblatex: "online",
csl: "webpage",
required: ["date", "title", "url"],
eitheror: ["editor", "author"],
optional: [
"abstract",
"addendum",
"language",
"langid",
"note",
"organization",
"pubstate",
"shorttitle",
"subtitle",
"titleaddon",
"urldate",
"version",
"origtitle",
"annotation",
"keywords",
],
},

It would be nice if we could check for the exact match first (and return the corresponding type if it succeeded) before trying to find the most appropriate type and fall back to misc if everything fails.

What do you think?

@DmitrySharabin
Copy link
Contributor Author

Hey @johanneswilm,

Is there a chance you still accept PRs? Or is that no longer the case? I'm just asking to understand what I should do next if you don't.

Thanks!

Regards,
Dmitry

@johanneswilm
Copy link
Member

@DmitrySharabin You are right. This change makes a lot of sense.

@johanneswilm
Copy link
Member

@DmitrySharabin I will accept the change and publish a new version. This library is actively used. It's just one of several libraries I maintain, which is why I don't always get to review PRs right away.

@johanneswilm johanneswilm merged commit 0373496 into fiduswriter:main Aug 28, 2024
1 check failed
@DmitrySharabin
Copy link
Contributor Author

DmitrySharabin commented Aug 28, 2024

I will accept the change and publish a new version.

Thank you, @johanneswilm!

This library is actively used. It's just one of several libraries I maintain, which is why I don't always get to review PRs right away.

I totally get and appreciate it. 🙏

I'd love to propose a couple of additions, but we should probably discuss them in a separate issue.

@DmitrySharabin DmitrySharabin deleted the biblatex-bibtype branch August 28, 2024 08:39
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.

2 participants