R/rd-backref.R

Defines functions format.rd_section_backref roxy_tag_rd.roxy_tag_backref roxy_tag_parse.roxy_tag_backref

#' @export
roxy_tag_parse.roxy_tag_backref <- function(x) {
  tag_value(x)
}

#' @export
roxy_tag_rd.roxy_tag_backref <- function(x, base_path, env) {
  rd_section("backref", x$val)
}

#' @export
format.rd_section_backref <- function(x, ...) {
  filename <- unique(x$value)
  filename <- file.path(basename(dirname(filename)), basename(filename), fsep = "/")

  lines <- stringi::stri_wrap(
    paste0("Please edit documentation in ", paste(filename, collapse = ", ")),
    initial = "% ",
    prefix = "%   ",
    width = 80,
    whitespace_only = TRUE
  )

  paste0(paste0(lines, collapse = "\n"))
}

Try the roxygen2 package in your browser

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

roxygen2 documentation built on Sept. 8, 2021, 9:08 a.m.