Skip to content
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

Support multiple bibliographies per topic (etc.) #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wlupton
Copy link
Member

@wlupton wlupton commented Sep 13, 2023

Note: I'm creating this PR for discussion. I fully expect that further changes might be necessary before merging it.

The full list of changes is:

  • Support multiple bibliographies per topic, i.e., in the 'bibliography' metadata, allow topic entries to be list-valued
  • Support the same topic structure for the 'references' metadata item, so can override references per topic
  • Ignore duplicate references, i.e. if the same reference exists in multiple topics (the first one encountered is used, but this is not satisfactory because the topic processing order is indeterminate). Note that something had to be done here, because these duplicates would have the same ids and therefore would be ambiguous
  • Take some changes from the diverged multiple-bibliographies repo, notably don't use utils.citeproc() because it doesn't have a 'quiet' option (which is needed for the second pass)
  • Fix an undefined 'orig_bib' bug (that probably caused no problems)
  • Add filters to renumber citations in the case where they're referenced by citation number. These filters won't do anything in other cases, but nevertheless probably shouldn't be here

Also:

  • The existence of the slightly different (and older?) pandoc-lua-filters multiple-bibliographies filter is rather confusing. I don't think there's anything else there that needs to be carried over (it was only really the citeproc 'quiet' support)
  • I think it would be great if utils.citeproc() supported a 'quiet' flag, and plan to create a pandoc issue for this
  • There's a comment in the code about not copying all the metadata before running citeproc, but I think this is probably a mistake because it means that any new relevant metadata items will have to be explicitly added, e.g., link-bibliography was added in pandoc 2.14.2 but hadn't been added to the filter
  • As noted in the commit comment, the 'renumber' filters should probably be moved to another file

The full list of changes is:
- Support multiple bibliographies per topic, i.e., in the
  'bibliography' metadata, allow topic entries to be list-valued
- Support the same topic structure for the 'references' metadata
  item, so can override references per topic
- Ignore duplicate references, i.e. if the same reference exists in
  multiple topics (the first one encountered is used, but this is not
  satisfactory because the topic processing order is indeterminate).
  Note that something had to be done here, because these duplicates
  would have the same ids and therefore would be ambiguous
- Take some changes from the diverged multiple-bibliographies repo,
  notably don't use utils.citeproc() because it doesn't have a 'quiet'
  option (which is needed for the second pass)
- Fix an undefined 'orig_bib' bug (that probably caused no problems)
- Add filters to renumber citations in the case where they're referenced
  by citation number. These filters won't do anything in other cases,
  but nevertheless probably shouldn't be here
@wlupton
Copy link
Member Author

wlupton commented Oct 13, 2023

@tarleb (and others), any thoughts on this PR? Thanks.

@jerome-white
Copy link

What I like about this PR is that reference numbers do not "reset" between bibliographies (see #6). This PR generally works, with a couple caveats:

  1. When sorting the bibliography by "citation-number": the reference numbers in the document do not always align to the correct numbers in the bibliography. The citation may list "4-7", for example, when in fact it should be "31-34". This is also an issue I notice with the implementation on the master branch, so it is not something this PR introduces.
  2. When calling Pandoc, I specify the option --metadata link-citations:true. While grouped citations (for example [@a; @b; @c]) are properly linked to references, single citations ([@a]) are not. I do not see this issue with the implementation on master.

@wlupton
Copy link
Member Author

wlupton commented Nov 7, 2023

Sorry for the delay in replying. I suspect that both of your caveats can be addressed. I'll take a look.

Re your caveat 1 please note that there's already an attempt to address this problem, but it doesn't support ranges.

@tarleb
Copy link
Member

tarleb commented May 5, 2024

Very cool! Could you split this up into separate PRs? Things that I'm definitely in favor of:

  • General cleanup
  • Allow lists of bib files for each topic
  • Allow to renumber references (but maybe that should be configurable?)

I'm a bit skeptical towards others:

@wlupton
Copy link
Member Author

wlupton commented May 7, 2024

@tarleb I'll take a look.

And @jerome-white apologies for not doing what I said I'd do (perhaps on this upcoming iteration...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants