Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions r/R/dplyr-funcs-doc.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@
#'
#' * [`!`][!()]
#' * [`!=`][!=()]
#' * [`%%`][%%()]
#' * [`%/%`][%/%()]
#' * [`%in%`][%in%()]
#' * [`%%`][base::Arithmetic()]
#' * [`%/%`][base::Arithmetic()]
#' * [`%in%`][base::match()]
#' * [`&`][&()]
#' * [`*`][*()]
#' * [`+`][+()]
Expand Down
15 changes: 14 additions & 1 deletion r/data-raw/docgen.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,25 @@ library(purrr)
# Functions that for whatever reason cause xref problems, so don't hyperlink
do_not_link <- c()

# Operators documented on a different help page than their name
operator_help_pages <- c(
"%%" = "base::Arithmetic",
"%/%" = "base::Arithmetic",
"%in%" = "base::match"
)

package_notes <- list(
stringr = "Pattern modifiers `coll()` and `boundary()` are not supported in any functions."
)

# Vectorized function to make entries for each function
render_fun <- function(fun, pkg_fun, notes) {
# Use special help pages for certain operators
link_target <- ifelse(
fun %in% names(operator_help_pages),
paste0(operator_help_pages[fun], "()"),
paste0(pkg_fun, "()")
)
# Add () to fun if it's not an operator
not_operators <- grepl("^[[:alpha:]]", fun)
fun[not_operators] <- paste0(fun[not_operators], "()")
Expand All @@ -104,7 +117,7 @@ render_fun <- function(fun, pkg_fun, notes) {
out <- ifelse(
pkg_fun %in% do_not_link,
fun,
paste0("[", fun, "][", pkg_fun, "()]")
paste0("[", fun, "][", link_target, "]")
)
# Add notes after :, if exist
has_notes <- nzchar(notes)
Expand Down