R/aaa.R

Defines functions print_deprecation link

.names <- list(
  public = list(
    internals = list(
      id = "id",
      initials = "initials",
      literal_name = "literal_name",
      corresponding = "corresponding"
    ),
    primaries = list(
      given_name = "given_name",
      family_name = "family_name"
    ),
    secondaries = list(
      email = "email",
      phone = "phone",
      fax = "fax",
      url = "url"
    ),
    nestables = list(
      affiliation = "affiliation",
      role = "role",
      note = "note"
    )
  ),
  protected = list(
    orcid = "orcid",
    crt = list(
      conceptualization = "Conceptualization",
      data_curation = "Data curation",
      analysis = "Formal analysis",
      funding = "Funding acquisition",
      investigation = "Investigation",
      methodology = "Methodology",
      administration = "Project administration",
      resources = "Resources",
      software = "Software",
      supervision = "Supervision",
      validation = "Validation",
      visualization = "Visualization",
      writing = "Writing - original draft",
      editing = "Writing - review & editing"
    )
  )
)

.col_bullets <- list(
  corresponding = c(
    i = "Did you forget to assign corresponding authors?",
    i = "Use `set_corresponding_authors()` to set corresponding authors."
  )
)

.links <- list(
  crt = c("Contributor Roles Taxonomy", "https://credit.niso.org"),
  quarto_schemas = c(
    "author and affiliations schemas",
    "https://quarto.org/docs/journals/authors.html"
  )
)

.deprecations <- list(
  credit_roles = \(caller, param) {
    lifecycle::deprecate_warn(
      "0.2.0",
      what = glue("{caller}(credit_roles)"),
      with = I(glue("`{param} = credit_roles()`"))
    )
  },
  explicit_roles = \() {
    lifecycle::deprecate_warn(
      "0.2.0",
      what = I("Defining explicit roles in the input data"),
      with = "new(roles)",
      details = paste0(
        "See <",
        "https://arnaudgallou.github.io/plume/articles/plume.html",
        "#defining-roles-and-contributors",
        ">."
      )
    )
  }
)

link <- function(id) {
  els <- .links[[id]]
  md_link(els[[2]], els[[1]])
}

print_deprecation <- function(id, ...) {
  do.call(.deprecations[[id]], list(...))
}

Try the plume package in your browser

Any scripts or data that you put into this service are public.

plume documentation built on Sept. 12, 2024, 7:31 a.m.