From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29231 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: Mon, 13 Sep 2021 00:54:40 -0700 (PDT) Message-ID: <9c08fc54-f3bf-451a-92fe-14d9c978711dn@googlegroups.com> References: <0bc0abba-e2ba-4473-b768-fe3fbbbcc0ebn@googlegroups.com> <782eda7c-31e7-45ac-928d-3fdea56e5412n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2764_122886579.1631519680467" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25975"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDPI3JF23IIBBQMH7SEQMGQEEZO4RPY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Sep 13 09:54:44 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oo1-f64.google.com ([209.85.161.64]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mPgnb-0006YM-PP for gtp-pandoc-discuss@m.gmane-mx.org; Mon, 13 Sep 2021 09:54:43 +0200 Original-Received: by mail-oo1-f64.google.com with SMTP id a127-20020a4a4c850000b029028b35f322edsf7231504oob.9 for ; Mon, 13 Sep 2021 00:54:43 -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=QRrM7DDbEOFxSPJABSuKhiS28pDUB1r9WxqBAXQF7IA=; b=oNxuPXndWtpqH3pEvn6W0Z3a31nQMqYfv2IFC68o3ZSmxKmdWCvozXD7mCVrULHQY1 h4+UbtuJDvzwce0jkE6AMa8Hm8lhghJ/U+ScOelVyUwzdRgcbLUNDkqbzQfnwht6gp4+ GgmZT1T2ILQDGYZt6C9HE7S2xBwInbRKLg80aZHfcVLiYx8BTvBrEqTo+rEZhyUtzxc3 cnlJTnWbefHPldJwtfQeMhCSUYtD/zRLjA7d5K8VuNR9UH2KFhPhmTnLVOmyvNCQOJcP n6D9ldENd4ELHfbBbtEBbs8mZip3/RiqzXZgzqmDwFPc0gP8NZBHhWe6DpgF/HWMc+lX cQgg== 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=QRrM7DDbEOFxSPJABSuKhiS28pDUB1r9WxqBAXQF7IA=; b=q4iAPlYSFq9hL3go1TYmd2UouoxtPi+E3lKHmal/L48L2zCkruuGVDeHCLBbv1VkAI UNJEN3q2LNB9DZ1EfC/jBSWOzpz3VKoYjfjJ5JrNcFRjUczaxf/4+dozi3EaoY4upCHj t2MsM6u6R6AI+Ob/UCpXu0+kz9Tlye2qJ328UW5yv7tEuvEwN+JpnI6TXBI5BwlrUTn7 DiSysYqks0AQziRMpwfpUPpeOn8iNMvI51qEgtbDp6wWamqNhwvwpgUuJSRaywpud8pY mrJbyg/pjX/cG/Z65Dsr5UuWQR8suiTgBT2aUt5+q4mvCZnwIZSkW2smiwJk6N+o4nJe a1uQ== 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=QRrM7DDbEOFxSPJABSuKhiS28pDUB1r9WxqBAXQF7IA=; b=MbCHa3NaaeoehZ1SeQQoDNq7bHaHCQsbPb7NTHOxig2+8QH/OhNx/82M2uTo9icPkZ 3hx1KUqzIMPka8Tocwmq8CejvvcE1yuqxWC2kXTKYIgzSgzGY8jl5coQDKq6BE2eN1Pq eVwJ4sJ1zR79cJFplseASkoqTur54b18TMApj/eg+HPHu+HSZ/9VRUoBX7WINqf7AKzg /6MijyWuWdiyQjLcdz026o7HyKUQrAFMp90BKguhoERjvRKs98OVXbWK1mOfLJ+UFTlK Np7alaX5lycsgSY1CUuj79flNFDZlmD4r5kDe/dqXBiz0dAvfNEbdAav1PLnIWAOCRoa Vo0A== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM53221YgbMys4uIjbEpNLOCJSA9GBkVzAAEntoI8m/6pcW0RC4IQc WhNoEdOC0fE7EgaRm+Jbafs= X-Google-Smtp-Source: ABdhPJxaXOjXW5Ni57rI39ct91FaMS1Eb7vIsLRx385dWQc1RNhv1e6h8PMeTuOBKuiuoqHyxtRqYw== X-Received: by 2002:a4a:5241:: with SMTP id d62mr8216805oob.9.1631519682723; Mon, 13 Sep 2021 00:54:42 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:aca:53d2:: with SMTP id h201ls762198oib.0.gmail; Mon, 13 Sep 2021 00:54:41 -0700 (PDT) X-Received: by 2002:aca:1109:: with SMTP id 9mr6674172oir.109.1631519681169; Mon, 13 Sep 2021 00:54:41 -0700 (PDT) In-Reply-To: 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:29231 Archived-At: ------=_Part_2764_122886579.1631519680467 Content-Type: multipart/alternative; boundary="----=_Part_2765_1402383713.1631519680467" ------=_Part_2765_1402383713.1631519680467 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks, 'read' was the hint I was looking for! It's working now :) John MacFarlane schrieb am Donnerstag, 9. September 2021 um 19:22:19 UTC+2: > > Citations are only recognized when they're parsed as markdown. > @key in a code block or attribute won't be parsed. > > You could use the pandoc Lua 'read' function to parse the > contents of your attribute as Markdown and then do something with that. > > Carsten Gips writes: > > > 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=20 > Citeproc=20 > > on this temporary document with `pandoc.utils.run_json_filter`,=20 > 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= =20 > 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.m= d=20 > -t=20 > > json` returns only=20 > > > > ```json > >=20 > {"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":"MetaInl= ines","c":[{"t":"Str","c":"FOO"}]},"title":{"t":"MetaInlines","c":[{"t":"St= r","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 > >=20 > {"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":"MetaInl= ines","c":[{"t":"Str","c":"FOO"}]},"title":{"t":"MetaInlines","c":[{"t":"St= r","c":"Lorem"},{"t":"Space"},{"t":"Str","c":"Ipsum"}]}}}]}},"blocks":[{"t"= :"Para","c":[{"t":"Str","c":"see"},{"t":"Space"},{"t":"Cite","c":[[{"citati= onId":"FOO","citationPrefix":[],"citationSuffix":[],"citationMode":{"t":"No= rmalCitation"},"citationNoteNum":1,"citationHash":0}],[{"t":"Str","c":"(Wup= pie,"},{"t":"Space"},{"t":"Str","c":"n.d.)"}]]}]},{"t":"Div","c":[["refs",[= "references","csl-bib-body","hanging-indent"],[]],[{"t":"Div","c":[["ref-FO= O",["csl-entry"],[]],[{"t":"Para","c":[{"t":"Str","c":"Wuppie."},{"t":"Spac= e"},{"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"= :"Ipsum"},{"t":"Str","c":"."},{"t":"Str","c":"=E2=80=9D"}]]}]}]]}]]}]} > > ``` > > > > Clearly I'm missing something here. But what is it? Can you please=20 > 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 anywa= y? > >> > >> Thanks, > >> Carsten > >> > > > > --=20 > > You received this message because you are subscribed to the Google=20 > Groups "pandoc-discuss" group. > > To unsubscribe from this group and stop receiving emails from it, send= =20 > an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit=20 > https://groups.google.com/d/msgid/pandoc-discuss/782eda7c-31e7-45ac-928d-= 3fdea56e5412n%40googlegroups.com > . > > --- > > references: > > - author: > > - family: Wuppie > > id: FOO > > title: Lorem Ipsum > > --- > > see [@FOO] > --=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/9c08fc54-f3bf-451a-92fe-14d9c978711dn%40googlegroups.com. ------=_Part_2765_1402383713.1631519680467 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks, 'read' was the hint I was looking for! It's working now :)
John MacFarlan= e schrieb am Donnerstag, 9. September 2021 um 19:22:19 UTC+2:

Citations are only recognized when they're parsed as markdown.
@key in a code block or attribute won't be parsed.

You could use the pandoc Lua 'read' function to parse the
contents of your attribute as Markdown and then do something with that.

Carsten Gips <cagix...@gm= ail.com> writes:

> I've tried to resolve this manually by extracting this piece w= ith 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`, re= trieving=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 t= est.md -t=20
> json` returns only=20
>
> ```json
> {"pandoc-api-version":[1,22],"meta":{"ref= erences":{"t":"MetaList","c":[{"t&q= uot;:"MetaMap","c":{"author":{"t":&= quot;MetaList","c":[{"t":"MetaMap","= ;c":{"family":{"t":"MetaInlines","c= ":[{"t":"Str","c":"Wuppie"}]}}= }]},"id":{"t":"MetaInlines","c":[{&= quot;t":"Str","c":"FOO"}]},"title&q= uot;:{"t":"MetaInlines","c":[{"t":&= quot;Str","c":"Lorem"},{"t":"Space&= quot;},{"t":"Str","c":"Ipsum"}]}}}]= }},"blocks":[{"t":"Para","c":[{&quo= t;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":{"ref= erences":{"t":"MetaList","c":[{"t&q= uot;:"MetaMap","c":{"author":{"t":&= quot;MetaList","c":[{"t":"MetaMap","= ;c":{"family":{"t":"MetaInlines","c= ":[{"t":"Str","c":"Wuppie"}]}}= }]},"id":{"t":"MetaInlines","c":[{&= quot;t":"Str","c":"FOO"}]},"title&q= uot;:{"t":"MetaInlines","c":[{"t":&= quot;Str","c":"Lorem"},{"t":"Space&= quot;},{"t":"Str","c":"Ipsum"}]}}}]= }},"blocks":[{"t":"Para","c":[{&quo= t;t":"Str","c":"see"},{"t":&qu= ot;Space"},{"t":"Cite","c":[[{"cita= tionId":"FOO","citationPrefix":[],"citationSu= ffix":[],"citationMode":{"t":"NormalCitation&= quot;},"citationNoteNum":1,"citationHash":0}],[{"t= ":"Str","c":"(Wuppie,"},{"t":&= quot;Space"},{"t":"Str","c":"n.d.)&= quot;}]]}]},{"t":"Div","c":[["refs"= ,["references","csl-bib-body","hanging-indent"= ;],[]],[{"t":"Div","c":[["ref-FOO",= ["csl-entry"],[]],[{"t":"Para","c":= [{"t":"Str","c":"Wuppie."},{"t= ":"Space"},{"t":"Str","c":&quo= t;n.d."},{"t":"Space"},{"t":"Span&q= uot;,"c":[["",[],[]],[{"t":"Str",&q= uot;c":"=E2=80=9C"},{"t":"Str","c&q= uot;:"Lorem"},{"t":"Space"},{"t":&q= uot;Str","c":"Ipsum"},{"t":"Str&quo= t;,"c":"."},{"t":"Str","c"= ;:"=E2=80=9D"}]]}]}]]}]]}]}
> ```
>
> Clearly I'm missing something here. But what is it? Can you pl= ease 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 insid= e am=20
>> attribute like in the example. How can I resolve these citatio= ns 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 email to pandoc-discus..= .@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/782e= da7c-31e7-45ac-928d-3fdea56e5412n%40googlegroups.com.
> ---
> references:
> - author:
> - family: Wuppie
> id: FOO
> title: Lorem Ipsum
> ---
> see [@FOO]

--
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/9c08fc54-f3bf-451a-92fe-14d9c978711dn%40googlegroups.= com.
------=_Part_2765_1402383713.1631519680467-- ------=_Part_2764_122886579.1631519680467--