Skip to content

Commit

Permalink
Merge pull request #351 from pharmaR/ni-349-news-master
Browse files Browse the repository at this point in the history
change regex and else loop to handle news files with no extension
  • Loading branch information
emilliman5 authored Sep 17, 2024
2 parents b469cb7 + 73e2ba1 commit 40365ce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/pkg_ref_cache_news.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ 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)
if (!length(files)) return(list())

content <- rep(list(NULL), length(files))
Expand All @@ -62,7 +62,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 40365ce

Please sign in to comment.