[ANN] Biblography.jl (+BibParser.jl&BibInternal.jl): a package to import/export bibliographies from/to various formats

Dear all,

I am very pleased to announce my first v1.x package after years of inactivity …

Bibliography.jl is package to manage the import/export of bibliographic entries from and to various formats. It is currently in beta and support import/export from/to BibTeX, and export for StaticWebPages.jl, a Static Website generator (oriented but not limited to academician) that will be available in 3 days.

The package depends on two others (for the sake of precompilation time)

  • BibInternal.jl: simply a Julia structure to import to and export from (also it can check the validity of BibTeX entries)
  • BibParser.jl: a package that handle parsers for bibliographies. Currently, only parses a light version of BibTeX gramma using Automa.jl.
    (I have tried BibTeX.jl, but the current version was not working and my issue is left unanswered so …)

I would be happy to have contributions to include more parsers into BibParser and more exports in Biblography. I also welcome importing existing parsers from the Julian ecosystem within BibParser!

(There is a long term project behind Bibliography that require to convert from and to as many formats as possible, so support will be there)

21 Likes

Awesome to see more LaTeX and BibTeX integration in Julia, thanks for working on this @Azzaare!

Was wondering if it would be possible to use Bibliography.jl to to add support for BibTeX citations and references in documentation pages generated by Documenter.jl? I opened an issue about this a while back (https://github.com/JuliaDocs/Documenter.jl/issues/1162) but it kind of fizzled out I think. If this is easy to do with Bibliography.jl, then it might be worth pursuing and I’d love to help.

6 Likes

That would be really nice to have!

I designed Bibliography.jl exactly with this kind of problem in mind. So I would be happy to tackle it.

I can see two specific things to solve beforehand though

  • making (or importing another effective parser) the current BibTeX parser in BibParser parse the whole Gramma of BibTeX. The one I used has some restrictions.
  • some LaTeX command in the fields needs to be transformed (for instance {\c{c}} needs to become ç in the output)

It is easy for one entry to follow the current restrictions in BibParser and to replace by hand the LaTeX commands and replace by the final input. However, no one wants to do it for a whole bibliography.

I will have to solve those two matters for my long term project, but I was planning to tackle some other formats first (such as JSON based citations) that do not suffer the same restrictions.

3 Likes

That would definitely be great! I looked through the parser a bit and I think it’s still pretty good for most of my references for sure, although I don’t mind changing accents to Unicode and things like that.

Was able to get a minimal working example of hacking in Bibliography.jl as a Documenter.jl plugin without too much work! I’ve put up the (messy) code up on GitHub - ali-ramadhan/DocumenterCitations.jl: DocumenterCitations.jl uses Bibliography.jl to add support for BibTeX citations and references in documentation pages generated by Documenter.jl. but hoping to get some help from the Documenter.jl devs to improve it and figure it where the code should live.

Only gripe I had with Bibliography.jl was that it used an OrderedSet to store the bibliography when an OrderedDict with BibTeX entry ID’s as keys might be easier to use and much cheaper to search, but I opened an issue on GitHub to hopefully discuss.

I have no idea why I chose OrderedSet anyway, so I am fine with OrderedDict. I will make some improvements today to the different package involved in Bibliography (including your requests) and will tag a new version.

Unless it add a long precompilation time to Bibliography, I don’t see any problem to put your code within it. This is more or less what I do for the export to the StaticWebPages.jl format.
I can add you as a collaborator, and/or you can make a PR.

Anyway it is nice I have requests/contributions from the start as it helps me shape the package into something correct.

1 Like

Hi there!

Small update, BibParser.jl now uses a new BibTeX parser. List of notable or missing features:

  • parse any entry written in correct BibTeX syntax
  • raise an explicit and detailed warning when an entry is not parsed
  • handle @string definitions
  • do not evaluate LaTeX commands (defined in a @preamble)
  • do not replace LaTeX command with the equivalent unicode character (when possible)

As a reminder, most people would prefer to use Bibliography.jl, the umbrella package.

Contributors are welcome, in particular to add import/export from/to other bibliography format.

4 Likes