Skip to content

Regenerate documents using roxygen2 7.0 #3630

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

Conversation

yutannihilation
Copy link
Member

@yutannihilation yutannihilation commented Nov 17, 2019

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 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
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

@@ -51,5 +61,5 @@ p + annotate("text", x = 2:3, y = 20:21, label = c("my label", "label 2"))
p + annotate("text", x = 4, y = 25, label = "italic(R) ^ 2 == 0.75",
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
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
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
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
Member Author

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

@yutannihilation
Copy link
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