@@ -15,11 +15,14 @@ detect_codedoc_key_lines <- function(x) {
1515# ' @title Read codedoc-formatted Code Comments
1616# ' @description
1717# ' Extracts blocks of specifically formatted comments from text file.
18- # ' @param readLines_arg_list `[list]`
19- # ' (optional, default `list(warn = FALSE) `)
18+ # ' @param readLines_arg_list `[NULL, list]`
19+ # ' (optional, default `NULL `)
2020# '
2121# ' list of arguments passed to [readLines]; `con` is always set to
22- # ' an element of `text_file_paths`
22+ # ' an element of `text_file_paths`.
23+ # '
24+ # ' - `NULL`: Use `list(warn = FALSE, encoding = "UTF-8")`.
25+ # ' - `list`: use these arguments. E.g. `list(encoding = "my_weird_encoding")`
2326# ' @param string_interpolation_eval_env `[environment]`
2427# ' (optional, default `parent.frame(1L)`)
2528# '
@@ -125,8 +128,13 @@ extract_keyed_comment_blocks_assertions__ <- function(
125128
126129 dbc :: assert_is_environment(string_interpolation_eval_env , call = call ,
127130 assertion_type = assertion_type )
128- dbc :: assert_is_list(readLines_arg_list , call = call ,
129- assertion_type = assertion_type )
131+ dbc :: assert_is_one_of(
132+ readLines_arg_list ,
133+ funs = list (dbc :: report_is_NULL ,
134+ dbc :: report_is_list ),
135+ call = call ,
136+ assertion_type = assertion_type
137+ )
130138}
131139
132140# ' @template arg_assertion_type
@@ -138,7 +146,7 @@ extract_keyed_comment_blocks <- function(
138146 clean_comment_lines = NULL ,
139147 detect_allowed_keys = " " ,
140148 sort_by = NULL ,
141- readLines_arg_list = list ( warn = FALSE ) ,
149+ readLines_arg_list = NULL ,
142150 string_interpolation_eval_env = parent.frame(1L ),
143151 detect_allowed_keys_grepl_arg_list = NULL ,
144152 assertion_type = " input"
@@ -321,7 +329,7 @@ extract_keyed_comment_blocks__ <- function(
321329 clean_comment_lines = NULL ,
322330 detect_allowed_keys = " " ,
323331 sort_by = NULL ,
324- readLines_arg_list = list ( warn = FALSE ) ,
332+ readLines_arg_list = NULL ,
325333 string_interpolation_eval_env = parent.frame(1L ),
326334 insert = TRUE ,
327335 interpolate = TRUE ,
@@ -341,6 +349,13 @@ extract_keyed_comment_blocks__ <- function(
341349 assertion_type = assertion_type ,
342350 call = main_call
343351 )
352+ # @codedoc_comment_block news("codedoc::extract_keyed_comment_blocks", "2026-03-11", "0.11.0")
353+ # `codedoc::extract_keyed_comment_blocks` argument `readLines_arg_list` is now
354+ # by default `NULL` which implies `list(warn = FALSE, encoding = "UTF-8")`.
355+ # @codedoc_comment_block news("codedoc::extract_keyed_comment_blocks", "2026-03-11", "0.11.0")
356+ if (is.null(readLines_arg_list )) {
357+ readLines_arg_list <- list (warn = FALSE , encoding = " UTF-8" )
358+ }
344359
345360 if (is.null(text_file_paths )) {
346361 # @codedoc_comment_block codedoc:::extract_keyed_comment_blocks__
0 commit comments