Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
HenningLorenzen-ext-bayer authored Nov 16, 2023
2 parents 33842b5 + a5d9561 commit 6cdeda2
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ VignetteBuilder:
knitr
Config/Needs/website: tidyverse/tidytemplate
Config/testthat/edition: 3
Config/testthat/parallel: TRUE
Encoding: UTF-8
Language: en-GB
Roxygen: list(markdown = TRUE, load = "installed")
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* `URL` and `BugReports` fields in `DESCRIPTION` may now contain
percent-encoded URLs (@HenningLorenzen-ext-bayer, #1415).

* `@inherit` can now also inherit from `@format` (#1293).

* `@describeIn()` gives a more informative warning if you use it with an
unsupported type (#1490).

Expand Down
2 changes: 1 addition & 1 deletion R/collate.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ update_collate <- function(base_path) {

generate_collate <- function(base_path) {
paths <- sort_c(dir(base_path, pattern = "[.][Rr]$", full.names = TRUE))
includes <- lapply(paths, find_includes)
includes <- lapply(paths, function(x) intersect(find_includes(x), basename(paths)))
names(includes) <- paths

n <- sum(map_int(includes, length))
Expand Down
1 change: 1 addition & 0 deletions R/rd-inherit.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ topics_process_inherit <- function(topics, env) {
topics$topo_apply(inherits("author"), inherit_field, "author")
topics$topo_apply(inherits("source"), inherit_field, "source")
topics$topo_apply(inherits("note"), inherit_field, "note")
topics$topo_apply(inherits("note"), inherit_field, "format")

# First inherit individual sections, then all sections.
topics$topo_apply(function(x) x$inherits_section_from(), inherit_section)
Expand Down
3 changes: 2 additions & 1 deletion R/tag-parser.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ tag_value <- function(x) {
# Also recorded in tags.yml
inherit_components <- c(
"params", "return", "title", "description", "details", "seealso",
"sections", "references", "examples", "author", "source", "note"
"sections", "references", "examples", "author", "source", "note",
"format"
)

#' @export
Expand Down
3 changes: 2 additions & 1 deletion inst/roxygen2-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@
Otherwise, specify individual components to inherit by picking one or
more of `params`, `return`, `title`, `description`, `details`, `seealso`,
`sections`, `references`, `examples`, `author`, `source`, and `note`.
`sections`, `references`, `examples`, `author`, `source`, `note`,
and `format`.
template: ' ${1:source} ${2:components}'
vignette: reuse
recommend: true
Expand Down
10 changes: 3 additions & 7 deletions tests/testthat/test-rd-inherit.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,7 @@ test_that("no options gives default values", {
NULL
")[[1]]

expect_equal(
block_get_tag_value(block, "inherit")$fields,
c(
"params", "return", "title", "description", "details", "seealso",
"sections", "references", "examples", "author", "source", "note"
)
)
expect_equal(block_get_tag_value(block, "inherit")$fields, inherit_components)
})

test_that("some options overrides defaults", {
Expand Down Expand Up @@ -707,6 +701,7 @@ test_that("can inherit all from single function", {
#' @author Hadley
#' @source my mind
#' @note my note
#' @format my format
#' @examples
#' x <- 1
foo <- function(x, y) {}
Expand All @@ -722,6 +717,7 @@ test_that("can inherit all from single function", {
expect_equal(out$get_value("examples"), rd("x <- 1"))
expect_equal(out$get_value("author"), "Hadley")
expect_equal(out$get_value("source"), "my mind")
expect_equal(out$get_value("format"), "my format")
expect_equal(out$get_value("note"), "my note")
})

Expand Down

0 comments on commit 6cdeda2

Please sign in to comment.