meta <- if (exists("meta")) meta else NULL

if (is.null(meta) || !is.list(meta)) {
  meta <- as.list(read.dcf("DESCRIPTION")[1, ])
}

.pkg_year <- format(Sys.Date(), "%Y")

bibentry(
  bibtype = "Manual",
  title   = "{textclean}: Text Cleaning Tools",
  author  = person(given = c("Tyler", "W."), family = "Rinker"),
  year    = .pkg_year,
  note    = paste("R package version", meta[["Version"]]),
  url     = meta[["URL"]],
  textVersion = paste(
    "Rinker, T. W.",
    sprintf("(%s).", .pkg_year),
    "textclean: Text Cleaning Tools.",
    sprintf("R package version %s.", meta[["Version"]]),
    meta[["URL"]]
  )
)
