Skip to content

Commit

Permalink
Merge pull request #21 from poissonconsulting/b-pdf-wrapping
Browse files Browse the repository at this point in the history
Add extra line break to model blocks to ensure correct PDF wrapping behaviour
  • Loading branch information
nehill197 authored Oct 25, 2024
2 parents 6a8e548 + 22197ee commit 72732ae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/blocks.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ sbr_blocks <- function(x_name = ".*", sub = character(0), report = sbr_get_repor
data$caption <- p0("Block ", 1:nrow(data), ". ", data$caption)
data$caption <- add_full_stop(data$caption)

data$blocks <- p0("```\n.", data$blocks, "\n..\n```")
data$blocks <- p0("```\n.\n", data$blocks, "\n..\n```")

txt <- character(0)
for (i in seq_len(nrow(data))) {
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/results.Rmd
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: 'testthat'
date: 2021-11-30 16:24:12
date: 2024-10-25 14:48:25.85988
---

```{r, echo = FALSE, warning = FALSE, message = FALSE, include = FALSE, cache = FALSE}
knitr::opts_chunk$set(warning = FALSE, message = FALSE, echo = FALSE, comment = NA, results = 'asis', cache = FALSE)
main <- '/private/var/folders/wy/svb7d7bx3dlcm68nkktbghvm0000gn/T/RtmpfIxfqh/file4b232a2c737d/output'
main <- '/private/var/folders/rb/_krf3xys2b7dztjbhm_cpj0m0000gn/T/RtmpkTOZVx/file4afd6427191/output'
sub <- ''
```

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-blocks.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test_that("blocks", {
subfoldr2::sbf_save_block(y, caption = "jags")

txt <- sbr_blocks()
expect_identical(txt, "\n```\n.\n model {\n for(i in 1:N)\n bEffect ~ dnorm(0, 2^-2)\n }\n..\n```\nBlock 1. jags.\n")
expect_identical(txt, "\n```\n.\n\n model {\n for(i in 1:N)\n bEffect ~ dnorm(0, 2^-2)\n }\n..\n```\nBlock 1. jags.\n")
expect_identical(sbr_blocks(x_name = "y"), txt)
expect_identical(sbr_blocks(x_name = "z"), character(0))
expect_identical(list.files(sbr_get_report(), recursive = TRUE), "blocks/y.txt")
Expand Down

0 comments on commit 72732ae

Please sign in to comment.