| as_bibentry | R Documentation |
bibentry objects from multiple sourcesThis function creates bibentry objects from multiple metadata sources
(cff objects, DESCRIPTION files and other sources). The inverse
transformation from a bibentry object to cff_ref_lst can be performed
with the corresponding as_cff.bibentry() method.
With toBibtex(), you can convert cff objects to
BibTeX markup on the fly. See Examples.
as_bibentry(x, ...)
## Default S3 method:
as_bibentry(x, ...)
## S3 method for class 'character'
as_bibentry(x, ..., what = c("preferred", "references", "all"))
## S3 method for class ''NULL''
as_bibentry(x, ...)
## S3 method for class 'list'
as_bibentry(x, ...)
## S3 method for class 'cff'
as_bibentry(x, ..., what = c("preferred", "references", "all"))
## S3 method for class 'cff_ref_lst'
as_bibentry(x, ...)
## S3 method for class 'cff_ref'
as_bibentry(x, ...)
x |
The source used to generate the
|
... |
Additional arguments passed to or from methods. |
what |
Fields to extract from a full
See |
An R bibentry object is the representation of a BibTeX entry. These
objects can be converted to BibTeX markup with utils::toBibtex(), which
creates an object of class Bibtex that can be printed and exported as a
valid BibTeX entry.
as_bibentry() tries to map the information of the source x into a cff
object and maps the metadata to BibTeX as described in
vignette("bibtex-cff", package = "cffr").
as_bibentry() returns a bibentry object with one or more entries.
Patashnik O (1988). "BIBTEXing." https://osl.ugr.es/CTAN/biblio/bibtex/base/btxdoc.pdf.
Haines R, The Ruby Citation File Format Developers (2022). "Ruby CFF Library." \Sexpr[results=rd]{tools:::Rd_expr_doi("10.5281/zenodo.7294987")}. https://github.com/citation-file-format/ruby-cff.
Hernangómez D (2022). "BibTeX and CFF, a potential crosswalk." cffr vignette. https://docs.ropensci.org/cffr/articles/bibtex-cff.html.
utils::bibentry() documents the bibentry class.
vignette("r-cff", package = "cffr") explains how the
metadata of a package is mapped to produce a cff object.
vignette("bibtex-cff", package = "cffr") provides details about the
internal mapping performed between cff objects and BibTeX
markup, both cff to BibTeX and BibTeX to cff.
utils::toBibtex() converts bibentry objects to BibTeX markup.
Work with BibTeX metadata:
cff_read(),
cff_read_bib_text(),
cff_write_bib(),
encoded_utf_to_latex()
Convert between R classes:
as_cff(),
as_cff_person(),
cff_class
# From a `cff` object ----
cff_object <- cff()
cff_object
# A `bibentry` object.
bib <- as_bibentry(cff_object)
class(bib)
bib
# Print as BibTeX.
toBibtex(bib)
# The S3 method also supports this.
toBibtex(cff_object)
# Other sources ----
# From a CITATION.cff.
path <- system.file("examples/CITATION_complete.cff", package = "cffr")
cff_file <- as_bibentry(path)
cff_file
# For an installed package with options.
installed_package <- as_bibentry("jsonvalidate", what = "all")
installed_package
# Use a DESCRIPTION file.
path2 <- system.file("examples/DESCRIPTION_gitlab", package = "cffr")
desc_file <- as_bibentry(path2)
toBibtex(desc_file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.