From 0a4a0c1d13bfed1adb394d4bc0d096d18f1684b0 Mon Sep 17 00:00:00 2001 From: Kevin Ushey Date: Wed, 25 May 2016 22:42:59 -0700 Subject: [PATCH] avoid insertion of '.' in family tag (closes #477) --- NEWS.md | 3 +++ R/family.R | 3 ++- tests/testthat/test-family.R | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index e276b2e30..9f5dab48e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # roxygen2 5.0.1.9000 +* Fixed an issue where `.`s were sometimes added between words within + a `@family` tag (#477, @kevinushey). + # roxygen2 5.0.1 * Use `ls()`, not `names()` to list elements of environment: fixes R 3.1.0 diff --git a/R/family.R b/R/family.R index a8d497c97..2aac4957b 100644 --- a/R/family.R +++ b/R/family.R @@ -28,7 +28,8 @@ process_family <- function(topics) { invert <- function(x) { if (length(x) == 0) return() - utils::unstack(rev(utils::stack(x))) + stacked <- utils::stack(x) + tapply(as.character(stacked$ind), stacked$values, c) } get_values <- function(topics, tag) { diff --git a/tests/testthat/test-family.R b/tests/testthat/test-family.R index 94c943293..45824312a 100644 --- a/tests/testthat/test-family.R +++ b/tests/testthat/test-family.R @@ -21,6 +21,7 @@ test_that("long families are wrapped", { ")[[1]] seealso <- get_tag(out, "seealso")$values + expect_true(grepl("^Other Long family name:", seealso)) expect_equal(str_count(seealso, "\n"), 2) }) @@ -37,6 +38,7 @@ test_that("special names escaped in family tag", { ")[[1]] seealso <- get_tag(out, "seealso")$values + expect_true(grepl("^Other Long family name:", seealso)) expect_match(seealso, "\\\\%\\+\\\\%") }) @@ -57,6 +59,7 @@ test_that("family links to name only, not all aliases", { ")[[1]] seealso <- get_tag(out, "seealso")$values + expect_true(grepl("^Other many aliases:", seealso)) expect_equal(str_count(seealso, fixed("\\code{\\link")), 1) })