Skip to content

Commit

Permalink
Remove duplicate \cr definition (#2413)
Browse files Browse the repository at this point in the history
And use HTML5. Fixes #2400.
  • Loading branch information
hadley authored Mar 12, 2024
1 parent 96a25c5 commit ef01e76
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# pkgdown (development version)

* `\cr` is now translated to `<br>` not `<br />` (#2400).
* Fix parsing of github profiles and issues into links when present at the beginning of list items (@pearsonca, #2122)
* Correct parse usage for S3 methods with non-syntactic class names (#2384).
* Deprecated `build_favicon()` was removed (`build_favicons()` remains).
Expand Down
4 changes: 1 addition & 3 deletions R/rd-html.R
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ as_html.tag_dots <- function(x, ...) "..."
#' @export
as_html.tag_ldots <- function(x, ...) "..."
#' @export
as_html.tag_cr <- function(x, ...) "<br >"
as_html.tag_cr <- function(x, ...) "<br>"

# First element of enc is the encoded version (second is the ascii version)
#' @export
Expand All @@ -502,8 +502,6 @@ as_html.tag_enc <- function(x, ...) {
#' @export
as_html.tag_tab <- function(x, ...) ""
#' @export
as_html.tag_cr <- function(x, ...) "<br />"
#' @export
as_html.tag_newcommand <- function(x, ...) ""
#' @export
as_html.tag_renewcommand <- function(x, ...) ""
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-rd-html.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test_that("simple tags translated to known good values", {
expect_equal(rd2html("\\ldots"), "...")
expect_equal(rd2html("\\dots"), "...")
expect_equal(rd2html("\\R"), "<span style=\"R\">R</span>")
expect_equal(rd2html("\\cr"), "<br />")
expect_equal(rd2html("\\cr"), "<br>")

"Macros"
expect_equal(rd2html("\\newcommand{\\f}{'f'} \\f{}"), "'f'")
Expand Down Expand Up @@ -335,7 +335,7 @@ test_that("nl after tag doesn't trigger paragraphs", {

test_that("cr generates line break", {
out <- flatten_para(rd_text("a \\cr b"))
expect_equal(out, "<p>a <br /> b</p>")
expect_equal(out, "<p>a <br> b</p>")
})


Expand Down

0 comments on commit ef01e76

Please sign in to comment.