Skip to content

Commit 7a2c8a1

Browse files
committed
Fix for #416
1 parent d89d7e6 commit 7a2c8a1

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

.github/workflows/R-CMD-check.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
2424
- {os: ubuntu-latest, r: 'release'}
2525
- {os: ubuntu-latest, r: 'oldrel-1'}
26+
- {os: ubuntu-latest, r: 'oldrel-2'}
2627

2728
env:
2829
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

R/write_report_rtf.R

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ write_rtf_output <- function(rs, ls, rtf_path, orig_path, tmp_dir) {
164164
else if (rs$font_size == 9)
165165
hdr[length(hdr) + 1] <- "\\sl-200\\slmult0\\fs18"
166166

167-
body <- encodeRTF(ls)
167+
# browser()
168+
169+
body <- encodeRTF(ls, FALSE)
168170

169171
if (rs$has_graphics) {
170172
# Remove fill lines
@@ -254,9 +256,16 @@ write_rtf_output <- function(rs, ls, rtf_path, orig_path, tmp_dir) {
254256

255257
#' @noRd
256258
encodeRTF <- Vectorize(function(x, allow_rtf_code = FALSE) {
259+
260+
# browser()
257261

258-
ints <- utf8ToInt(x)
259-
res <- paste0(encodeRTF_internal(ints, allow_rtf_code), collapse = "")
262+
if (nchar(x) > 0) {
263+
ints <- utf8ToInt(x)
264+
res <- paste0(encodeRTF_internal(ints, allow_rtf_code), collapse = "")
265+
} else {
266+
267+
res <- x
268+
}
260269

261270
return(res)
262271
})

tests/testthat/test-system.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3681,3 +3681,4 @@ test_that("test109: Title header can be wrapped.", {
36813681
expect_equal(TRUE, TRUE)
36823682
}
36833683
})
3684+

0 commit comments

Comments
 (0)