First stab at adding support for the BibTeX format#94
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.
That’s the most popular one, but pretty sure there are a few more extensions in use.
Co-authored-by: Lea Verou <lea@verou.me>
|
|
||
| static parse (str, options) { | ||
| options = this.resolveOptions(options, "parse"); | ||
| return new BibLatexParser(str, options).parse(); |
There was a problem hiding this comment.
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.
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
BibLatexParserandBibLatexExporterfromnode_modulesas we do with the TOML format, so I ended up usinghttps://esm.sh/.