1) For the \Sexpr blocks, we now say rd rather than Rd. pkgdown failed with Rd. This is the right way to specify the results section even though Rd works since whatever parses it does not seem to be case sensitive (maybe pkgdown should be more forgiving here and not be case sensitive either?).
2) When viewing development help interactively, pkgload:::shim_help() is being used. When this hits a method it cannot find documentation for, it errors. utils::help() returns a custom character object along with a message. We now use a tryCatch() when shim_help() is used, and return character() if no help is found. This was specifically added for the case of default methods that we export but dont document like:
library(generics)
library(pkgload)
# not an error!
help("as.factor.default", "generics")
#> No documentation for 'as.factor.default' in specified packages and libraries:
#> you could try '??as.factor.default'
str(help("as.factor.default", "generics"))
#> 'help_files_with_topic' chr(0)
#> - attr(*, "call")= language help(topic = "as.factor.default", package = "generics")
#> - attr(*, "topic")= chr "as.factor.default"
#> - attr(*, "tried_all_packages")= logi FALSE
#> - attr(*, "type")= chr "text"
# (inside generics R Project)
# load dev generics, sorry about hard path
pkgload::load_all("~/Desktop/r/packages/generics")
#> Loading generics
# now using dev help
help("as.factor.default", "generics")
#> Error: Could not find development topic 'as.factor.default'
# and that called:
pkgload:::shim_help("as.factor.default", "generics")
#> Error: Could not find development topic 'as.factor.default'
I don't think this is an error on pkgload's part. It's fine to throw an error. But for generics, we pass every method that attr(utils::methods("as.factor"), "info") can find through help() to find the path to any help docs. This is also our way of actually determining if help docs even exist. So we don't want it to error if they don't exist, we just want to handle appropriately and not include in the dynamic Rd.
Two fixes for
pkgdown
to work.1) For the
\Sexpr
blocks, we now sayrd
rather thanRd
.pkgdown
failed withRd
. This is the right way to specify theresults
section even thoughRd
works since whatever parses it does not seem to be case sensitive (maybepkgdown
should be more forgiving here and not be case sensitive either?).2) When viewing development help interactively,
pkgload:::shim_help()
is being used. When this hits a method it cannot find documentation for, it errors.utils::help()
returns a custom character object along with a message. We now use atryCatch()
whenshim_help()
is used, and returncharacter()
if no help is found. This was specifically added for the case of default methods that we export but dont document like:I don't think this is an error on
pkgload
's part. It's fine to throw an error. But forgenerics
, we pass every method thatattr(utils::methods("as.factor"), "info")
can find throughhelp()
to find the path to any help docs. This is also our way of actually determining if help docs even exist. So we don't want it to error if they don't exist, we just want to handle appropriately and not include in the dynamic Rd.