Skip to content

Commit

Permalink
Merge pull request #94 from ropensci/release-cran-2023-03
Browse files Browse the repository at this point in the history
Release to CRAN
  • Loading branch information
zkamvar authored Mar 28, 2023
2 parents c50a2f0 + 8e36dc8 commit a5dd3dd
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 41 deletions.
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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
27 changes: 21 additions & 6 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion R/to_xml.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#'
Expand Down
25 changes: 1 addition & 24 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 5 additions & 2 deletions inst/stylesheets/xml2md_gfm.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@
<xsl:template match="md:link[@rel] | md:image[@rel]">
<xsl:if test="self::md:image">!</xsl:if>
<xsl:text>[</xsl:text>
<xsl:apply-templates select="md:*"/>
<xsl:text>][</xsl:text>
<!-- use only one set of brackets for links where the key matches the text-->
<xsl:if test="not(string(self::md:*)=string(@rel))">
<xsl:apply-templates select="md:*"/>
<xsl:text>][</xsl:text>
</xsl:if>
<xsl:value-of select='string(@rel)'/>
<xsl:text>]</xsl:text>
</xsl:template>
Expand Down
4 changes: 2 additions & 2 deletions man/to_xml.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/_snaps/anchor-links.md
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down
18 changes: 18 additions & 0 deletions tests/testthat/test-anchor-links.R
Original file line number Diff line number Diff line change
@@ -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))
Expand Down

0 comments on commit a5dd3dd

Please sign in to comment.