asciidoctor / asciidoctor-bibtex

Add bibtex citation support for asciidoc documents
Other
69 stars 27 forks source link

Allow multiple .bib files #87

Open Oblomov opened 2 years ago

Oblomov commented 2 years ago

Hello,

thank you very much for the useful extension.

Would it be possible to support multiple source .bib files? I keep my bib data grouped into separate files, and being able to use these directly would allow me to use it as-is rather than trying to merge it, which is not always easy (e.g. because of conflicting bibtex string macros).

I'm guessing that this could be implemented either by allowing :bibtex-file: to take multiple values (in which case the blbliography::[] macro would then output the combined data) and/or by expanding each bibliography::somefile.bib[] into the bib data taken from that specific file.

ProgramFan commented 2 years ago

This sounds reasonable since bibtex also supports multiple bib files. We can support this through multiple values in :bibtex-files: attributes. Since I am running out of time, the implementation may be late. A PR is highly welcome.

lorrden commented 2 years ago

We often classify references in 'applicable documents' and 'reference documents' with different citation styles (e.g. AD.1, RD.1).

The ideal is to put these in separate bibliography files, and IIRC we managed to do something like this in biblatex.

Note that asciidoctor-bibliography has multiple bibliography file support already.

lorrden commented 1 year ago

Question, since I might have time to look at this. How would we allow multiple files being specified and what precedent would we have for duplicated bib-keys?

We could add a bibtex-files attribute that is parsed as a YAML list, or something like that. Alternatively, we can do the same with the existing bibtex-file attribute? Is there a preference here as to how to deal with lists in the attribute?

I would be inclined to first ensure we have multiple bib-files, and turn all the bibliography file reference to arrays. When citing something, the search order would be to start with he first file in the added attribute.

A later patch could group them (like supported by asciidoctor-bibliography)

mojavelinux commented 1 year ago

that is parsed as a YAML list, or something like that.

The convention in AsciiDoc is to make it a comma-separated list. An attribute value cannot accommodate all the formatting of a YAML value, so it's best not to lead users into the belief that it can. And there are other places in the AsciiDoc ecosystem where comma-separate values are used to pass multiple items.

lorrden commented 1 year ago

I got something initial working with a basic unit test, I would appreciate a pre-review (it is not sufficiently tested yet, I just added one unit test for it), before I finish this.

I am not super fluent with ruby yet... 😉

https://github.com/asciidoctor/asciidoctor-bibtex/compare/master...lorrden:asciidoctor-bibtex:master

Can I create a PR and mark it as a draft or something (like with gitlab)?

mojavelinux commented 1 year ago

Yes, GitHub has that feature.

(Please note that I am not the maintainer of this project, I am just adding my input).