[NTG-context] Citeproc-lua

Hans Hagen j.hagen at xs4all.nl
Fri May 6 23:44:38 CEST 2022

On 5/6/2022 11:02 PM, Denis Maier via ntg-context wrote:

> I also have the impression that extending citeproc-formats.lua should be the easiest part. As an aside, I think the HTML is in there because that is needed for the test suite, but for ConTeXt we should be able to copy the LaTeX mapping and tweak a few things here and there.

> The LaTeX package is hard to understand, at least if you're not used to the "new" latex3 programming syntax and style. I also can only guess what that stuff does. But as you say this is rather isolated from the citeproc processing, so I guess the main task would be to come up with an equivalent ConTeXt module that writes the citations to the tuc file, calls the citeproc engine, and uses the results for the output. Right? (I.e., AFAICS, everything that lives under https://github.com/zepinglee/citeproc-lua/tree/main/citeproc should pretty much just work, while https://github.com/zepinglee/citeproc-lua/tree/main/latex must be adapted.)

For the record: i don't think you should write something to the tuc file 
that doesn't come from context itself because you can mess it up (also 
performaance wise). Of course you could have another file (just like a 
bib file is independent). One problem could be that you need to make 
some extra installation to make it work as we're not going to add all 
kind of code to the distribution (we tend to go smaller) and someone 
needs to maintain that moduie then because users depend in it working.

Did you look into what pandoc provides? It might be easier to take that 
output and include it. Some kind of html? That's easy to render.

A bit like this:

- Convert the whole bibliography database to html using pandoc in the 
preferred cs rendering. That should be fast.

- Use the normal context commands for referencing a citation (the cite 
part is normally easy as there is not much variation in that; if needed 
one can cheat and also pregenerate that). That's then just some 
relatively small plugin mode.

- When placing the bibliography, filter the right entries from that html 
file (easy) using info that got stored in the tuc.

It is also fast. The only depdency then is pandoc but that is widely 
available (irr). But I would need to see an example of that kind of out 
first. We basically treat the (formatted) bibliography as an external 
resource but in some format that we can easily parse (and if needed 


                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl

More information about the ntg-context mailing list