year = sub('.*(2[[:digit:]]{3})-.*', '\\1', meta$Date, perl = TRUE)
if (length(year) == 0) year = format(Sys.Date(), '%Y')
vers = paste('R package version', meta$Version)
auth = format(Filter(function(p) 'aut' %in% p$role, as.person(meta$Author)), c('given', 'family'))

bibentry(
  'Manual',
  title = paste('rmarkdown:', meta$Title),
  author = auth,
  year = year,
  note = vers,
  url = strsplit(meta$URL, ',')[[1]][1],
)

bibentry(
  'Book',
  title = 'R Markdown: The Definitive Guide',
  author = c('Yihui Xie', 'J.J. Allaire', 'Garrett Grolemund'),
  publisher = 'Chapman and Hall/CRC',
  address = 'Boca Raton, Florida',
  year = '2018',
  isbn = '9781138359338',
  url = 'https://yihui.org/rmarkdown/',
)

bibentry(
  'Book',
  title = 'R Markdown Cookbook',
  author = c('Yihui Xie', 'Christophe Dervieux', 'Emily Riederer'),
  publisher = 'Chapman and Hall/CRC',
  address = 'Boca Raton, Florida',
  year = '2020',
  isbn = '9780367563837',
  url = 'https://yihui.org/rmarkdown-cookbook',
)
