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 > > filter, converting it into a new document and running Pandoc plus > Citeproc > > on this temporary document with `pandoc.utils.run_json_filter`, > retrieving > > the processed citation and putting it back as codeblock caption in the > > 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":{"references":{"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":"Ipsum"}]}}}]}},"blocks":[{"t":"Para","c":[{"t":"Str","c":"see > > > [@FOO]"}]}]} > > ``` > > i.e. the citation is not resolved. > > > > However, if I run Pandoc directly on this document, i.e `pandoc -t json > > --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":"MetaInlines","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":[[{"citationId":"FOO","citationPrefix":[],"citationSuffix":[],"citationMode":{"t":"NormalCitation"},"citationNoteNum":1,"citationHash":0}],[{"t":"Str","c":"(Wuppie,"},{"t":"Space"},{"t":"Str","c":"n.d.)"}]]}]},{"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":"n.d."},{"t":"Space"},{"t":"Span","c":[["",[],[]],[{"t":"Str","c":"“"},{"t":"Str","c":"Lorem"},{"t":"Space"},{"t":"Str","c":"Ipsum"},{"t":"Str","c":"."},{"t":"Str","c":"”"}]]}]}]]}]]}]} > > ``` > > > > 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. > >> > >> ```{.c caption="nice, see [@KEY]"} > >> ... > >> ``` > >> > >> Pandoc and Citeproc are currently not handling citations inside am > >> attribute like in the example. How can I resolve these citations anyway? > >> > >> Thanks, > >> Carsten > >> > > > > -- > > 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...-/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 > . > > --- > > references: > > - author: > > - family: Wuppie > > id: FOO > > title: Lorem Ipsum > > --- > > see [@FOO] > -- 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-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.