4  platenize()

Diagram

Code
platenize <- function(my_fn_txt, out_name, roclets = "memo", hide = NULL) {
  if (roclets == "memo") {
    tmp2 <- my_fn_txt %>% paste(collapse = "\n") %>% paste0("\n", .)
    zz1 <- my_fn_txt %>%
      stringr::str_sub(end = 2L) %>%
      stringr::str_equal("#'") %>%
      which()
    if (length(zz1) == 0) {
      tmp3 <- 1
    } else if (length(zz1) > 0) {
      tmp3 <- max(zz1) + 1
    }
    tmp4 <- my_fn_txt[tmp3:length(my_fn_txt)]
    tmp5 <- tmp4[1] %>% stringr::str_remove_all(" ")
    results <- c(
      roxygen2::roc_proc_text(platen_roclet(), tmp2),
      list(
        "fn_body" = tmp4,
        "fn_name" = stringr::str_sub(tmp5, end = stringr::str_locate(tmp5, "<-")[,"start"] - 1),
        "book_dir" = here::here(out_name),
        "hide" = hide
      )
    )
    roxygen2::roclet_output(platen_roclet(), results)
    return(results)
  } else {
    stop("Only the memo roclet is currently available")
  }
}