citation
citation
Print and update citation files in CFF format.
Functions
| Name | Description |
|---|---|
| print_citation | Print the citation in the specified format. |
| update_citation | Update the citation file with the specified version and date. |
| write_citation | Generates a citation metadata file in the specified format. |
print_citation
citation.print_citation(citation_file='CITATION.cff', output_format='bibtex')Print the citation in the specified format.
This function reads a citation file in CFF format and prints it in the specified output format using the cffconvert library.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| citation_file | str | The path to the citation file (default is “CITATION.cff”). | 'CITATION.cff' |
| output_format | str | The format to print the citation in (default is “bibtex”). | 'bibtex' |
Examples
>>> print_citation()
@article{...update_citation
citation.update_citation(
citation_file='CITATION.cff',
version='${{ steps.set-version.output.NEXT_VERSION }}',
date=date_today(),
debug=False,
)Update the citation file with the specified version and date.
This function updates the version and date-released fields in the citation file and writes the updated content back to the file.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| citation_file | str | The path to the citation file (default is “CITATION.cff”). | 'CITATION.cff' |
| version | str | The version to set in the citation file (default is “\({{ steps.set-version.output.NEXT_VERSION }}"). | `'\){{ steps.set-version.output.NEXT_VERSION }}’| | date | [str](str) | The release date to set in the citation file (default is today's date). |date_today()| | debug | [bool](bool) | If True, print the updated citation content instead of writing to the file (default is False). |False` |
Examples
>>> update_citation(version="1.0.1", date="2023-10-01")write_citation
citation.write_citation(
citation_file='CITATION.cff',
output_file='codemeta.json',
output_format='codemeta',
)Generates a citation metadata file in the specified format.
Reads citation information from a CITATION.cff file, converts it to the desired output format (default: codemeta), and writes it to the specified output file.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| citation_file | str | Path to the input CITATION.cff file. (Default: “CITATION.cff”). | 'CITATION.cff' |
| output_file | str | Path to the output file where the citation metadata will be written. (Default: “codemeta.json”). | 'codemeta.json' |
| output_format | str | Format of the output citation metadata. See validate_or_write_output. (Default: “codemeta”). |
'codemeta' |
Returns
| Name | Type | Description |
|---|---|---|
| None |