diff --git a/R/fledgling.R b/R/fledgling.R index 595453fe..2ead7726 100644 --- a/R/fledgling.R +++ b/R/fledgling.R @@ -96,7 +96,6 @@ read_news <- function(news_lines = NULL) { end = ends, h2 = grepl("##", news_lines[starts]), # TODO does not account for all syntaxes, raw = map2_chr(starts, ends, ~ paste(news_lines[seq2(.x, .y)], collapse = "\n")), - versions = versions, section_state = "keep", title = names(versions), parse_versions(names(versions))[, c("version", "date", "nickname")], @@ -124,7 +123,6 @@ read_news <- function(news_lines = NULL) { } parse_news_md <- function(news) { - news <- protect_hashtag(news) versions <- versions_from_news(news) if (is.null(versions)) { return(NULL) diff --git a/R/update-news.R b/R/update-news.R index 252ca86b..d5c6b52e 100644 --- a/R/update-news.R +++ b/R/update-news.R @@ -39,7 +39,7 @@ add_news_to_fledgeling_samedev <- function(fledgeling, news_lines) { section_state = "new" ) } else { - old_news <- news_from_versions(fledgeling[["news"]]$versions[1])[[1]] + old_news <- news_from_versions(parse_news_md(fledgeling[["news"]]$raw[[1]]))[[1]] combined <- c(parse_news_lines(news_lines), old_news) combined <- purrr::discard(combined, purrr::is_empty) regrouped <- regroup_news(combined) @@ -106,7 +106,7 @@ add_news_to_fledgeling <- function( } if (dev_header_present) { - old_news <- news_from_versions(fledgeling[["news"]]$versions[1])[[1]] + old_news <- news_from_versions(parse_news_md(fledgeling[["news"]]$raw[[1]]))[[1]] combined <- c(parse_news_lines(news_lines), old_news) combined <- purrr::discard(combined, purrr::is_empty) news <- regroup_news(combined) diff --git a/tests/testthat/_snaps/fledgling.md b/tests/testthat/_snaps/fledgling.md index d85dbea6..b96ac081 100644 --- a/tests/testthat/_snaps/fledgling.md +++ b/tests/testthat/_snaps/fledgling.md @@ -7,7 +7,6 @@ "end": 8, "h2": false, "raw": "# fledge v2.0.0\n\n* blop\n\n* lala\n", - "versions": "
", "section_state": "keep", "title": "fledge v2.0.0", "version": "2.0.0", @@ -19,7 +18,6 @@ "end": 14, "h2": false, "raw": "# fledge v1.0.0\n\n* blip\n\n* lili\n", - "versions": "
", "section_state": "keep", "title": "fledge v1.0.0", "version": "1.0.0", @@ -40,7 +38,6 @@ "end": 9, "h2": false, "raw": "# Changes in v2.0.0\n\n* blop\n\n* lala\n\n", - "versions": "
", "section_state": "keep", "title": "Changes in v2.0.0", "version": "2.0.0", @@ -52,7 +49,6 @@ "end": 15, "h2": false, "raw": "# Changes in v1.0.0\n\n* blip\n\n* lili\n", - "versions": "
", "section_state": "keep", "title": "Changes in v1.0.0", "version": "1.0.0", @@ -73,7 +69,6 @@ "end": 8, "h2": false, "raw": "# Changes in v2.0.0 \"Vigorous Calisthenics\"\n\n* blop\n\n* lala\n", - "versions": "
", "section_state": "keep", "title": "Changes in v2.0.0 \"Vigorous Calisthenics\"", "version": "2.0.0", @@ -85,7 +80,6 @@ "end": 14, "h2": false, "raw": "# Changes in v1.0.0 \"Pumpkin Helmet\"\n\n* blip\n\n* lili\n", - "versions": "
", "section_state": "keep", "title": "Changes in v1.0.0 \"Pumpkin Helmet\"", "version": "1.0.0", @@ -106,7 +100,6 @@ "end": 8, "h2": true, "raw": "## Changes in v2.0.0 \"Vigorous Calisthenics\"\n\n* blop\n\n* lala\n", - "versions": "
", "section_state": "keep", "title": "Changes in v2.0.0 \"Vigorous Calisthenics\"", "version": "2.0.0", @@ -118,7 +111,6 @@ "end": 14, "h2": true, "raw": "## Changes in v1.0.0 \"Pumpkin Helmet\"\n\n* blip\n\n* lili\n", - "versions": "
", "section_state": "keep", "title": "Changes in v1.0.0 \"Pumpkin Helmet\"", "version": "1.0.0", @@ -139,7 +131,6 @@ "end": 7, "h2": false, "raw": "fledge v2.0.0\n=============\n\n* blop\n\n* lala\n", - "versions": "
", "section_state": "keep", "title": "fledge v2.0.0", "version": "2.0.0", @@ -151,7 +142,6 @@ "end": 13, "h2": false, "raw": "# fledge v1.0.0\n\n* blip\n\n* lili\n", - "versions": "
", "section_state": "keep", "title": "fledge v1.0.0", "version": "1.0.0", diff --git a/tests/testthat/_snaps/update-news.md b/tests/testthat/_snaps/update-news.md index d5b3a0e8..48075a2f 100644 --- a/tests/testthat/_snaps/update-news.md +++ b/tests/testthat/_snaps/update-news.md @@ -16,16 +16,16 @@ [1] "" $news - # A tibble: 1 x 10 + # A tibble: 1 x 9 start end h2 1 3 6 FALSE raw 1 "# tea 0.0.1 (2023-01-23)\n\n- Added a `NEWS.md` file to track changes to the~ - versions section_state title version date nickname - - 1 keep tea 0.0.1 (2023-01-23) 0.0.1 (2023-01-2~ + section_state title version date nickname + + 1 keep tea 0.0.1 (2023-01-23) 0.0.1 (2023-01-23) $preamble_in_file [1] TRUE