Created
May 6, 2025 06:26
-
-
Save MichaelChirico/49f51edeecc288d7aabf6bc53cb1aa89 to your computer and use it in GitHub Desktop.
Demonstrate equivalence of h1/h2 and h2/h3 hierarchies for utils::news
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
news_fmt <- "%1$s My NEWS | |
%1$s# pkg 1.0.0 (2020-01-01) | |
%1$s## Categ 1 | |
%1$s# pkg 0.4.0 (2019-01-01) | |
%1$s## Categ 1 | |
%1$s## Categ 2" | |
writeLines(sprintf(news_fmt, ""), h1_tmp<-tempfile()) | |
writeLines(sprintf(news_fmt, "#"), h2_tmp<-tempfile()) | |
build_db_from_str <- function(s) { | |
tmp <- tempfile() | |
on.exit(unlink(tmp)) | |
writeLines(s, tmp) | |
tools:::.build_news_db_from_package_NEWS_md(tmp) | |
} | |
all.equal( | |
build_db_from_str(sprintf(news_fmt, "")), | |
build_db_from_str(sprintf(news_fmt, "#")) | |
) | |
# [1] TRUE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment