Skip to content

Add 'multibib-renumber.lua' filter #18

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wlupton
Copy link
Member

@wlupton wlupton commented Dec 15, 2024

The initial version is just code that has been removed from PR #8.

The initial version is just code that has been removed from
pandoc-ext#8.
@wlupton
Copy link
Member Author

wlupton commented Dec 16, 2024

I believe that I've fixed at least some of the problems reported by @jerome-white, in that multiple citations per cite should now work (not sure whether that will fix the range problem... probably not), and links should work.

This is quite messy, because the only way that I see to fix the citation numbers is to do string processing on the cite text (this text covers all the cite's citations). I have currently assumed that the citation numbers in the bibliography are in square brackets.

This is largely untested but at least it works for the test input (which I have modified). Obviously the tests need expanding to test across a variety of conditions.

Feedback welcome!

@wlupton
Copy link
Member Author

wlupton commented Dec 16, 2024

Re this:

The citation may list "4-7", for example, when in fact it should be "31-34".

I don't think this will have been fixed, because this is presumably part of the cite text (in this case the cite will have four citations and they'll be consecutively numbered and therefore run together into a range). So the parse would have to be more elaborate. But is this really the right thing to do? I have my doubts.

@wlupton
Copy link
Member Author

wlupton commented May 20, 2025

@tarleb and everyone, any thoughts on this? Thanks.

@tarleb
Copy link
Member

tarleb commented May 20, 2025

Apologies, I had lost track of this. I'll take a look first thing tomorrow morning.

Copy link
Member

@tarleb tarleb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice. I haven't fully made up my mind yet about whether this should be a separate extension, or whether it's fine to include here.

local script_dir = require('pandoc.path').directory(PANDOC_SCRIPT_FILE)
package.path = string.format('%s/?.lua;%s/../?.lua;%s/../scripts/?.lua;%s',
script_dir, script_dir, script_dir, package.path)
local logging = require 'logging'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logging library should probably be a "soft" dependency:

local logging = require 'logging' or
  { __index = function () return (function () end) end }

@Nie72, @Bel
[see @Nie72, Section 1], [@Bel]

[@Knu86; @Bae]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to keep at least one citation as "nocite-only".

@wlupton
Copy link
Member Author

wlupton commented May 21, 2025

I haven't fully made up my mind yet about whether this should be a separate extension, or whether it's fine to include here

Let me know. I could go either way on this. Do any other extensions provide multiple filters?

(I guess the philosophical question is whether an extension name relates to a topic or specifically to a filter.)

@tarleb
Copy link
Member

tarleb commented May 21, 2025

Conceptually it seems fine to have multiple filters. The reason that I'm a bit hesitant is that the code is very specific (for certain CSL styles) and I'm slightly worried that it would become a maintenance burden. OTOH, this kind of functionality is certainly needed, and there aren't any alternatives that I know of, so it would be great to offer this in a prominent place.

@wlupton
Copy link
Member Author

wlupton commented May 21, 2025

If you make a decision I will go with it. Clearly it's easier to leave it as is!

I'll address the other points anyway.

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.

2 participants