Get formatted citation with lua function #9749
Replies: 3 comments 3 replies
-
I'm not sure I understand. But if you just want the contents of the Div that normally encloses the whole citation, you can easily extract that with the current Lua API. |
Beta Was this translation helpful? Give feedback.
-
Thank you @jgm for the reply. Sorry if I didn't make myself clear. I slightly edited my question because I realised that by not using ` to point to the xml tags inside I was thinking and they are actually two different use cases. I will describe both. The first use case is Crossref. For that I have this little filter:
Then in the template I use:
This works for this use case. My question is whether I am making this more complicated than it should be. The second use case is (I think) a bit more complex. In this case it is a specification of the jats DTD 1.1 made by Scielo. In this specification it is required that each The solution I see for now would be to intervene the resulting xml outside of Pandoc, but I like my workflow to go through Pandoc. |
Beta Was this translation helpful? Give feedback.
-
Commenting mainly to ask if you would update us when you make progress. The way we're currently handling this in JOSS is similar to what you describe, i.e., we're using the |
Beta Was this translation helpful? Give feedback.
-
I'm trying to generate xml output that is compatible with the Crossref xml schema. For this I generated a custom template, which I use together with the jats-xml writer and some filters to fix the most important differences (actually I could use the html writer, since in xml-Crossref you don't have to put the body text, but only metadata, but it works fine with jats so I leave it).
For the
<citation>
tag, Crossref has a fairly customised way of ordering the fields (see recommendations). With a lua filter I adapted the 'references' field to match the tags that crossref uses. One of the tags that uses this scheme is<unstructured_citation>
which is basically the formatted citation. I wrote a lua filter that generates the references in the body (usingpandoc.utils.citeproc
) and then generates a table with the formid = formatted reference
. With this table I add, for each reference in 'meta', the field manually.This works, but I feel it's a bit far-fetched.
I should make it clear that, although this seems a rather particular use case, a similar situation occurs for the schema of [Scielo 1.9] (https://scielo.readthedocs.io/projects/scielo-publishing-schema/pt-br/latest/) and earlier, for which I also plan to generate the xml). In this case, it is mandatory to include the tag
<mixed-citation>
inside each<ref>
element.The proposal is to have a function inside the lua api that allows to generate references for each reference element directly (without having to generate a div with the references in the blocks). I imagine that something like this:
pandoc.utils.formatedcitation(meta.references[1])
, could give me the formatted citation.Beta Was this translation helpful? Give feedback.
All reactions