Citation exports
citesync export --format apa|bibtex|csl-json|jsonld|datacite|ris|endnote prints a citation made from the source file. To keep committed copies up to date, list them under exports in the config:
exports = ["CITATION.bib", "citation.csl.json", "citation.apa.txt", "schema.jsonld", "citation.datacite.xml", "citation.ris", "citation.enw"]
citesync write then creates and updates each file. citesync check reports one that is missing or out of date as export-stale, so the hook catches a release that changed the version but not the exports. Each export is generated whole, so don't edit it by hand.
The suffix picks the format:
| Suffix | Format | Notes |
|---|---|---|
.bib |
biblatex-software @software |
Field names come from codemeta-drift's bibtex rows. Names in braces, so particles and organisations stay whole. url and year are written next to repository and date, so plain BibTeX styles, which print @software as @misc, still show them. |
.csl.json |
CSL-JSON, type software |
For Pandoc, Zotero and other CSL processors (Pandoc guide). |
.apa.txt |
APA 7 software reference, one line | Initials from given names (J.-B. for Jean-Baptiste). Up to 20 authors, then the first 19, an ellipsis and the last. (n.d.) with no release date. Links the DOI, else the repository. |
.jsonld |
schema.org SoftwareSourceCode |
The plain https://schema.org context, which search engines read, so a website can embed it in a <script type="application/ld+json"> tag. CodeMeta's context isn't read by them. |
.datacite.xml |
DataCite Metadata Schema 4.7 | Each element sits where codemeta-drift's datacite rows put it. DataCite requires a DOI, an author, a publisher and a release year, so citesync export refuses it with exit 3, and check reports export-stale, when the source lacks one or holds one citesync can't use. The publisher is publisher in codemeta.json: a name, an Organization with a name, or a list of Organizations (the first is used). A SWHID is left out: the schema requires a relation type for a related identifier, and the rows name none. See below for the values citesync chooses. |
.ris |
RIS, type COMP (computer program) |
For Zotero, EndNote, Mendeley and other reference managers. Each tag sits where codemeta-drift's ris rows put it: TI, AU per author as Family, Given, ET for the version, DO, UR, AB, KW per keyword, PY with the year only, and PB. Each value is one line, so a description with paragraphs is joined into one. An organisation name with a comma (Acme, Inc.) is read back as family name Acme, given name Inc.: RIS and EndNote have no way to mark a name as an organisation. The record ends with ER -, without the trailing space, so a whitespace hook leaves it alone. |
.enw |
EndNote tagged, type Computer Program |
The same fields under EndNote's tags from its rows: %T, %A, %7 for the version, %R for the DOI, %U, %X, %K, %D with the year, and %I. |
In the DataCite XML, citesync chooses three values that no mapping row holds:
resourceTypeGeneralis alwaysSoftware, because citesync describes software.- Every contributor gets
contributorType="Other", because the source holds no role. - A person's
creatorNameisFamily, Givenwhen both parts are known, else the name as written.creatorNameandcontributorNameare required by the schema, and no row names them.
The citation key in BibTeX and CSL-JSON is the title up to any subtitle, in lowercase ASCII with dashes: CRediT Matrix: drafting CRediT contribution statements gives credit-matrix.
Citation files
citesync export --format cff|codemeta|zenodo prints the CITATION.cff, codemeta.json or .zenodo.json citesync would make from the source, and writes nothing. Each is built as init builds CITATION.cff and as write creates the other two: each field comes from the first file that holds it, and the keywords from every file, so the printed file passes check. The CITATION.cff needs no CITATION.cff to read, just as init doesn't, and like init it stops when any of those files can't be read, or when a source named with --source or source is missing. What the file can't hold goes to stderr as leaving out <field>: <why>, so citesync export --format cff > CITATION.cff stays a clean file.
These three can't go under exports: list them under files, and write updates them field by field, keeping comments, key order and fields citesync doesn't map. An export is made again whole, which would drop those.
Where the values come from
The values come from the source. A field the source doesn't hold, such as the DOI when pyproject.toml is the source, comes from the first other software file that holds it, in the order check reads them. Derived dataset CodeMeta, RO-Crate and Croissant files do not supply fallback values. An RO-Crate or Croissant file supplies values when you explicitly select it as the source. The BibTeX url and CSL URL are the repository URL. A release date that isn't YYYY, YYYY-MM or YYYY-MM-DD is left out of BibTeX, CSL-JSON and APA, and the command says so on stderr. JSON-LD keeps the date as written.
Use the files at build time: a static site imports schema.jsonld or citation.apa.txt without running Python, and the playground offers the same files, DataCite XML only when the record has a DOI, an author, a publisher and a release year.