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

Inheriting from other packages can create broken links #635

Closed
karawoo opened this issue Jun 19, 2017 · 2 comments
Closed

Inheriting from other packages can create broken links #635

karawoo opened this issue Jun 19, 2017 · 2 comments

Comments

@karawoo
Copy link

@karawoo karawoo commented Jun 19, 2017

When using @inheritDotParams to inherit documentation from another package, any links in the documentation to other functions in that package will broken. A reprex:

library("roxygen2")
roc_proc_text(rd_roclet(), "
  #' Title
  #'
  #' @inheritDotParams maps::map database
  wrapper <- function(...) maps::map(...)"
  )
#> $wrapper.Rd
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in RtmpentfmJ/file11179684a1b94
#> \name{wrapper}
#> \alias{wrapper}
#> \title{Title}
#> \usage{
#> wrapper(...)
#> }
#> \arguments{
#>   \item{...}{Arguments passed on to \code{maps::map}
#>   \describe{ \item{database}{ character string
#>   naming a geographical database, a list of \code{x},
#>   \code{y}, and \code{names} obtained from a previous
#>   call to \code{map} or a spatial object of class
#>   \code{SpatialPolygons} or \code{SpatialLines}.
#>   The string choices include a \code{\link{world}}
#>   map, three USA databases (\code{\link{usa}},
#>   \code{\link{state}}, \code{\link{county}}), and more (type
#>   \code{help(package='maps')} to see the package index).
#>   If the requied database is in a different package that
#>   has not been attached, the string may be started with
#>   "packagename::". The location of the map databases may be
#>   overridden by setting the \code{R_MAP_DATA_DIR} environment
#>   variable. } }}
#> }
#> \description{
#> Title
#> }

Things like \link{world} should be \link[maps:world]{world} to pass R CMD check.

@hadley hadley changed the title Inheriting dot params from other packages can create broken links Inheriting from other packages can create broken links Aug 17, 2017
@hadley
Copy link
Member

@hadley hadley commented Aug 17, 2017

Fixing this will require walking the Rd tree, looking for link objects. IIRC link works different based on the number of arguments, so the fix would just be to insert the source package name as the first element if length 1.

@hadley
Copy link
Member

@hadley hadley commented Aug 13, 2019

This would need to happen in topic_params.Rd().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants