Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change regex and else loop to handle news files with no extension #351

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading