András Simonyi <[email protected]> writes:

> I gave a bit more thought to Ihor's suggestion and managed to solve the
> problem using the export communication channel, which looks like a more
> elegant solution indeed.

To be fair, a lot of code, say, in ox-latex does regexp search. So, even
though the idea with using headers is more elegant, it is probably not
something that is necessary.

> ... I'm attaching the (somewhat tentative) patch in
> this direction. Note that I had to introduce a flag property to indicate
> whether the style blocks were already added
> because org-cite-csl-render-bibliography is called more than once when
> there are several print_bibliography keywords in the document.

Yup. That's not ideal.
Maybe we should add a pre-processor available for citation
backends that will be called from `org-export--annotate-info' and runs
once, to setup any extra information in the INFO channel. Say

;; Process citations and bibliography.  Replace each citation
;; and "print_bibliography" keyword in the parse tree with
;; the output of the selected citation export processor.
(when (plist-get info :with-cite-processors)
  (org-cite-process-citations info)
  (org-cite-process-bibliography info)
  ;; This is new imaginary hook available to citation processors.
  (org-cite-annotate-info info))

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to