| Title: | Creation of NEWS.md File |
|---|---|
| Description: | Adding updates (version or bullet points) to the NEWS.md file. |
| Authors: | Jakob Gepp [cre, aut] |
| Maintainer: | Jakob Gepp <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.5.1 |
| Built: | 2026-05-10 09:43:25 UTC |
| Source: | https://github.com/dschaykib/newsmd |
Combining dev-versions into the next version
combine_dev(text = "")combine_dev(text = "")
text |
a string vector with the content of the get_text method |
a string vector with the reduced NEWS.md text
This function tries to extract the version number within a file. There are a few pitfalls:
* If the word "version" is within the text but denotes a dependency it is still detected. * If the files has a date before the version it will return the date instead of the version * It is assumed, that the NEWS.md files is updated from the top. Ergo the latest version is the first one.
get_version(file, latest = TRUE)get_version(file, latest = TRUE)
file |
a path to a file |
latest |
a Boolean, if TRUE (default) only the latest version is returned |
either a single string or a vector with version numbers
Manipulate the NEWS.md file.
An R6 class.
new()
Create a new news object.
news$new(
text = c(paste0("## version ", version), "", "---", "", "### NEWS.md setup", "",
"- added NEWS.md creation with [newsmd](https://github.com/Dschaykib/newsmd)", ""),
version = "0.0.0.9000",
file = NULL
)textvector with context for the news.md file.
versioncurrent version of the package.
filea text file with the current news.md file. Use NULL to create new file.
A new 'news' object.
print()
Print a news object.
news$print()
get_text()
Get the news object as a text.
news$get_text()
The context of the news file.
write()
Write and save a news object.
news$write(file = "NEWS.md", reduce_dev = FALSE)
fileA path and file to where the news file is saved.
reduce_devA boolean, if TRUE dev version's points are combined into the next version
add_version()
Adds a version line to a news object.
news$add_version(x)
xA string with the version number.
add_subtitle()
Adds a subtitle line to a news object.
news$add_subtitle(x)
xA string with the subtitle.
add_bullet()
Adds a bullet points to the last subtitle.
news$add_bullet(x)
xA vector with the bullet points.
clone()
The objects of this class are cloneable with this method.
news$clone(deep = FALSE)
deepWhether to make a deep clone.
## Create a template my_news <- news$new() my_news$add_subtitle("improved things 1") my_news$add_bullet("point 1") my_news$add_bullet("point 2")## Create a template my_news <- news$new() my_news$add_subtitle("improved things 1") my_news$add_bullet("point 1") my_news$add_bullet("point 2")
This is a convenience wrapper for news$new(). If you already have a
NEWS file you can add it's path to newsmd().
newsmd( file = NULL, text = c(paste0("## version ", version), "", "---", "", "### NEWS.md setup", "", "- added NEWS.md creation with [newsmd](https://github.com/Dschaykib/newsmd)", ""), version = "0.0.0.9000" )newsmd( file = NULL, text = c(paste0("## version ", version), "", "---", "", "### NEWS.md setup", "", "- added NEWS.md creation with [newsmd](https://github.com/Dschaykib/newsmd)", ""), version = "0.0.0.9000" )
file |
name of the |
text |
a character scalar containing the initial text. |
version |
a character with the version in the format
|
This functions creates a news object, which can be saved as the
NEWS.md file with the internal method write(). One can add versions,
subtitles and bullet points to the news.
If an existing NEWS.md file is given, the version is extracted with
get_version and the dev part is bumped up.
newsmd()newsmd()