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

show_news(): Support NEWS in Rd and md formats and under inst #2551

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

arcresu
Copy link

@arcresu arcresu commented Jan 9, 2024

Fixes #2499.

Exactly mirrors the search path documented in utils::news() for NEWS files rather than using the regex approach proposed in the issue.

The existing code could only handle plain NEWS files. In order to support the alternative formats, I had to mirror what utils::news was doing via internal tools machinery in tools:::.build_news_db().

I added some tests partly to convince myself it was working. Perhaps you don't want to take all of these though since it's effectively exercising the internal functions in tools more than devtools per se.

Mirrors the search path documented in utils::news() for NEWS files. Uses
the internal machinery of tools to build news databases.
@arcresu
Copy link
Author

arcresu commented Jan 10, 2024

I discovered that the NEWS-parsing machinery in tools skips entries were the version string is malformed according to .standard_regexps()$valid_package_version. In particular, the de facto standard first entry of packagename (development version) is skipped because "(development version)" doesn't match that regex. This is unfortunate, since it's probably exactly the entry you'd want to look at.

If there are no valid entries, the news_db builder functions return NULL instead of a news database, and forwarding that on to utils::news(db = NULL) causes it to display the NEWS for R itself rather than the package. This was the cause of the earlier CI failures in this PR.

In combination, it means that in a new package with a NEWS.md generated by usethis::use_news_md(), if you call devtools::show_news(), you will see an error Unable to parse NEWS, since there are no entries with valid version strings. All in all, this PR still improves the state of affairs by supporting all formats and locations of NEWS that R supports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

show_news() only checks {pkg}/NEWS
1 participant