Homepage    |    GitHub    |    API    |    FAQ

BibTeX Plugin: DevLog[0]

This is the first dev log of the BibTeX Plugin. In this week, I'm gonna work on the following features:

  • Config Screen:
    • Add section and icon
    • Import .bib file (single file without watching)
  • Implement the Parser Class

Github Repo
Implementation Details
UI/UX Document

All contributions and suggestions are welcomed.


What has been done so far

  • Registered the plugin section in the settings screen.
  • Added an icon (Graduation cap).
  • Implemented an initial version of the Parser

For more info: Config screen & Parser by xUser5000 · Pull Request #1 · joplin/plugin-bibtex · GitHub


What's next

  • Integrate a testing library (I haven't yet decided on which one to use)
  • Provide test suits for the Parser (.bib files that cover most, if not all, test cases)
  • Unit-test the Parser
1 Like

I've set up a testing library (Jest) and will commit these changes soon. The problem is how to properly test the parser?
Do I prepare a bunch of .bib files and the corresponding JSON object for every file, then parse and compare?
Or Do I first convert the resulting JSON object to APA format, for instance, then assert that the parser produces the correct APA for every citation?

I need help, please.

Are you using a library to parse or have you made your own parser?

I'm using a library. Previously, I was encountering some errors and had to switch to a different method, but I have it working now.

Then maybe testing the library isn't your job at all?

Mmmm, that Makes sense.

If the library is reliable, you can assume it works. From the look of it though I wouldn't expect it to be very reliable so having a few tests to check that you get the expected results would be good.

It will also help you understand clearly what output you can expect from the lib - for example are the dates plain strings, are they date objects? Are the numbers actual numbers, or strings, etc. Know your data basically, because it's central to your plugin. Also later when you invariably hit some edge cases, you can add more tests specifically for these.

As for your questions, I'd just test one bibtex file, as long as it's representative enough, and that's it. It doesn't even have to be a file, you can add the bibtex data as a template string into the test, and that way you don't need logic to load a file.


Another pull request has been created with the following changes:

  • Setup testing environment (using Jest).
  • Integrate citation-js (Parsing Library).
  • Added some test cases for the Parser.
  • Updated README.