Skip to content

Regenerate documents using roxygen2 7.0 - #3630

Closed
yutannihilation wants to merge 5 commits into
tidyverse:masterfrom
yutannihilation:refactor/regenerate-documents
Closed

yutannihilation wants to merge 5 commits into
tidyverse:masterfrom
yutannihilation:refactor/regenerate-documents

Conversation

@yutannihilation

@yutannihilation yutannihilation commented Nov 17, 2019 •

Copy link
Copy Markdown
Member

Use the latest version of roxygen2 to generate documents, and fix various places due to the change of roxygen2's behaviour.

Formatting of Usage sections

Most of the diff comes from the fact that roxygen2 now formats usages a bit prettier than before. For example:

-absoluteGrob(grob, width = NULL, height = NULL, xmin = NULL,
-  ymin = NULL, vp = NULL)
+absoluteGrob(
+  grob,
+  width = NULL,
+  height = NULL,
+  xmin = NULL,
+  ymin = NULL,
+  vp = NULL
+)

This diff is harmless and there's nothing we need to do.

Escape of %

Contrary to the previous version where we needed to escape % by ourselves, now roxygen2 escapes % automatically. As a result,

#' 100\%

is converted to

100\\%

Here, \\ is translated as an escaped \ and % is translated as an unescaped %, which means the Rd comment symbol. This is problematic when it's used in a line containing }. For example,

 \item{width}{Bar width. By default, set to 90\\% of the resolution of the data.}

is translated as \item{width}{Bar width. By default, set to 90\\ + comments.

So, we must remove this \ except when it's used in raw Rd macros (e.g. \code{}). For example,

#' \code{\%+\%}

should be left as is.

Unused @inheritParams

It seems roxygen2 now warns when @inheritParams is not used. I removed two @inheritParams. This doesn't change the result documents as they ware not used actually.

Misuse of @rdname

I think we misuse @rdname in some places where we should use @name. I don't understand why devtools::document() warns only for scale-step, but I guess this is what the following warning suggests:

Warning: [.../ggplot2/R/scale-steps.R:46] @rdname May only use one @rdname per block

Comment thread man/theme.Rd
Comment on lines -142 to +217
and x axis grid lines are vertical. \code{panel.grid.*.*} inherits from
\code{panel.grid.*} which inherits from \code{panel.grid}, which in turn inherits
and x axis grid lines are vertical. \verb{panel.grid.*.*} inherits from
\verb{panel.grid.*} which inherits from \code{panel.grid}, which in turn inherits

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is a problem or not, but I reported here: r-lib/roxygen2#975

Comment thread man/annotate.Rd
parse = TRUE)
p + annotate("text", x = 4, y = 25,
label = "paste(italic(R) ^ 2, \\" = .75\\")", parse = TRUE)
label = "paste(italic(R) ^ 2, \" = .75\")", parse = TRUE)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, is this correct...?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this escape doesn't make difference on the rendered document.

@yutannihilation

Copy link
Copy Markdown
Member Author

OK, this is not a easy job by just running devtools::document()...

Warnings when devtools::document()

==> devtools::document(roclets = c('rd', 'collate', 'namespace'))

Updating ggplot2 documentation
Writing NAMESPACE
Loading ggplot2
Warning: [/home/yutani/repo/ggplot2/R/scale-steps.R:46] @rdname May only use one @rdname per block
Writing NAMESPACE
Warning messages:
1: Topic 'layer': no parameters to inherit with @inheritParams 
2: Topic 'position_dodge': no parameters to inherit with @inheritParams
* Topic 'position_dodge2': no parameters to inherit with @inheritParams 
Documentation completed

Warnings on check

* checking Rd files ... WARNING
prepare_Rd: man/geom_bar.Rd:78: unknown macro '\item'
prepare_Rd: man/geom_bar.Rd:82: unknown macro '\item'
prepare_Rd: man/geom_bar.Rd:85: unknown macro '\item'
prepare_Rd: man/geom_bar.Rd:90: unknown macro '\item'
prepare_Rd: man/geom_bar.Rd:96: unknown macro '\item'
prepare_Rd: man/geom_bar.Rd:101: unknown macro '\item'
prepare_Rd: man/geom_bar.Rd:104: unexpected section header '\description'
prepare_Rd: man/geom_bar.Rd:114: unexpected section header '\details'
prepare_Rd: man/geom_bar.Rd:125: unexpected section header '\section'
prepare_Rd: man/geom_bar.Rd:130: unexpected section header '\section'
prepare_Rd: man/geom_bar.Rd:171: unexpected section header '\section'
prepare_Rd: man/geom_bar.Rd:179: unexpected section header '\examples'
prepare_Rd: man/geom_bar.Rd:217: unexpected section header '\seealso'
prepare_Rd: man/geom_bar.Rd:228: unexpected END_OF_INPUT '
'
checkRd: (5) geom_bar.Rd:0-229: Must have a \description
prepare_Rd: man/geom_boxplot.Rd:191: unknown macro '\item'
prepare_Rd: man/geom_boxplot.Rd:192: unknown macro '\item'
prepare_Rd: man/geom_boxplot.Rd:193: unknown macro '\item'
prepare_Rd: man/geom_boxplot.Rd:194: unknown macro '\item'
prepare_Rd: man/geom_boxplot.Rd:195: unknown macro '\item'
prepare_Rd: man/geom_boxplot.Rd:199: unexpected section header '\examples'
prepare_Rd: man/geom_boxplot.Rd:246: unexpected section header '\references'
prepare_Rd: man/geom_boxplot.Rd:250: unexpected section header '\seealso'
prepare_Rd: man/geom_boxplot.Rd:255: unexpected END_OF_INPUT '
'
checkRd: (7) geom_boxplot.Rd:227-244: Tag \donttest not recognized
* checking Rd \usage sections ... WARNING
Undocumented arguments in documentation object 'geom_bar'
  ‘stat’ ‘binwidth’ ‘na.rm’ ‘orientation’ ‘show.legend’ ‘inherit.aes’
  ‘geom’

@yutannihilation yutannihilation changed the title Regenerate documents using roxygen2 7.0 WIP: Regenerate documents using roxygen2 7.0 Nov 17, 2019
@yutannihilation yutannihilation changed the title WIP: Regenerate documents using roxygen2 7.0 Regenerate documents using roxygen2 7.0 Nov 17, 2019
@yutannihilation

Copy link
Copy Markdown
Member Author

This is ready to merge now, if we are ready to use roxygen2 (apparently I was not...)

@yutannihilation

Copy link
Copy Markdown
Member Author

Closing this in favor of #3637

@yutannihilation
yutannihilation deleted the refactor/regenerate-documents branch November 23, 2019 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant