@@ -27,9 +27,7 @@ tag_value <- function(x, multiline = FALSE) {
2727 return (NULL )
2828 }
2929
30- if (! multiline && warn_if_multiline(x , x $ val )) {
31- return (NULL )
32- }
30+ warn_if_multiline(x , x $ val , multiline )
3331
3432 if (! rdComplete(x $ raw , is_code = FALSE )) {
3533 warn_roxy_tag(x , " has mismatched braces or quotes" )
@@ -134,12 +132,11 @@ tag_two_part <- function(
134132 warn_roxy_tag(x , " requires two parts: {first} and {second}" )
135133 }
136134 NULL
137- } else if (! multiline && warn_if_multiline(x , trimws(x $ raw ))) {
138- NULL
139135 } else if (! rdComplete(x $ raw , is_code = FALSE )) {
140136 warn_roxy_tag(x , " has mismatched braces or quotes" )
141137 NULL
142138 } else {
139+ warn_if_multiline(x , trimws(x $ raw ), multiline )
143140 pieces <- split_two_part(trimws(x $ raw ))
144141
145142 if (required && pieces [[2 ]] == " " ) {
@@ -192,9 +189,7 @@ tag_name_description <- function(x) {
192189tag_words <- function (x , min = 0 , max = Inf , multiline = FALSE ) {
193190 val <- trimws(x $ raw )
194191
195- if (! multiline && warn_if_multiline(x , val )) {
196- return (NULL )
197- }
192+ warn_if_multiline(x , val , multiline )
198193
199194 if (! rdComplete(x $ raw , is_code = FALSE )) {
200195 warn_roxy_tag(x , " has mismatched braces or quotes" )
@@ -221,8 +216,11 @@ tag_words_line <- function(x) {
221216 tag_words(x )
222217}
223218
224- # Returns TRUE (and warns) if val contains multiple lines, FALSE otherwise.
225- warn_if_multiline <- function (x , val ) {
219+ # Warns if multiline is FALSE and val contains multiple lines.
220+ warn_if_multiline <- function (x , val , multiline ) {
221+ if (multiline ) {
222+ return (invisible ())
223+ }
226224 n_lines <- re_count(val , " \n " )
227225 if (n_lines > = 1 ) {
228226 first_line <- re_split_half(val , " \n " )[[1 ]]
@@ -233,10 +231,8 @@ warn_if_multiline <- function(x, val) {
233231 i = " The first line is {.str {first_line}}"
234232 )
235233 )
236- TRUE
237- } else {
238- FALSE
239234 }
235+ invisible ()
240236}
241237
242238# ' @export
0 commit comments