aurimasv / z2csl

Zotero extension for creating Zotero to CSL item type and field mappings.
https://aurimasv.github.io/z2csl/typeMap.xml
42 stars 9 forks source link

Can z2csl convert from Zotero to CSL JSON as a standalone executable / package? #19

Closed dhimmel closed 5 years ago

dhimmel commented 5 years ago

We are interested in generating CSL JSON for ISBNs for the manubot project (refs https://github.com/greenelab/manubot/issues/14 / https://github.com/greenelab/manubot/pull/79 / https://github.com/greenelab/manubot/issues/70).

Using the Wikimedia Citoid API, we can make the following call:

https://en.wikipedia.org/api/rest_v1/data/citation/zotero/9780387950938

which produces the following output:

[
    {
        "itemType": "book",
        "creators": [
            {
                "creatorType": "author",
                "lastName": "W.",
                "firstName": "Gamelin, Theodore"
            }
        ],
        "date": "2001",
        "publisher": "Springer",
        "title": "Complex analysis",
        "oclc": "44162561",
        "url": "https://www.worldcat.org/oclc/44162561",
        "ISBN": "0387950699, 9780387950693, 0387950931, 9780387950938",
        "place": "New York",
        "numPages": "xviii, 478 pages",
        "accessDate": "2018-11-11"
    }
]

The Manubot application uses CSL JSON data for references and is implemented in Python. Any suggestions on whether we can use z2csl to transform this output to CSL JSON? Worst case we could hardcode the field conversion, but is there a more efficient way that would use the XML conversion information in typeMap.xml?

zuphilip commented 5 years ago

No, this repository is only for the mapping between the item types and fields. It will produce a website but cannot do any transformation between the two formats.

Behind Citoid there is the (old) translation-server running, but you can also look a the (new) translation-server directly which has also an export endpoint: https://github.com/zotero/translation-server . The logics comes from the CSL JSON translator which relies on some Zotero function.

dhimmel commented 5 years ago

Thanks @zuphilip for the information. Seems like it'd be helpful for us to use the new translation-server as we discussed briefly in https://github.com/greenelab/manubot/issues/70. I'll open an issue on https://github.com/zotero/translation-server about what's the easiest way to do this and whether Zotero hosts any public facing APIs for this server.