zotero / citeproc-rs

CSL processor in Rust.

Home Page:https://cormacrelf.github.io/citeproc-wasm-demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

suppress-author and friends

adomasven opened this issue · comments

Testing with the current build none of the custom item fields like suppress-author, prefix, suffix, locator and others appear to be working. The produced citations have the default output.

To be clear are these supposed to be fields on a (citeproc-rs terminology) reference? That are meant to provide a default value for those things that would normally be provided by a cite? If so that's not implemented. I haven't seen it in any spec anywhere.

Also by custom do you mean fields on the "custom" object you can provide in CSL-JSON? (This entire object is ignored. I'm not sure what's supposed to be done with it. Custom variables? I thought CSL was very against that!)

I was pretty sure these worked already in a previous version, but perhaps I am wrong.

Well that's different. The prefix and suffix and locator on a cite are working still. A large slice of the suite doesn't pass without them. I just sanity checked the JavaScript API by adding a quick js-tests test for affixes, and they definitely haven't gone anywhere. So I'm not sure what's gone wrong, except that the various APIs look a bit similar and maybe you're putting them on a Cluster instead, which doesn't support them.

It doesn't do suppress-author though. It's been planned but I can make the suppression system a priority.

Sorry, this was indeed my bad re prefix and suffix. suppress-author, however indeed doesn't work, but is a blocker. author-only can wait longer, although I imagine once you have one of the options the other is trivial to provide.

@cormacrelf Any update on this? Is this difficult to add? What timeline should we expect?

I'm just about done, probably tomorrow or Sunday!

That turned out not to be quite true, sorry; I found some more edge cases in cluster mode and given the assembly of rendered cites into a cluster is some of the most finicky code in there, I went for a refactor. I know the base requirement is suppress-author & author-only on a per-cite basis but I think it's worth having a full implementation of zotero/zotero#1580 (see Frank's documentation link) and it's best to do all of it while my head's in that code. I think I can safely promise I'll be done this weekend.

Specifically, implementation-wise, now it has to handle composite clusters writing to two different <layout> element streams with different delimiters and affixes, and that hits grouping and collapsing since you want to be able to collapse the author in Same Author, composite infix (2008, 2010a-c) (I believe using the <intext> element's output for name collapsing if available). That code was a little too fragile to adapt directly. I have changed it to use some custom iterators for grouping + collapsing and a fun type called Partial which is like an Option but comparing anything with the None value results in a!=b. Use that as a group-by key and you have a much simpler way to express "group together runs of the same year" that works in the face of some cites not having a year at all. Anyway, it's better.

Available in @citeproc-rs/wasm@0.0.0-canary-0157c4b.