Skip to content

Commit

Permalink
Tweak search for first non-whitespace line
Browse files Browse the repository at this point in the history
  • Loading branch information
jennybc committed Jun 26, 2024
1 parent 89e09a6 commit 9426de1
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions R/news.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,10 @@ use_news_heading <- function(version) {
}

news <- read_utf8(news_path)
if (length(news) == 0) {
return(news)
}
idx <- match(TRUE, grepl("[^[:space:]]", news))

# find first non-blank line in news
for (idx in seq_along(news)) {
if (grepl("[^[:space:]]", news[[idx]])) {
break
}
if (is.na(idx)) {
return(news)
}

title <- glue("# {project_name()} {version}")
Expand Down

0 comments on commit 9426de1

Please sign in to comment.