Skip to content

Commit

Permalink
change regex and else loop to handle news files with no extension
Browse files Browse the repository at this point in the history
  • Loading branch information
narayanan-iyer-pfizer committed Aug 13, 2024
1 parent b469cb7 commit 7a3cf1d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/pkg_ref_cache_news.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ pkg_ref_cache.news.pkg_source <- function(x, name, ...) {
#' @keywords internal
news_from_dir <- function(path) {
# accommodate news.Rd, news.md, etc
files <- list.files(path, pattern = "^NEWS\\.", full.names = TRUE)
files <- list.files(path, pattern = "^NEWS($|\\.)", full.names = TRUE)
browser()
if (!length(files)) return(list())

content <- rep(list(NULL), length(files))
Expand All @@ -62,7 +63,7 @@ news_from_dir <- function(path) {
tryCatch({
if (tolower(tools::file_ext(f)) == "rd") {
content[[i]] <- .tools()$.news_reader_default(f)
} else if (tolower(tools::file_ext(f)) == "md") {
} else if (tolower(tools::file_ext(f)) == "md"||nchar(ext) == 0L) {
# NOTE: should we do validation of markdown format?
content[[i]] <- readLines(f, warn = FALSE)
}
Expand Down

0 comments on commit 7a3cf1d

Please sign in to comment.