if (!exists("meta") || is.null(meta)) {
  meta <- packageDescription("sdbuildR")
}
year <- sub("-.*", "", meta[["Date/Publication"]])
if (!length(year) || is.na(year) || !nzchar(year)) {
  year <- format(Sys.Date(), "%Y")
}
# Drop the development suffix (e.g. "2.0.0.9000" -> "2.0.0")
version <- sub("\\.9[0-9]{3}$", "", meta$Version)
vers <- sprintf("R package version %s", version)

bibentry(
  bibtype = "Manual",
  key = "sdbuildR",
  title = "{sdbuildR}: An Accessible Interface for Stock-and-Flow Modelling in R",
  author = person(
    given = "Kyra Caitlin", family = "Evers",
    email = "kyra.c.evers@gmail.com",
    comment = c(ORCID = "0000-0001-6890-3482")
  ),
  year = year,
  note = vers,
  url = "https://kcevers.github.io/sdbuildR/",
  doi = "10.32614/CRAN.package.sdbuildR",
  textVersion = paste0(
    "Evers, K. (", year, "). ",
    "sdbuildR: An Accessible Interface for Stock-and-Flow Modelling in R. ",
    vers, ". https://doi.org/10.32614/CRAN.package.sdbuildR"
  )
)
