From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id Xf1JMbrX4GBpKAEAgWs5BA (envelope-from ) for ; Sat, 03 Jul 2021 23:33:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id sL9tLLrX4GBTFQAAB5/wlQ (envelope-from ) for ; Sat, 03 Jul 2021 21:33:46 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C53D417E43 for ; Sat, 3 Jul 2021 23:33:45 +0200 (CEST) Received: from localhost ([::1]:59070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lznGi-0003qC-0w for larch@yhetil.org; Sat, 03 Jul 2021 17:33:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56318) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lznG5-0003pp-Ps for emacs-orgmode@gnu.org; Sat, 03 Jul 2021 17:33:07 -0400 Received: from mail-vs1-xe2b.google.com ([2607:f8b0:4864:20::e2b]:42741) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lznG3-00036P-3D for emacs-orgmode@gnu.org; Sat, 03 Jul 2021 17:33:05 -0400 Received: by mail-vs1-xe2b.google.com with SMTP id t19so1773450vst.9 for ; Sat, 03 Jul 2021 14:33:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=8cVKh7WkosRGOhe5fvxi7XyfwWh9Cu/XbliGR1YyBno=; b=rZq8t6IW59uSVuk16nBhYMNlRVNfPFhh/p7sjMNWC+S5oxbA8xp7uXtG4DYgCbeEo3 JLwviJRjXfgnxrOLM3vxQHusUjt9l9M4NjEm+XKhr17/Tuw/pXF5WIp9D6r/h0qHogRH 7mDySPYLpjHDLVUbgOce0yCyIRQhuGGPCcEsEFfVR8GRgFK7vI7OT+iEdbYc/ypmQ1bp GYUlNzW47QzpbAM3s3aOVjjgTJ4IuSjZVK35evrqt8IgkKBj985Ux2Phrb92DtdWRBLZ 5CH1q83Z6QPIL0nzbZHGkCf50xGmAKyoPURS2I4FUbEJR3RqiupPztohxopcJurKA0Q4 7e2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=8cVKh7WkosRGOhe5fvxi7XyfwWh9Cu/XbliGR1YyBno=; b=WvyyvQ8Tk4Y78qSfnDCTZeC90XILThIp/1Y1KK2ledtBlFJIYwb2B2YC+AbXWbjgvW 4v0Av6K3VLsPytSq/Ri2epJ8/fm8R15gFle+7brwMfwWZRc00O/wkGiIG83LQH6dZlW3 6U7nzgSsjS27Qjyo8E3Ur64eZhlqVAGANh7nLo851X7OacluIS9lUehpJgFnm5Oo9rTt ZTvmgcquXsIbFCH6gjr2gkV+fZuNIhAt3wEOgzVdLZoqhIlS5JRJIHIw/mhPEn8AWsO0 Parm41ldbCwdrGLUq/ERm6T/K6xuaMLa3myHVf035Ygg2X7LoFcZ2TQxdt4+UwT4DJ9L sdEw== X-Gm-Message-State: AOAM530osayLaeaGBI4orWcWDdgaSbHqTEou1lfV4gc4GYOWKLrw5nzE +Pa1wuFYqZeSEnORyD0PNcPEutOIkBUVCUFAucQ= X-Google-Smtp-Source: ABdhPJy1saC8KXmGUFSguPO9b6X7ijmC/qqjrvUKn/mq7G86TiuooI+wFtmEE9ARwIuYBquaf/WxoOIFOCHBBPnMx0o= X-Received: by 2002:a67:b906:: with SMTP id q6mr5443282vsn.33.1625347981645; Sat, 03 Jul 2021 14:33:01 -0700 (PDT) MIME-Version: 1.0 References: <87r1gfx27r.fsf@wi.uni-muenster.de> In-Reply-To: <87r1gfx27r.fsf@wi.uni-muenster.de> From: Matt Price Date: Sat, 3 Jul 2021 17:32:50 -0400 Message-ID: Subject: Re: modify citation links in a derived HTML backend To: Matt Price , Org Mode Content-Type: multipart/alternative; boundary="000000000000151a3905c63ed1e8" Received-SPF: pass client-ip=2607:f8b0:4864:20::e2b; envelope-from=moptop99@gmail.com; helo=mail-vs1-xe2b.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625348026; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=8cVKh7WkosRGOhe5fvxi7XyfwWh9Cu/XbliGR1YyBno=; b=I07cG0cf9NcC7ZEOLMeOx0H2/4Hyi8MzPxh5BXn3o8BFhipq1fOEqG/seMYmWmCHNGEwVb 1Ghe6hcX/lhIWeCFbI56tcCZ5jLQQX4RdIsyCWv3ax0YP42h1kWCvAvtoynqA+KuJkXFY8 0BF1F6XElYE8LVlA7crl2FDIJF+YlCU+Lyizc+1b35UDQyuwtDGunFzFeDO4VRGa45XJdr AtjbNtBNziP/+n93TBNy21ooY3rlJRBABcgN30kG5qHIH8BuvYUssl0nWNMBI8tvRoSPMw VMoZFRyy7I6gKeDG+2s8tAgNtcUBs1rb2JeECbrL4ZJiN2RG3WrVcgunT0ktBQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625348026; a=rsa-sha256; cv=none; b=lAQNKdX47zaVyBV6rslCiO0aKj7p4blU+Oml3h2JE1/zkaOjT74iDv1qS8Wq/pAJkH6NqG qQ6agiVQbuw4gW4yGK6AsJjczO83Da7MruGMMiPhn5WJwCaNxozJeD+0Xg352MdD0TTEUN WBoKx6NBLM4c0CqETy0HC0dZGPrxIMTD7fr7Kj9SaYtzeqwluIMalqFFuQG0Vjl16fffHX /I+cfCQXV8rV4bSHauYZGGpKgnI+5rkK9OEXCm9Hz+XO+q2cy0+2s8wPbc07G7tFazPtqD dnF3KNDC91MSteXyUGS41FfS4hV1VY3QH0AnH9r4ZTQ9Oe15nb48sGxtpDG1Sw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=rZq8t6IW; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.91 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=rZq8t6IW; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: C53D417E43 X-Spam-Score: -1.91 X-Migadu-Scanner: scn0.migadu.com X-TUID: rxqBr3DU0jJH --000000000000151a3905c63ed1e8 Content-Type: text/plain; charset="UTF-8" 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 > --000000000000151a3905c63ed1e8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 nativ= e CSL citation support to org-re-reveal. It involves creating two new varia= bles and then let-setting `citeproc-fmt--formatters-alist` in `org-re-revea= l-export-to-html`. Something similar could presumably be done in other deri= ved backends.

