Convert a character
representing a BibTeX entry to a
cff_ref_lst
object.
Arguments
- x
A vector of
character
objects with the full BibTeX string.- encoding
Encoding to be assumed for
x
, seereadLines()
.- ...
Arguments passed on to
cff_read_bib()
.
Value
An object of classes cff_ref_lst, cff
according to the
definitions.references
specified in
the Citation File Format schema.
Each element of the cff_ref_lst
object would have classes
cff_ref, cff
.
Details
This is a helper function that writes x
to a *.bib
file and reads it with
cff_read_bib()
.
This function requires bibtex (>= 0.5.0) and uses
bibtex::read.bib()
.
See also
cff_read_bib()
for reading *.bib
files.
Other functions for working with BibTeX format:
as_bibentry()
,
cff_read()
,
cff_write_bib()
,
encoded_utf_to_latex()
Other functions for reading external files:
cff_read()
Examples
if (requireNamespace("bibtex", quietly = TRUE)) {
x <- c(
"@book{einstein1921,
title = {Relativity: The Special and the General Theory},
author = {Einstein, Albert},
year = 1920,
publisher = {Henry Holt and Company},
address = {London, United Kingdom},
isbn = 9781587340925
}",
"@misc{misc-full,
title = {Handing out random pamphlets in airports},
author = {Joe-Bob Missilany},
year = 1984,
month = oct,
note = {This is a full MISC entry},
howpublished = {Handed out at O'Hare}
}"
)
cff_read_bib_text(x)
}
#> - type: book
#> title: 'Relativity: The Special and the General Theory'
#> authors:
#> - family-names: Einstein
#> given-names: Albert
#> year: '1920'
#> publisher:
#> name: Henry Holt and Company
#> address: London, United Kingdom
#> isbn: '9781587340925'
#> - type: generic
#> title: Handing out random pamphlets in airports
#> authors:
#> - family-names: Missilany
#> given-names: Joe-Bob
#> year: '1984'
#> month: '10'
#> notes: This is a full MISC entry
#> medium: Handed out at O'Hare