[NTG-context] Citeproc-lua

denis.maier at unibe.ch denis.maier at unibe.ch
Fri May 6 23:02:06 CEST 2022


Hi,
thanks for your assessment. Indeed, that looks very promising.

I've now had a chance to look at this a bit more too.  Not that I understand that stuff in detail, but anyway...

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: the relevant stuff in the aux file looks like this:
\bibstyle {apa}
\bibdata {examples.bib}
\csloptions {}
\citation {{texbook at 1}{{id={texbook},label={page},locator={12}}}{1}}
\citation {{latex2e at 1}{{id={latex2e},prefix={see }}}{1}}
\citation {{texbook at 2}{{id={texbook},prefix={see },label={page},locator={12}}}{1}}
\citation {{texbook at 3}{{id={texbook},prefix={see },suffix={, everywhere}}}{1}}
\citation {{texbook at 4}{{id={texbook},prefix={see },label={page},locator={12, and passim}}}{1}}

But I guess that's the way these things work in latex, and adding that stuff to a lua table will probably save us much trouble anyway. (E.g., no need for https://github.com/zepinglee/citeproc-lua/blob/main/latex/citeproc#L81, or https://github.com/zepinglee/citeproc-lua/blob/main/latex/csl-core.lua#L168)

Regarding the citation commands, I've noticed that while biblatex's syntax model (\cite[prenote][postnote]{key}, e.g. \cite[see][34]{doe}) is supported, the preferred method is actually \cite[prefix={See }, page={34}]{doe}. But that's of course not so important since the important question is how that stuff is passed to the citeproc.

Best,
Denis



> -----Ursprüngliche Nachricht-----
> Von: Taco Hoekwater <taco at elvenkind.com>
> Gesendet: Freitag, 6. Mai 2022 14:57
> An: mailing list for ConTeXt users <ntg-context at ntg.nl>
> Cc: Maier, Denis Christian (UB) <denis.maier at unibe.ch>
> Betreff: Re: [NTG-context] Citeproc-lua
> 
> Hi,
> 
> I had a quick look at this and it seems very extensible if-not-quite ConTeXt-
> ready right away.
> 
> On the input side, it reads a LaTeX .aux file to parse things like options,
> databases, and requested citations.
> For this, it uses a dedicated “citeproc” lua script that should be easy to
> modify/copy for someone who knows what is actually in the ConTeXt .tuc
> file.
> 
> On the output side, it uses a lookup table to generate the desired markup (in
> citeproc-formats.lua). Right now, there are definitions provided for HTML
> and LaTeX, but that is very simple to extend.
> 
> There is a LaTeX package for the integration (making sure the right
> commands appear in the aux file, option processing, et cetera), and that file I
> do not understand *at all*. It seems to be completely isolated from the core
> citeproc processing, though.
> 
> Very promising stuff, I think.
> 
> But: I personally do not understand how to do the integration with ConTeXt’s
> new biblio system. I only understand half of what ConTeXt does these days,
> and much less of what the LaTeX package is trying to achieve i.r.t. options.
> 
> Best wishes,
> Taco
> 
> > On 3 May 2022, at 22:00, Denis Maier via ntg-context <ntg-
> context at ntg.nl> wrote:
> >
> > Hi,
> >
> > I just came across this: https://github.com/zepinglee/citeproc-lua
> > Thats’s an lua implemenation of the CSL language targeting LaTeX.
> > I don’t know if the processor itself contains any LaTeX specific code,
> > but it looks like the integration basically happens here
> > :https://github.com/zepinglee/citeproc-lua/blob/main/latex/citation-st
> > yle-language.sty So, at least in theory, shouldn’t it be possible to
> > make this workable also with context?
> >
> > Best,
> > Denis
> >
> ______________________________________________________________
> ________
> > _____________ If your question is of interest to others as well,
> > please add an entry to the Wiki!
> >
> > maillist : ntg-context at ntg.nl /
> > http://www.ntg.nl/mailman/listinfo/ntg-context
> > webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> > archive  : https://bitbucket.org/phg/context-mirror/commits/
> > wiki     : http://contextgarden.net
> >
> ______________________________________________________________
> ________
> > _____________
> 
> Taco Hoekwater
> Elvenkind BV
> 
> 
> 



More information about the ntg-context mailing list