scriptotek/php-marc

Convert MARC to CSL JSON

rudolfbyker opened this issue · 2 comments

I'm writing a mapper from MARC to CSL-JSON, also known as CiteProc-JSON. This JSON format is not part of the CSL spec, but made semi-official by the popular citeproc-js, and it's also the format expected by citeproc-php. I could not find an existing mapping or any recommendations, so I'm guessing based on the MARC docs and the CSL docs.

Do you think this should be part of php-marc, or rather a separate project that depends on php-marc? Or do you know of something like this that already exists? I would be happy to create a new project, or contribute my code to yours. Thus far, it's a single class whose contructor takes a \Scriptotek\Marc\Record argument, and it implements JsonSerializable, so you can simply do domething like json_encode(new MarcCslVariables(Record::fromSimpleXMLElement(simplexml_load_file("in.xml"))))

My use case: Connecting Koha to Drupal through OAI PMH and rendering citations in Drupal. 😎 📚

I decided to make it a separate project. It depends on your project: https://github.com/rudolfbyker/php-marc-csl

That's quite cool! I haven't had a use case for converting MARC to CSL yet, but I might actually need that one day, so thanks for sharing the code :) I agree it's better to have as a separate project.