Skip to content

JSS continuation prompt when eval=FALSE #311

@cderv

Description

@cderv

Following #254 comment, the continuation prompt should be + for code chunk, evaluated or not.
That means

```{r}
f <- function(a, b) mean(c(a,b))
f(a = 1,
  b = 2)
```
or 

```{r, eval = FALSE}
f <- function(a, b) mean(c(a,b))
f(a = 1,
  b = 2)
```

shoult be rendered as this in both case

R> f <- function(a, b) mean(c(a,b))
R> f(a = 1,
+   b = 2)

Currently, it is not the case. #294 fixed part of the issue in rticles by changing R+ to + but this works only for evaluated chunks.

In fact, the transformation is based on a hook

rticles/R/jss_article.R

Lines 46 to 53 in ec5e82b

hook_input <- function(x, options) {
if (options$prompt && length(x)) {
x <- gsub("\\n", paste0("\n", "+ "), x)
x <- paste0("R> ", x)
}
paste0(c('\n\\begin{CodeInput}', x, '\\end{CodeInput}', ''),
collapse = '\n')
}

but for eval=FALSE , chunk input is not parsed the same as when eval=TRUE so the hook does not apply the same.
It could be a bug elsewhere than rticles...

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions