From f216ac4a2bbc5c624567c9ea8e397b0e8423fd9e Mon Sep 17 00:00:00 2001 From: "Zhian N. Kamvar" Date: Wed, 23 Feb 2022 10:49:51 -0800 Subject: [PATCH] update footnote blarghing --- DESCRIPTION | 2 +- NEWS.md | 17 ++++++++++++----- R/Episode.R | 1 + tests/testthat/test-Episode.R | 4 ++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 086fbbff..ea26123a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: pegboard Title: Explore and Manipulate Markdown Curricula from the Carpentries -Version: 0.2.2 +Version: 0.2.3 Authors@R:c( person(given = "Zhian N.", family = "Kamvar", diff --git a/NEWS.md b/NEWS.md index a7b1921b..b99f6fd4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,15 +1,22 @@ +# pegboard 0.2.3 + +## BUG FIX + + - footnotes with no trailing newline are no longer accidentally appended with + relative link anchors when `getOption('sandpaper.links')` is not NULL. + # pegboard 0.2.2 +## NEW FEATURES + - If `getOption("sandpaper.links")` is not NULL (in the context of a {sandpaper} lesson) and is a valid file, it will be appended to any file read in via `Episode$new()` - - `$validate_links()` no longer throws warnings about short or uninformative - text for link anchors (@zkamvar, #81) -# pegboard 0.2.1 +## BUG FIX - - External links files are now appended if the `sandpaper.links` option is set - to a valid file. + - `$validate_links()` no longer throws warnings about short or uninformative + text for link anchors (@zkamvar, #81) # pegboard 0.2.1 diff --git a/R/Episode.R b/R/Episode.R index 98823e13..39fb2896 100644 --- a/R/Episode.R +++ b/R/Episode.R @@ -38,6 +38,7 @@ Episode <- R6::R6Class("Episode", # if we have links, we concatenate our input files tmpin <- tempfile(fileext = ".md") fs::file_copy(path, tmpin) + cat("\n", append = TRUE, file = tmpin) file.append(tmpin, links) path <- tmpin on.exit(unlink(tmpin), add = TRUE) diff --git a/tests/testthat/test-Episode.R b/tests/testthat/test-Episode.R index 1d22524e..1cfe9b16 100644 --- a/tests/testthat/test-Episode.R +++ b/tests/testthat/test-Episode.R @@ -36,8 +36,8 @@ test_that("Episodes from sandpaper will have links included", { tnk <- withr::local_tempfile() tep <- withr::local_tempfile() - writeLines("What [is this][link]?\n", tep) - writeLines("\n\n[link]: https://example.com/link", tnk) + writeLines("What[^1] [is this][link]?\n[^1]: foot", tep) + writeLines("[link]: https://example.com/link", tnk) e <- Episode$new(tep, fix_links = FALSE) expect_length(e$links, 0L) withr::local_options(list(sandpaper.links = tnk))