CSL: new item "type" for special cases

edited December 5, 2020
Is there any way to declare a new "item type" ("type" in CSL) that Zotero can recognize and use?


Background:
My Comp-Sci knowledge is essentially on the level of a university tech help desk worker, but I've been trying to edit a style (using https://editor.citationstyles.org) to meet my university's specifications (because I don't want to put strain on all the lovely people already building citation styles, and I read they don't like to do university formats for free). There are three special cases (lexica, classical/medieval works, and distributed class notes) that require unique citation formats, but they have no relevant item types in Zotero. So, I have the user work with types that most closely do the job (encyclopedia articles, books/book sections, and presentations, respectively) and distinguish these special cases by putting something in the "note" (Zotero's "Extra") field. The code dictates the special rules if it sees these types and something is present in the "note" field.

Then, I realized that users will have a lot of works that already have something in the "note" field thanks to the thoroughness of the Zotero browser connector. I don't want the user to have to clean out all their "Extra" fields in certain item types to use this style.

I don't think I can rework more obscure item types (e.g. Bills, Cases, Maps, and Artwork) for these special cases because they don't have the necessary fields.

Suggestions?

Many thanks in advance, benevolent wizards.
  • A ‘classic’ item type is part of CSL 1.0.2 for this purpose. That should be available in the next few months. Once CSL 1.0.2 is released, you can tell Zotero to treat an item as that type by adding this to the top of Extra:
    Type: classic
  • Actually, I think that should work already even if that's currently just a hack.

    For class notes, maybe the generic document type could be a good fit?

    Generally, you can just put arbitrary flags to the top of the note field, like
    is-lexikon: true

    You can then test for the presence of that variable. (The content of the variable doesn't matter.)

    Just be aware that those hacks break the schema. You won't be able to upload such a style to the repo. And there's no guarantee that this will continue to work. (Zotero will probably switch to a new citeproc, and I don't know how that affects these things.)
  • edited January 2, 2021
    This is excellent; thank you, bwiernik, and maier.de--you all really know what you are talking about!

    I considered the generic "document" type, but I noticed that that other things in this field of study already seem to use that type.

    Maier.de, do you happen to know the syntax for testing if the note field contains "is-lexikon: true"? I unfortunately only know how to test if the note field is filled:
    >if variable="note">
    >text "foo bar"/>
    >/if>
    (I had to edit the code a little to make it visible)

    The style is coming along swimmingly, thanks to your help.
  • edited January 2, 2021
    You cannot check for the content of a variable.
    So you just test for
    if variable="is-lexikon"
    (Zotero will pull out these things from the top of the extra field and use them as variables.)
  • I would not rely on such completely custom variables continuing to work, though.
  • Thanks! This is all very helpful.
Sign In or Register to comment.