@@ -123,7 +123,7 @@ pkg_doc_obj <- function(
123123 # '
124124 # ' Additional arguments to pass to `grepl` when detecting which comment
125125 # ' blocks to include based on `key`.
126- # ' Arguments `pattern`, `x`, and `perl = TRUE ` cannot be changed.
126+ # ' Arguments `pattern` and `x ` cannot be changed.
127127 # '
128128 # ' - `NULL`: No additional arguments.
129129 # ' - `list`: Pass these.
@@ -132,15 +132,38 @@ pkg_doc_obj <- function(
132132 funs = list (dbc :: report_is_NULL ,
133133 dbc :: report_is_list )
134134 )
135+ # @codedoc_comment_block news("codedoc::pkg_doc_obj", "2025-07-03", "0.10.3")
136+ # `codedoc::pkg_doc_obj` argument `grepl_arg_list` handling improved:
137+ # - By default `perl = TRUE` but user can override this.
138+ # - If user supplies `fixed = TRUE`, we always set `perl = FALSE`.
139+ # @codedoc_comment_block news("codedoc::pkg_doc_obj", "2025-07-03", "0.10.3")
140+ # @codedoc_comment_block codedoc::pkg_doc_obj
141+ # Document an object in an R package.
142+ #
143+ # Performs the following steps.
144+ # - Set `grepl_arg_list$perl <- TRUE` and `grepl_arg_list$fixed <- FALSE`
145+ # by default but the user can override these.
146+ # - If user supplies `grepl_arg_list$fixed = TRUE` via we always set
147+ # `grepl_arg_list$perl <- FALSE`.
148+ # @codedoc_comment_block codedoc::pkg_doc_obj
135149 grepl_arg_list <- as.list(grepl_arg_list )
150+ if (! " perl" %in% names(grepl_arg_list )) {
151+ grepl_arg_list [[" perl" ]] <- TRUE
152+ }
153+ if (! " fixed" %in% names(grepl_arg_list )) {
154+ grepl_arg_list [[" fixed" ]] <- FALSE
155+ }
156+ if (grepl_arg_list [[" fixed" ]] == TRUE ) {
157+ grepl_arg_list [[" perl" ]] <- FALSE
158+ }
136159
137160 # @codedoc_comment_block news("codedoc::pkg_doc_obj", "2025-07-02", "0.10.1")
138161 # Expand `codedoc::pkg_doc_obj` allowed `regex` patterns.
139- # Now `regex` can be any string that `grepl(perl = TRUE) ` can handle.
162+ # Now `regex` can be any string that `grepl` can handle.
140163 # @codedoc_comment_block news("codedoc::pkg_doc_obj", "2025-07-02", "0.10.1")
141164 # ' @param regex `[character]` (no default)
142165 # '
143- # ' Any regular expression accepted by `grepl(perl = TRUE) `.
166+ # ' Any regular expression accepted by `grepl`.
144167 # ' E.g. `"mypkg::myfun"`, where you write
145168 # ' `codedoc` comment blocks with `mypkg::myfun` as/in the keys.
146169 # ' This is used to detect which `codedoc` comment blocks to use in
@@ -152,9 +175,9 @@ pkg_doc_obj <- function(
152175 # ' use `roxygen` blocks normally unless there is a special reason to do
153176 # ' otherwise.
154177 dbc :: assert_is_character_nonNA_atom(regex )
178+
155179 grepl_arg_list [[" pattern" ]] <- regex
156180 grepl_arg_list [[" x" ]] <- " test"
157- grepl_arg_list [[" perl" ]] <- TRUE
158181 regex_test <- suppressWarnings(tryCatch(
159182 do.call(grepl , grepl_arg_list ), error = function (e ) e
160183 ))
@@ -196,9 +219,6 @@ pkg_doc_obj <- function(
196219 }
197220
198221 # @codedoc_comment_block codedoc::pkg_doc_obj
199- # Document an object in an R package.
200- #
201- # Performs the following steps.
202222 # - Calls `[codedoc::extract_keyed_comment_blocks]`.
203223 # @codedoc_comment_block codedoc::pkg_doc_obj
204224 # ' @param text_file_paths `[NULL, character]` (default `NULL`)
@@ -249,7 +269,8 @@ pkg_doc_obj <- function(
249269 # @codedoc_comment_block codedoc::pkg_doc_obj
250270 lines_by_section [[" news" ]] <- codedoc :: codedoc_roxygen_news_by_version(
251271 regex ,
252- text_file_paths
272+ text_file_paths ,
273+ extract_arg_list = list (detect_allowed_keys_grepl_arg_list = grepl_arg_list )
253274 )
254275
255276 # @codedoc_comment_block codedoc::pkg_doc_obj
0 commit comments