R/rd-wrap.r

#' @autoImports
rd_wrap <- function(x, indent = 2, exdent = indent) {
  return(str_c(x, collapse = "\n\n"))

  lines <- str_split(x, "\n")[[1]]
  if (all(str_length(lines) < 60)) width <- Inf

  wrapped <- str_wrap(x, width = 60, indent = indent, exdent = exdent)
  str_c(wrapped, collapse = "\n\n")
}
code_wrap <- function(x, indent = 2, exdent = 4) {
  wrapped <- str_wrap(x, width = 60, indent = indent, exdent = exdent)
  wrapped <- str_replace_all(wrapped, fixed("\u{A0}"), " ")
  str_c(wrapped, collapse = "\n\n")
}
hadley/roxygen3 documentation built on May 17, 2019, 12:16 p.m.