Closed MichaelChirico closed 1 month ago
Another hack at the edifice of #61: trying to migrate to roxygen2-style links first.
This PR only look for cases using style \code{\link{FUN}} on master that are winding up as \code{\link[=FUN]{FUN()}} in {roxygen2} style.
\code{\link{FUN}}
master
\code{\link[=FUN]{FUN()}}
Repro code:
# Find objects linked like `\link[=FUN]{FUN()}` on roxygen branch rd = Sys.glob("man/*.Rd") simple_call_links = sort(unique(unlist(lapply(rd, function(f) { l = readLines(f) re = R"([\\]link\[=(.*)\]\{\1\(\)\})" l = grep(re, l, value=TRUE, perl=TRUE) idx = gregexpr(re, l, perl=TRUE) mapply( \(line, start, len) substr(line, start, start+len-1), l, lapply(idx, attr, "capture.start"), lapply(idx, attr, "capture.length"), USE.NAMES=FALSE ) })))) simple_call_links = setdiff(simple_call_links, "integer64") # ambiguity of the data type vs. the function # change to patch branch system('git checkout roxy-links') re = sprintf(R"([\]code\{[\]link\{(%s)\}\})", paste(gsub(".", "[.]", simple_call_links, fixed = TRUE), collapse="|")) for (f in rd) { l = readLines(f) l = gsub(re, R"(\code{\link[=\1]{\1()}})", l) writeLines(l, f) }
Another hack at the edifice of #61: trying to migrate to roxygen2-style links first.
This PR only look for cases using style
\code{\link{FUN}}
onmaster
that are winding up as\code{\link[=FUN]{FUN()}}
in {roxygen2} style.Repro code: