From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29211 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Carsten Gips Newsgroups: gmane.text.pandoc Subject: Re: How to resolve citations inside attributes Date: Thu, 9 Sep 2021 01:39:17 -0700 (PDT) Message-ID: <782eda7c-31e7-45ac-928d-3fdea56e5412n@googlegroups.com> References: <0bc0abba-e2ba-4473-b768-fe3fbbbcc0ebn@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_376_503965725.1631176757508" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18450"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDPI3JF23IIBBNUQ46EQMGQEWZT2CMY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Sep 09 10:39:21 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f59.google.com ([209.85.210.59]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mOFaa-0004an-UT for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 09 Sep 2021 10:39:20 +0200 Original-Received: by mail-ot1-f59.google.com with SMTP id c21-20020a0568301af500b0051af51e2a5bsf681781otd.10 for ; Thu, 09 Sep 2021 01:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=6fa+NFqQ3Akx++kXGVfU8tVp3vMmNi8tt7cHjfXIjFU=; b=CIimuEwwpIFeKB2Fp1Ps7v0QjYqd2ixaDSEwZp4uKiDGtmmx9GFfdBfM0GpjttNjNY kNjx7VnGYxrPeRRcXEZCYuFOYD/yr4E11L1si4eA2pybsWcDMFIa9+ztzn1jmzdnzyVg GgPV7aJbwFhsGfshLS4H/yCCGNX3x7drbuNWOV15IGdIPuJczcXPO1NJYN0ItAWVwNpV xmBfUtb5IWHALlZmFUR40mFXFKtq27fudUEiR4NQlu0OC0eMFH4NN1kwrJKWf7UWIvzt bqKfxEvNgjpIxYaCShIXwGtJZuTLU22JjzVFhMRoXmutxlclcKfO4H39ixA0Hww2iClW zHSw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=6fa+NFqQ3Akx++kXGVfU8tVp3vMmNi8tt7cHjfXIjFU=; b=bPvZX1/GLNQgJTQJQ7qd+x8YTIT6yn8TklsbPrGCI/+khlzajjwtHL6BZhkyNeot9+ uWGpU8Bw1FgG7QM9h/7+VOb5fIK8DvmwcEEPi6QS2D4xGy1wqZ1NLm2AUciGbxDhltk2 BzENQjgpE3Z6M3PM7V+CtitmUbiT/DjlmPkKZLMdk/zxY/V0lLvC2ewfK9bwt6svNd3H DNfAlMRzpxPS7G+FknMngJGcIWZ4KYrU4lfHRQf6paVhJALtBD+n9cKT8/UIT5NJWHic PhBv/rN1H+r0FYK2ZJUiucXvD03cTLk5N2V2ImeBxZIusgq5P1wbYvAvQjR1UsJeL59o 2gcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=6fa+NFqQ3Akx++kXGVfU8tVp3vMmNi8tt7cHjfXIjFU=; b=Dll6DrJaAfy7nMItmiayD5im23Gc6D8Q/3fpjtEb8nGCunPZanL8QMguylDy4CLQPe ZXL5lxTU4uI6O4s4rZ01S4IjfbQoH2clZ3Iz76tFJ9ykEEPm0d6LiDoR+u4Q6Ug7Y21H rVEOTkFU7DiSC07uNmBeTfZSRAJtwqyyf57l+6TT4rZUwL4xEZ+cyEN7DYxSM3X3gEON oU4ZPm9c2H6O5wGKxZa9JvTYiihaERUsS4AKwqPbNdECHiJVyn3z2O2+UE7rmZuyFs99 qAWk4Ii+uF928DQdWpr9shrYG5Vq+iXSLgQthZ0zQ2tyLkdUA57cZFYZGvJ0IeMOi9X0 OBlA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM5309/MyCfzCK/QXXHa9REFA12ImVmWlWb3HlYXPpGgV3ftOGhlE4 sy/VkPB+74Ui2+MOmxSzhYk= X-Google-Smtp-Source: ABdhPJwdVpBGjj8Bi4vocCDPWUFKisfZh0zirikJtUOFOlAnYOgI+6S5rmiOMadN27mN8FyxcoXBvA== X-Received: by 2002:a05:6830:2f5:: with SMTP id r21mr1495451ote.24.1631176759419; Thu, 09 Sep 2021 01:39:19 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a9d:7b4d:: with SMTP id f13ls281676oto.11.gmail; Thu, 09 Sep 2021 01:39:18 -0700 (PDT) X-Received: by 2002:a9d:458a:: with SMTP id x10mr1466417ote.267.1631176758207; Thu, 09 Sep 2021 01:39:18 -0700 (PDT) In-Reply-To: <0bc0abba-e2ba-4473-b768-fe3fbbbcc0ebn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: cagixcagix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:29211 Archived-At: ------=_Part_376_503965725.1631176757508 Content-Type: multipart/alternative; boundary="----=_Part_377_612164044.1631176757508" ------=_Part_377_612164044.1631176757508 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I've tried to resolve this manually by extracting this piece with a Lua=20 filter, converting it into a new document and running Pandoc plus Citeproc= =20 on this temporary document with `pandoc.utils.run_json_filter`, retrieving= =20 the processed citation and putting it back as codeblock caption in the=20 original document. However, this approach seems not to be working. To narrow this down further, I wrote a short document (`test.md`, see=20 attachment) and a Lua filter (`codecite.lua`, see attachment). (To make it= =20 even shorter, in the Lua filter I simply replace the text block of the=20 document with a similar new block). But this does not seem to work. The call `pandoc -L codecite.lua test.md -t= =20 json` returns only=20 ```json {"pandoc-api-version":[1,22],"meta":{"references":{"t":"MetaList","c":[{"t"= :"MetaMap","c":{"author":{"t":"MetaList","c":[{"t":"MetaMap","c":{"family":= {"t":"MetaInlines","c":[{"t":"Str","c":"Wuppie"}]}}}]},"id":{"t":"MetaInlin= es","c":[{"t":"Str","c":"FOO"}]},"title":{"t":"MetaInlines","c":[{"t":"Str"= ,"c":"Lorem"},{"t":"Space"},{"t":"Str","c":"Ipsum"}]}}}]}},"blocks":[{"t":"= Para","c":[{"t":"Str","c":"see=20 [@FOO]"}]}]} ``` i.e. the citation is not resolved. However, if I run Pandoc directly on this document, i.e `pandoc -t json=20 --citeproc test.md`, the result is as expected: ```json {"pandoc-api-version":[1,22],"meta":{"references":{"t":"MetaList","c":[{"t"= :"MetaMap","c":{"author":{"t":"MetaList","c":[{"t":"MetaMap","c":{"family":= {"t":"MetaInlines","c":[{"t":"Str","c":"Wuppie"}]}}}]},"id":{"t":"MetaInlin= es","c":[{"t":"Str","c":"FOO"}]},"title":{"t":"MetaInlines","c":[{"t":"Str"= ,"c":"Lorem"},{"t":"Space"},{"t":"Str","c":"Ipsum"}]}}}]}},"blocks":[{"t":"= Para","c":[{"t":"Str","c":"see"},{"t":"Space"},{"t":"Cite","c":[[{"citation= Id":"FOO","citationPrefix":[],"citationSuffix":[],"citationMode":{"t":"Norm= alCitation"},"citationNoteNum":1,"citationHash":0}],[{"t":"Str","c":"(Wuppi= e,"},{"t":"Space"},{"t":"Str","c":"n.d.)"}]]}]},{"t":"Div","c":[["refs",["r= eferences","csl-bib-body","hanging-indent"],[]],[{"t":"Div","c":[["ref-FOO"= ,["csl-entry"],[]],[{"t":"Para","c":[{"t":"Str","c":"Wuppie."},{"t":"Space"= },{"t":"Str","c":"n.d."},{"t":"Space"},{"t":"Span","c":[["",[],[]],[{"t":"S= tr","c":"=E2=80=9C"},{"t":"Str","c":"Lorem"},{"t":"Space"},{"t":"Str","c":"= Ipsum"},{"t":"Str","c":"."},{"t":"Str","c":"=E2=80=9D"}]]}]}]]}]]}]} ``` Clearly I'm missing something here. But what is it? Can you please advise? PS: `pandoc --version`: pandoc 2.14.2 Carsten Gips schrieb am Donnerstag, 9. September 2021 um 10:27:36 UTC+2: > Dear all, > > I'm trying to resolve citations inside attributes, i.e.=20 > > ```{.c caption=3D"nice, see [@KEY]"} > ... > ``` > > Pandoc and Citeproc are currently not handling citations inside am=20 > attribute like in the example. How can I resolve these citations anyway? > > Thanks, > Carsten > --=20 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 e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/782eda7c-31e7-45ac-928d-3fdea56e5412n%40googlegroups.com. ------=_Part_377_612164044.1631176757508 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I've tried to resolve this manually by extracting this piece with= a Lua filter, converting it into a new document and running Pandoc plus Ci= teproc on this temporary document with `pandoc.utils.run_json_filter`, retr= ieving the processed citation and putting it back as codeblock caption in t= he original document. However, this approach seems not to be working.
=
To narrow this down further, I wrote a short document (`test.md`, = see attachment) and a Lua filter (`codecite.lua`, see attachment). (To make= it even shorter, in the Lua filter I simply replace the text block of the = document with a similar new block).

But this does not seem to= work. The call `pandoc -L codecite.lua test.md -t json` returns only
```json
{"pandoc-api-version":[1,22],"meta":{"reference= s":{"t":"MetaList","c":[{"t":"MetaMap","c":{"author":{"t":"MetaList","c":[{= "t":"MetaMap","c":{"family":{"t":"MetaInlines","c":[{"t":"Str","c":"Wuppie"= }]}}}]},"id":{"t":"MetaInlines","c":[{"t":"Str","c":"FOO"}]},"title":{"t":"= MetaInlines","c":[{"t":"Str","c":"Lorem"},{"t":"Space"},{"t":"Str","c":"Ips= um"}]}}}]}},"blocks":[{"t":"Para","c":[{"t":"Str","c":"see [@FOO]"}]}]}
```
i.e. the citation is not resolved.

Howev= er, if I run Pandoc directly on this document, i.e `pandoc -t json --citepr= oc test.md`, the result is as expected:

```json
{"p= andoc-api-version":[1,22],"meta":{"references":{"t":"MetaList","c":[{"t":"M= etaMap","c":{"author":{"t":"MetaList","c":[{"t":"MetaMap","c":{"family":{"t= ":"MetaInlines","c":[{"t":"Str","c":"Wuppie"}]}}}]},"id":{"t":"MetaInlines"= ,"c":[{"t":"Str","c":"FOO"}]},"title":{"t":"MetaInlines","c":[{"t":"Str","c= ":"Lorem"},{"t":"Space"},{"t":"Str","c":"Ipsum"}]}}}]}},"blocks":[{"t":"Par= a","c":[{"t":"Str","c":"see"},{"t":"Space"},{"t":"Cite","c":[[{"citationId"= :"FOO","citationPrefix":[],"citationSuffix":[],"citationMode":{"t":"NormalC= itation"},"citationNoteNum":1,"citationHash":0}],[{"t":"Str","c":"(Wuppie,"= },{"t":"Space"},{"t":"Str","c":"n.d.)"}]]}]},{"t":"Div","c":[["refs",["refe= rences","csl-bib-body","hanging-indent"],[]],[{"t":"Div","c":[["ref-FOO",["= csl-entry"],[]],[{"t":"Para","c":[{"t":"Str","c":"Wuppie."},{"t":"Space"},{= "t":"Str","c":"n.d."},{"t":"Space"},{"t":"Span","c":[["",[],[]],[{"t":"Str"= ,"c":"=E2=80=9C"},{"t":"Str","c":"Lorem"},{"t":"Space"},{"t":"Str","c":"Ips= um"},{"t":"Str","c":"."},{"t":"Str","c":"=E2=80=9D"}]]}]}]]}]]}]}
```

Clearly I'm missing something here. But what is it? Can = you please advise?


PS: `pandoc --version`:&nb= sp;pandoc 2.14.2

Carsten Gips schrieb am Donnerstag, 9. September 2021 um 10= :27:36 UTC+2:
Dear all,

I'm trying to resolve citations insi= de attributes, i.e.

```{.c caption=3D"nice, see [@KEY]&= quot;}
...
```

Pandoc and Citeproc are cu= rrently not handling citations inside am attribute like in the example. How= can I resolve these citations anyway?

Thanks,
Cars= ten

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/782eda7c-31e7-45ac-928d-3fdea56e5412n%40googlegroups.= com.
------=_Part_377_612164044.1631176757508-- ------=_Part_376_503965725.1631176757508 Content-Type: application/octet-stream; name=codecite.lua Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=codecite.lua X-Attachment-Id: 60b1060a-b820-4126-80f9-8f511e034b41 Content-ID: <60b1060a-b820-4126-80f9-8f511e034b41> local meta function render_blocks(b) local blocks = {pandoc.Para{pandoc.Str("see [@FOO]")}} local tmp = pandoc.utils.run_json_filter( pandoc.Pandoc(blocks, meta), 'pandoc', {'--from=json', '--to=json', '--citeproc'} ) return tmp.blocks end return { { Meta = function (m) meta = m end }, { Block = render_blocks } } ------=_Part_376_503965725.1631176757508 Content-Type: text/markdown; charset=US-ASCII; name=test.md Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=test.md X-Attachment-Id: 6d7022d6-a153-4385-b84d-8fceb367e4f7 Content-ID: <6d7022d6-a153-4385-b84d-8fceb367e4f7> --- references: - author: - family: Wuppie id: FOO title: Lorem Ipsum --- see [@FOO] ------=_Part_376_503965725.1631176757508--