Thanks for pointing out the addition of `pandoc.utils.references`. It's definitely useful. I'll have to look into it the next time I want to do something special with citations.

I have twice wanted to be able to distinguish individual citations in `Cite`'s inlines. Once was for the purpose of spell checking. When I cite sources in multiple languages, I need multi-lingual spell checking. So, in addition to the document that I will submit, I make ODT with the languages tagged so that I can spell check in LibreOffice. To spell check the citations, they need to be appropriately tagged. Because each bibliography entry has an ID derived from its bibliography key, I can identify them and give them an appropriate `lang` attribute. But in footnotes, it's not clear where one citation ends and the next begins, so I can't add a lang attribute in general. Even if there's just one citation, it could have a prefix or suffix in the document language. For this, perhaps I could use `pandoc.utils.references`, tag the principal parts of the citation with the reference's language, and save the resulting references in the `Pandoc` element for citeproc.

The second application was for a journal that uses idem instead of repeating author names. When I decided that an automatic solution was not practical, I solved the problem manually for the few citations that needed idem. For this, I would need too be able to identify not only individual citations, but also the author part of the citation. However, knowing my CSL style, I could assume that the author is the first element in the citation proper (after the prefix), or the series of elements that ends with `SmallCaps`.
On Monday, May 30, 2022 at 3:35:06 PM UTC+2 Albert Krewinkel wrote:

Shane Liesegang <lies...@gmail.com> writes:

> What would be truly ideal would be the ability to filter the
> citation process itself, but I'm assuming since that's from a
> different library that it is not exposed to Lua? Like I said, I
> have something mostly working now, but any thoughts/advice would
> be appreciated.

The closest thing is probably the `pandoc.utils.references`
function (added in pandoc 2.17). It gives you access to the
structured reference entries. Theoretically one could write a
custom citation handler by using that function and filtering
`Cite` elements; it might or might not be worth the effort in your
case.

HTH,

Albert


--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/d07b4bcd-8431-4fff-8b61-4d482ae382bcn%40googlegroups.com.