Translators, CSLJSON, export CSL variables from Extra field ?

edited August 9, 2023
CSL (Citation Style Language) has more variables than the Zotero form interface. Some less common variables are advised to be encoded in the Extra field. They are not exported in their own variable by the CSLJSON translator.

For example, you can produce this citation line in APA7
Doe, J. (n.d.). My review [Review of Totem and Taboo, by S. Freud]. Journal.

“My review” is the title of the article, “John Doe” is an author, “S. Freud” a reviewed author, but there is no form field for the reviewed title. The CSL processor in Zotero handle nicely a variable encoded like that in the Extra field.

reviewed-title: Totem and Taboo

Sadly, this “reviewed-title” variable is not exported with its own name by the CSLJSON translator, but in the note variable, like in the Extra field.

    {
        "id": "http://zotero.org/users/8989645/items/2W46VRFQ",
        "type": "article-journal",
        "container-title": "Journal",
        "language": "en",
        "note": "The Extra field with some mess.\nreviewed-title: Totem and Taboo\nMy variable: for private usage only",
        "title": "My review",
        "author": [
            {
                "family": "Doe",
                "given": "John"
            }
        ],
        "reviewed-author": [
            {
                "family": "Freud",
                "given": "Sigmung"
            }
        ]
    }

Why not parse the Extra field, like the CSL processor, before exporting to CSLJSON, to get "reviewed-title" in its own variable ?

    {
        "title": "My review",
        "reviewed-title": "Totem and Taboo"
        "note": "The Extra field with some mess.\nMy variable: for private usage only",
        …
    }

The code handling that is not in the CSLJSON Translator, but in a clever and powerful method in Zotero core
https://github.com/zotero/utilities/blob/9e71e449b67e7e4a437f77d234613587b7c5d4c7/utilities_item.js#L51

Surely, this place allow to call the right method in CSL processor to parse the Extra field for extra CSL variables.
  • The BBT CSL JSON export will do this
  • “will”, you mean it is not yet available or I missed it ?
  • It's working now, but only in the Better BibTeX version of CSL JSON export
  • Do you think it should, or not, a core feature of Zotero ? @dstillman

    Why this BBT code for CSL-JSON is not in Zotero ? They don’t want it ? They have not enough time to acclimatise it ? To my opinion, their should be one canonic piece of code parsing the Extra field. Users need a consistent behaviour on some issues like : what to do with free text which is truly a note ? unknown CSL variables will be appended ? parsing of names, dates, numbers ?

    For myself I already pre-process CSL before consuming it, to be as close as possible to the source of the information if I have a bug.
  • edited August 9, 2023
    I'd have a preference for the export to pick up the variables from extra, but I have a weak recollection that devs don't actually agree with that -- it's at least not an obvious case whether this is a Zotero or processor feature (and only in the former case should Zotero parse them on export)
  • May be this discussion could be a good place to read the arguments of devs against parsing Extra field for CSL variables. Wait & see.
  • what to do with free text which is truly a note ?
    Preferably it should go in a separate note item, not the extra field. BBT does still support the extra field having fields and notes together, but having the extra field reserved for fields would make things much simpler.
  • edited August 9, 2023
    For the CSLJSON exporter, there is a problem. CSL accept only one note variable, Zotero allow multiple notes attached, but do not record an order. Which one should be the first to be exported in CSL ? Export only one note, all ? Use a prefix like “CSL” to allow different kind of notes ?

    There is a good argument for you option, the CSL note variable should be used for : «Descriptive text or notes about an item (e.g. in an annotated bibliography)», typically Rich Text. Extra textarea is not the most comfortable control for rich text. But you will have to live with tons of records using Extra for notes.
  • Which is why BBT still treats it as a mixed-purpose field.
Sign In or Register to comment.