-
Notifications
You must be signed in to change notification settings - Fork 3
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
First stab at adding support for the BibTeX format #94
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for madata ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
That works as a proof of concept, but we cannot have a remote dependency like that. |
processUnknown: true, | ||
}; | ||
|
||
static extensions = ["bib"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That’s the most popular one, but pretty sure there are a few more extensions in use.
Co-authored-by: Lea Verou <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments
|
||
static parse (str, options) { | ||
options = this.resolveOptions(options, "parse"); | ||
return new BibLatexParser(str, options).parse(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC this does not produce a useful format by itself, though it preserves duplicate keys which could be useful for some use cases like reference managers.
We should probably have some sort of option to get back an object of ids to metadata. And something to transform to CSL, though I'm not sure what that entails exactly. But since the functionality is there, we could provide an option.
export default class BibTeX extends Format { | ||
static defaultOptions = { | ||
processUnexpected: true, | ||
processUnknown: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we’d want to expose these options wholesale. We may want to expose the functionality, but with a different API. I’d not expose for now — once you expose, you need to support that forever.
Remember ideally we should be able to swap out the parser/serializer for a different package and our end-users shouldn't have to change much.
Unfortunately, I couldn't make it work by importing
BibLatexParser
andBibLatexExporter
fromnode_modules
as we do with the TOML format, so I ended up usinghttps://esm.sh/
.