I find it quite hackish and I d= on't know whether perhaps some more general solution could be found, bu= t 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.e= l` 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-cs= l--output-format-alist" that backends could modify if they have specia= l needs. For instance, I am thinking about website exporters like Hugo wher= e authors might want to have separate bibliography pages rather than endnot= es, or add "title" attributes to citations, or possibly even moda= l tooltips with formatted text.=C2=A0 It probably doesn't make sense to= build all of that in to citeproc.el, but assing some additional informatio= n seems worthwhile.
-------------
(defvar org-re-r= eveal-citeproc-fmt-alist
=C2=A0 `((unformatted . citeproc-fmt--xml-escap= e)
=C2=A0 =C2=A0 (cited-item-no . ,(lambda (x y) (concat "<a hre= f=3D\"#slide-bibliography""\">"
=C2=A0= =C2=A0x "</a>")))
=C2=A0 =C2=A0 (bib-item-no . ,(lambda= (x y) (concat "<a name=3D\"citeproc_bib_item_" y "\= "></a>"
=C2=A0x)))
=C2=A0 =C2=A0 (font-style= -italic . ,(lambda (x) (concat "<i>" x "</i>&quo= t;)))
=C2=A0 =C2=A0 (font-style-oblique . ,(lambda (x)
=C2=A0 =C2= =A0 (concat "<span style=3D\"font-style:oblique;\"" = x "</span>")))
=C2=A0 =C2=A0 (font-variant-small-caps . = ,(lambda (x)
=C2=A0(concat
=C2=A0 "<span style=3D\&= quot;font-variant:small-caps;\">" x "</span>")= ))
=C2=A0 =C2=A0 (font-weight-bold . ,(lambda (x) (concat "<b>= ;" x "</b>")))
=C2=A0 =C2=A0 (text-decoration-under= line .
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0,(lambda (x)
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(concat
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "<span style=3D\"text-d= ecoration:underline;\">" x "</span>")))
=C2= =A0 =C2=A0 (rendered-var-url . ,(lambda (x) (concat "<a href=3D\&qu= ot;" x "\">" x "</a>")))
=C2=A0 = =C2=A0 (rendered-var-doi . ,(lambda (x) (concat "<a href=3D\"&= quot; x "\">" x "</a>")))
=C2=A0 =C2= =A0 ;;(rendered-var-title . ,(lambda (x) (concat "<a href=3D\"= " x "\">" x "</a>")))
=C2=A0 =C2= =A0 (vertical-align-sub . ,(lambda (x) (concat "<sub>" x &q= uot;</sub>")))
=C2=A0 =C2=A0 (vertical-align-sup . ,(lambda (= x) (concat "<sup>" x "</sup>")))
=C2=A0 = =C2=A0 (vertical-align-baseline . ,(lambda (x) (concat "<span style= =3D\"baseline\">" x "</span>")))
=C2= =A0 =C2=A0 (display-left-margin . ,(lambda (x) (concat "\n =C2=A0 =C2= =A0<div class=3D\"csl-left-margin\">"
x "= ;</div>")))
=C2=A0 =C2=A0 (display-right-inline . ,(lambda (x= ) (concat "<div class=3D\"csl-right-inline\">" x "</div>\n =C2=A0")))
=C2=A0 =C2=A0 (display-bl= ock . ,(lambda (x) (concat "\n\n =C2=A0 =C2=A0<div class=3D\"c= sl-block\">"
=C2=A0x "</div>\n")))=C2=A0 =C2=A0 (display-indent . ,(lambda (x) (concat "<div class= =3D\"csl-indent\">" x "</div>\n =C2=A0"))= )))

(defvar org-re-reveal-formatters-alist
=C2=A0 `((html . ,(cit= eproc-formatter-create
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0:rt (c= iteproc-formatter-fun-create org-re-reveal-citeproc-fmt-alist)
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0:bib #'citeproc-fmt--html-bib-formatt= er))))

(defun org-re-reveal-export-to-html
=C2=A0 =C2=A0 (&op= tional async subtreep visible-only body-only ext-plist backend)
=C2=A0 &= quot;Export current buffer to a reveal.js HTML file.
Optional ASYNC, SUB= TREEP, VISIBLE-ONLY, BODY-ONLY, EXT-PLIST are passed
to `org-export-to-f= ile'.
Optional BACKEND must be `re-reveal' or a backend derived = from it."
=C2=A0 (interactive)
=C2=A0 (let* ((backend (or backen= d 're-reveal))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(extension (concat = "." org-html-extension))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(cl= ient-ext (concat org-re-reveal-multiplex-client-ext extension))
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(file (org-export-output-file-name extension sub= treep))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(clientfile (org-export-output= -file-name client-ext subtreep))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-= html-container-element "div")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(citeproc-fmt--formatters-alist org-re-reveal-formatters-alist))

= =C2=A0 =C2=A0 (setq org-re-reveal-client-multiplex nil)
=C2=A0 =C2=A0 (o= rg-export-to-file backend file
=C2=A0 =C2=A0 =C2=A0 async subtreep visib= le-only body-only ext-plist)

=C2=A0 =C2=A0 ;; Export the client HTML= file if org-re-reveal-client-multiplex is set true
=C2=A0 =C2=A0 ;; by = previous call to org-export-to-file
=C2=A0 =C2=A0 (if org-re-reveal-clie= nt-multiplex
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (org-export-to-file backend cli= entfile
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 async subtreep visible-only b= ody-only ext-plist))
=C2=A0 =C2=A0 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-re= veal).

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.=C2=A0 Note that I
use references with org-ref and org-re-reveal-ref (for which Bruce
opened an issue for org-cite support [1]).=C2=A0 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/-/is= sues/2
--000000000000151a3905c63ed1e8--