r-lib / pkgdown

Generate static html documentation for an R package
https://pkgdown.r-lib.org/
Other
721 stars 336 forks source link

Remove code needed for old R versions #2759

Closed lgibson7 closed 3 months ago

lgibson7 commented 3 months ago

Closes #2706 .

hadley commented 3 months ago

PRs that delete code are my favourite type of PRs 😄 Thank you!

lgibson7 commented 3 months ago

No worries. Thanks Hadley.

bastistician commented 2 months ago

Came here after checking what has changed in the new release. The code removal in rd_file() looks dangerous:

 rd_file <- function(path, pkg_path = NULL) {
-  if (getRversion() >= "3.4.0") {
-    macros <- tools::loadPkgRdMacros(pkg_path)
-    set_classes(tools::parse_Rd(path, macros = macros, encoding = "UTF-8"))
-  } else if (getRversion() >= "3.2.0") {
-    macros <- tools::loadPkgRdMacros(pkg_path, TRUE)
-    set_classes(tools::parse_Rd(path, macros = macros, encoding = "UTF-8"))
-  } else {
-    set_classes(tools::parse_Rd(path, encoding = "UTF-8"))
-  }
+  set_classes(tools::parse_Rd(path, encoding = "UTF-8"))
 }

This means that the package's own Rd macros are no longer loaded. So I just tried and indeed, rebuilding a site for such a package now gives plenty of "unknown macro" warnings ...