-
Notifications
You must be signed in to change notification settings - Fork 234
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
Duplicated documentation in R6 #1504
Comments
note: this can be fixed by using
but that should only be a temporary solution. |
Would you mind being a bit more explicit about what the problem is? |
@hadley I recommend looking at the diff in the R and Rd in the PR I opened rstudio/chromote#123 Basically, we need to specify each tag explicitly as implicit The typical roxygen2 pattern used for regular functions doesn't work for R6 classes. Basically, the diff in Rd files in the PR should not require adding the tags in the R file. |
just to make sure the problem is clear:
|
@cbielow yes, that's the output. But what's the input that causes it? |
Here is a reprex for the duplication issue. library(roxygen2)
# First example: duplicate inherited description
# faulty behavior
roc_proc_text(rd_roclet(), "
#' Title
#' @export
foo <- R6::R6Class()
")
#> $foo.Rd
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{foo}
#> \alias{foo}
#> \title{Title}
#> \description{
#> Title
#>
#> Title
#> }
# Expected behavior
roc_proc_text(rd_roclet(), "
#' Title
#'
#' @description
#' Title
#' @export
foo <- R6::R6Class()
")
#> $foo.Rd
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{foo}
#> \alias{foo}
#> \title{Title}
#> \description{
#> Title
#> } Created on 2023-11-02 with reprex v2.0.2 Irrelevant output```r #> \section{Methods}{ #> \subsection{Public methods}{ #> \itemize{ #> \item \href{#method-unknown-clone}{\code{foo$clone()}} #> } #> } #> \if{html}{\out{}} #> \if{html}{\out{}} #> \if{latex}{\out{\hypertarget{method-unknown-clone}{}}} #> \subsection{Method \code{clone()}}{ #> The objects of this class are cloneable with this method. #> \subsection{Usage}{ #> \if{html}{\out{ }}\preformatted{foo$clone(deep = FALSE)}\if{html}{\out{ }}
#> }
#>
#> \subsection{Arguments}{
#> \if{html}{\out{}}
#> \describe{
#> \item{\code{deep}}{Whether to make a deep clone.}
#> }
#> \if{html}{\out{ }}
#> }
#> }
#> }
```
Can't replicate for the other issue I get an errorcan't replicate the other one with a reprex. ```r roc_proc_text(rd_roclet(), " #' Title #' #' My description #' #' Details #' @export foo <- R6::R6Class('foo', public = list( #' @description A description fn = function() 1L )) ") ``` Error in `map_int()`: ℹ In index: 1. ℹ With name: is_local. Caused by error: ! R6 class lacks source references. ℹ If you are using the `installed` load method in `DESCRIPTION`, then try re-installing the package with option '--with-keep.source', e.g. `install.packages(..., INSTALL_OPTS = "--with-keep.source")`. |
I've edited the original description, but the repex from olivroy is probably faster to reproduce |
Thank you! |
when documenting (via
roxygenize()
or Ctrl-Shift-d in R studio) any R6 class in my package usingroxygen2_7.2.3
, e.g. the one from the example here (https://www.tidyverse.org/blog/2019/11/roxygen2-7-0-0/#r6-documentation)i.e. input file
results in
Person.rd
(note the duplicated text in \description)The text was updated successfully, but these errors were encountered: