Thanks Jens!
I've added some comments in the issue you linked to, but in the meantime
I've also come up with what seems to be at least a semi-viable hack for
adding native CSL citation support to org-re-reveal. It involves creating
two new variables and then let-setting `citeproc-fmt--formatters-alist` in
`org-re-reveal-export-to-html`. Something similar could presumably be done
in other derived backends.
I find it quite hackish and I don't know whether perhaps some more general
solution could be found, but in any case here is the code, which I have
inserted into org-re-reveal.el locally:
Something to note here is that `oc-csl.el` hard-codes the output format
options in org-cite-csl--output-formats. I wonder if it would be worth
having an extensible variable "org-cite-csl--output-format-alist" that
backends could modify if they have special needs. For instance, I am
thinking about website exporters like Hugo where authors might want to have
separate bibliography pages rather than endnotes, or add "title" attributes
to citations, or possibly even modal tooltips with formatted text. It
probably doesn't make sense to build all of that in to citeproc.el, but
assing some additional information seems worthwhile.
-------------
(defvar org-re-reveal-citeproc-fmt-alist
`((unformatted . citeproc-fmt--xml-escape)
(cited-item-no . ,(lambda (x y) (concat ""
x "")))
(bib-item-no . ,(lambda (x y) (concat ""
x)))
(font-style-italic . ,(lambda (x) (concat "" x "")))
(font-style-oblique . ,(lambda (x)
(concat "")))
(font-variant-small-caps . ,(lambda (x)
(concat
"" x "")))
(font-weight-bold . ,(lambda (x) (concat "" x "")))
(text-decoration-underline .
,(lambda (x)
(concat
"" x
"")))
(rendered-var-url . ,(lambda (x) (concat "" x
"")))
(rendered-var-doi . ,(lambda (x) (concat "" x
"")))
;;(rendered-var-title . ,(lambda (x) (concat "" x
"")))
(vertical-align-sub . ,(lambda (x) (concat "" x "")))
(vertical-align-sup . ,(lambda (x) (concat "" x "")))
(vertical-align-baseline . ,(lambda (x) (concat "" x "")))
(display-left-margin . ,(lambda (x) (concat "\n "
x "
")))
(display-right-inline . ,(lambda (x) (concat ""
x "
\n ")))
(display-block . ,(lambda (x) (concat "\n\n "
x "
\n")))
(display-indent . ,(lambda (x) (concat "" x
"
\n ")))))
(defvar org-re-reveal-formatters-alist
`((html . ,(citeproc-formatter-create
:rt (citeproc-formatter-fun-create
org-re-reveal-citeproc-fmt-alist)
:bib #'citeproc-fmt--html-bib-formatter))))
(defun org-re-reveal-export-to-html
(&optional async subtreep visible-only body-only ext-plist backend)
"Export current buffer to a reveal.js HTML file.
Optional ASYNC, SUBTREEP, VISIBLE-ONLY, BODY-ONLY, EXT-PLIST are passed
to `org-export-to-file'.
Optional BACKEND must be `re-reveal' or a backend derived from it."
(interactive)
(let* ((backend (or backend 're-reveal))
(extension (concat "." org-html-extension))
(client-ext (concat org-re-reveal-multiplex-client-ext extension))
(file (org-export-output-file-name extension subtreep))
(clientfile (org-export-output-file-name client-ext subtreep))
(org-html-container-element "div")
(citeproc-fmt--formatters-alist org-re-reveal-formatters-alist))
(setq org-re-reveal-client-multiplex nil)
(org-export-to-file backend file
async subtreep visible-only body-only ext-plist)
;; Export the client HTML file if org-re-reveal-client-multiplex is set
true
;; by previous call to org-export-to-file
(if org-re-reveal-client-multiplex
(org-export-to-file backend clientfile
async subtreep visible-only body-only ext-plist))
file))
------------------------
On Sat, Jul 3, 2021 at 3:53 AM Jens Lechtenboerger <
lechten@wi.uni-muenster.de> wrote:
> On 2021-07-02, Matt Price wrote:
>
> > Hi,
> >
> > (cc:ing Jens L. in case this is relevant for his dev work on
> org-re-reveal).
>
> Hi Matt,
>
> just a quick reply: Yes, that is certainly relevant for me, but I do
> not have the time to investigate this at the moment. Note that I
> use references with org-ref and org-re-reveal-ref (for which Bruce
> opened an issue for org-cite support [1]). Currently, I configure
> org-ref-ref-html (although its doc string suggests otherwise).
>
> Best wishes
> Jens
>
> [1] https://gitlab.com/oer/org-re-reveal-ref/-/issues/2
>