Description Usage Arguments Details Value Converting to CFF from other formats References See Also Examples
Citation File Format (cff) writer
1 | cff_writer(z, path = NULL)
|
z |
an object of class |
path |
a file path or connection; default: |
uses yaml::write_yaml
to write to yaml format that
CFF uses
text if one cff citation or list of many
CFF has required fields that can't be missing. This means that
converting from other citation types to CFF will likely require
adding the required CFF fields manually. Adding fields to a
handl
object is easy: it's really just an R list so add
named elements to it. The required CFF fields are:
cff-version: add cff_version
message: add message
version: add software_version
title: add title
authors: add author
date-released: add date_published
CFF format: https://github.com/citation-file-format/citation-file-format
Other writers:
bibtex_writer()
,
citeproc_writer()
,
codemeta_writer()
,
rdf_xml_writer()
,
ris_writer()
,
schema_org_writer()
Other cff:
cff_reader()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | (z <- system.file('extdata/citation.cff', package = "handlr"))
res <- cff_reader(x = z)
res
unclass(res)
cff_writer(res)
cat(cff_writer(res))
f <- tempfile()
cff_writer(res, f)
readLines(f)
unlink(f)
# convert from a different citation format
## see "Converting to CFF from other formats" above
z <- system.file('extdata/citeproc.json', package = "handlr")
w <- citeproc_reader(x = z)
# cff_writer(w) # fails unless we add required fields
w$cff_version <- "1.1.0"
w$message <- "Please cite the following works when using this software."
w$software_version <- "2.5"
w$title <- "A cool library"
w$date_published <- "2017-12-18"
cff_writer(w)
cat(cff_writer(w))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.