diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 74675e8..f8f7817 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ -Version: 0.1.0 -Date: 2022-08-18 16:49:47 UTC -SHA: 912f0b4c02253b1332ea3cc2b3141891cbb8ce45 +Version: 0.2.0 +Date: 2023-03-28 14:41:10 UTC +SHA: 20c22c5435b3d4ae0dbe8729273a2a496219859a diff --git a/DESCRIPTION b/DESCRIPTION index 2748a82..bb4cc73 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: tinkr Title: Cast '(R)Markdown' Files to 'XML' and Back Again -Version: 0.1.0.9000 +Version: 0.2.0 Authors@R: c(person(given = "Maƫlle", family = "Salmon", @@ -55,5 +55,5 @@ Config/testthat/edition: 3 Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.1.9000 +RoxygenNote: 7.2.3 VignetteBuilder: knitr diff --git a/NEWS.md b/NEWS.md index b62faec..1f0533a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,14 +1,29 @@ -# tinkr (development version) +# tinkr 0.2.0 -* removed dependency on stringr in favor of base R functions wrapped in internal - functions with a stringr-like interface (#88). +## BUG FIX + +* Empty YAML will not prepend with newline in {glue} (> 1.6.2). + (#93, @jennybc) +- Relative links whose text and anchor key are identical (e.g. footnotes) are + no longer doubled in the output document (issue: #92, fix: #94) + +## NEW FEATURES + +* New `protect_curly()` function will add a `curly='true'` attribute to text + wrapped in curly braces ('{', '}') to allow parsing of the XML for sending to + external APIs. This function will also parse alt text and place it in an + attribute. +* New `$protect_curly()` method implements `protect_curly()` on yarn objects +* Relative link anchor keys will no longer have characters escaped (#85). * unescaped square braces from the source code can now make the roundtrip without extra markup. This is implemented in a new default parameter for `to_xml()` called `unescaped = TRUE`, which indicates that you would like unescaped square braces to remain unescaped (#78). -* New `protect_curly()` function will add a `curly='true'` attribute to text wrapped in curly braces ('{', '}') to allow parsing of the XML for sending to external APIs. This function will also parse alt text and place it in an attribute. -* New `$protect_curly()` method implements `protect_curly()` on yarn objects -* Relative link anchor keys will no longer have characters escaped (#85). + +## DEPENDENCY UPDATE + +* removed dependency on stringr in favor of base R functions wrapped in internal + functions with a stringr-like interface (#88). # tinkr 0.1.0 diff --git a/R/to_xml.R b/R/to_xml.R index 76c99a3..8f3042c 100644 --- a/R/to_xml.R +++ b/R/to_xml.R @@ -11,7 +11,7 @@ #' and the links will appear as normal links. See [resolve_anchor_links()] for #' details. #' @param unescaped if `TRUE` (default) AND `sourcepos = TRUE`, square braces -#' that were unescaped in the original document will be presered as best as +#' that were unescaped in the original document will be preserved as best as #' possible. If this is `FALSE`, these braces will be escaped in the output #' document. See [protect_unescaped()] for details. #' diff --git a/cran-comments.md b/cran-comments.md index e8c0c3b..d00ab3b 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,25 +1,2 @@ -## Response to review +This is a submission that contains new features and bug fixes. -There were two comments from the previous submission: - -> You have examples for unexported functions. Please either omit these examples or export these functions. - -This was raised from `man/find_between.Rd` and is a false alarm (as I indicated in an earlier submission). If you look closely, the code for this example (man/find_between.Rd lines 34-46) [1] is creating an example of a pandoc fenced Div [2], which always starts and ends with at least three colons. - -> Please ensure that your functions do not write by default or in your examples/vignettes/tests in the user's home filespace (including the package directory and getwd()). This is not allowed by CRAN policies. Please omit any default path in writing functions. In your examples/vignettes/tests you can write to tempdir(). - -I can not find the place in the tests or vignettes where I am writing to the user workspace. In all the instances I find code that writes to the workspace, it is writing to a temporary file or a file in a temporary directory that is cleaned up at the end of the example. Moreover, in the code itself, the default argument of `path` for the write functions [3, 4] are all `NULL`, which either return the output to a character vector or error (depending on context). - -All the best, -Zhian - -[1]: https://github.com/ropensci/tinkr/blob/9aeeaf9cdd230d2561491d9c8a383113a05313ca/man/find_between.Rd#L34-L46 -[2]: https://pandoc.org/MANUAL.html#divs-and-spans -[3]: https://github.com/ropensci/tinkr/blob/5eb23b46864df26d5cf150600f796d3f3609b11c/R/class-yarn.R#L89-L95 -[4]: https://github.com/ropensci/tinkr/blob/5eb23b46864df26d5cf150600f796d3f3609b11c/R/to_md.R#L53-L57 - -## R CMD check results - -0 errors | 0 warnings | 1 note - -* This is a resubmission of a new release. diff --git a/inst/stylesheets/xml2md_gfm.xsl b/inst/stylesheets/xml2md_gfm.xsl index 2adc107..54816bc 100644 --- a/inst/stylesheets/xml2md_gfm.xsl +++ b/inst/stylesheets/xml2md_gfm.xsl @@ -36,8 +36,11 @@ ! [ - - ][ + + + + ][ + ] diff --git a/man/to_xml.Rd b/man/to_xml.Rd index 0894f98..793b1f7 100644 --- a/man/to_xml.Rd +++ b/man/to_xml.Rd @@ -23,12 +23,12 @@ Defaults to \code{FALSE}.} \item{anchor_links}{if \code{TRUE} (default), reference-style links with anchors (in the style of \verb{[key]: https://example.com/link "title"}) will be -preserved as best as possible. If this is \code{FASLE}, the anchors disappear +preserved as best as possible. If this is \code{FALSE}, the anchors disappear and the links will appear as normal links. See \code{\link[=resolve_anchor_links]{resolve_anchor_links()}} for details.} \item{unescaped}{if \code{TRUE} (default) AND \code{sourcepos = TRUE}, square braces -that were unescaped in the original document will be presered as best as +that were unescaped in the original document will be preserved as best as possible. If this is \code{FALSE}, these braces will be escaped in the output document. See \code{\link[=protect_unescaped]{protect_unescaped()}} for details.} } diff --git a/tests/testthat/_snaps/anchor-links.md b/tests/testthat/_snaps/anchor-links.md index 74a4e5a..d98a967 100644 --- a/tests/testthat/_snaps/anchor-links.md +++ b/tests/testthat/_snaps/anchor-links.md @@ -33,7 +33,7 @@ ## This is some extended markdown content {#extended .callout} - This should also include references that use [standalone][standalone] links and + This should also include references that use [standalone] links and footnotes should not be properly parsed and will be considered 'asis' nodes, at least that's what I *believe*[^footy]. Maybe this might not pan out [^but who knows? footnotes are **WEIRD**, man]. diff --git a/tests/testthat/test-anchor-links.R b/tests/testthat/test-anchor-links.R index 4e610f4..5530e7c 100644 --- a/tests/testthat/test-anchor-links.R +++ b/tests/testthat/test-anchor-links.R @@ -1,5 +1,23 @@ f <- system.file("extdata", "link-test.md", package = "tinkr") + +test_that("anchor links with duplicate id and text are not doubled", { + # https://github.com/ropensci/tinkr/issues/92 + lines <- c("[thing]", "lala[^1] blabla", "", "[thing]: what", "[^1]: pof") + + temp_file <- withr::local_tempfile() + writeLines(lines, temp_file) + + res <- tinkr::yarn$new(temp_file)$show() + expect_equal(res[res != ""], lines[lines != ""]) + #> [thing] lala[^1] blabla + #> + #> [thing]: what + #> [^1]: pof + +}) + + test_that("anchored links are processed by default", { m <- yarn$new(f, sourcepos = TRUE) expect_snapshot(show_user(m$show(), force = TRUE))