Skip to content

Commit 29dd6ef

Browse files
handl multiple idnetical comments right
1 parent 6c89bf4 commit 29dd6ef

File tree

4 files changed

+79
-10
lines changed

4 files changed

+79
-10
lines changed

R/roxygen-examples.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ style_roxygen_code_example_one <- function(example_one, transformers, base_inden
4040
for (idx in seq_along(ordinary_comment)) {
4141
to_replace <- which(ordinary_comment[idx] == without_mask)[1]
4242
styled[to_replace] <- ordinary_comment[idx]
43+
without_mask[to_replace] <- NA
4344
}
4445
styled
4546
}

tests/testthat/roxygen-examples-complete/25-ordinary-comment-in-example-in.R

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,26 @@ NULL
108108
# nolint end
109109
#' df %>% func()
110110
func <- function() NULL
111+
112+
113+
#' Hi
114+
# Comment
115+
#' @examples
116+
#' 1 + 1
117+
# this
118+
# this
119+
#this
120+
# thi3
121+
#' c()
122+
NULL
123+
124+
#' Hi
125+
# Comment
126+
#' @examples
127+
#' 1 + 1
128+
# this
129+
# this
130+
#this
131+
# thi3
132+
#' c()
133+
NULL

tests/testthat/roxygen-examples-complete/25-ordinary-comment-in-example-in_tree

Lines changed: 32 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/roxygen-examples-complete/25-ordinary-comment-in-example-out.R

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,26 @@ NULL
109109
# nolint end
110110
#' df %>% func()
111111
func <- function() NULL
112+
113+
114+
#' Hi
115+
# Comment
116+
#' @examples
117+
#' 1 + 1
118+
# this
119+
# this
120+
# this
121+
# thi3
122+
#' c()
123+
NULL
124+
125+
#' Hi
126+
# Comment
127+
#' @examples
128+
#' 1 + 1
129+
# this
130+
# this
131+
# this
132+
# thi3
133+
#' c()
134+
NULL

0 commit comments

Comments
 (0)