Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update repr_help_files_with_topic.r #111

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 6 additions & 3 deletions R/repr_help_files_with_topic.r
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@
#' @name repr_*.help_files_with_topic
NULL

fetch_rd_db <- getFromNamespace('fetchRdDB', 'tools')

# copy of utils:::.getHelpFile, necessary because CRAN doesn’t like us using :::
get_help_file <- function(file) {
path <- dirname(file)
dirpath <- dirname(path)
if (!file.exists(dirpath))
stop(sprintf('invalid %s argument', sQuote('file')))
stop(gettextf('invalid %s argument', sQuote('file')), domain = NA)
pkgname <- basename(dirpath)
rd_db <- file.path(path, pkgname)
if (!file.exists(paste(rd_db, 'rdx', sep = '.')))
stop(sprintf('package %s exists but was not installed under R >= 2.10.0 so help cannot be accessed', sQuote(pkgname)))
stop(gettextf('package %s exists but was not installed under R >= 2.10.0 so help cannot be accessed', sQuote(pkgname)), domain = NA)
pos <- -1
fetch_rd_db <- getFromNamespace('fetchRdDB', 'tools', pos)
fetch_rd_db(rd_db, basename(file))
}



#' @importFrom utils capture.output
#' @importFrom tools Rd2HTML
repr_help_files_with_topic_generic <- function(obj, Rd2_) {
Expand Down