Skip to content

Commit

Permalink
input.src doesn't seem to be necessary for an inline block
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Dec 23, 2022
1 parent df7cf4b commit 1545a7e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion R/block.R
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ process_tangle.block = function(x) {
process_tangle.inline = function(x) {

output = if (opts_knit$get('documentation') == 2L) {
output = one_string(line_prompt(x$input.src, "#' ", "#' "))
output = paste("#'", gsub('\n', "\n#' ", x$input, fixed = TRUE))
} else ''

code = x$code
Expand Down
8 changes: 4 additions & 4 deletions R/parser.R
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,6 @@ print.block = function(x, ...) {

# extract inline R code fragments (as well as global options)
parse_inline = function(input, patterns) {
input.src = input # keep a copy of the source

inline.code = patterns$inline.code; inline.comment = patterns$inline.comment
if (!is.null(inline.comment)) {
idx = grepl(inline.comment, input)
Expand All @@ -363,8 +361,10 @@ parse_inline = function(input, patterns) {
} else character(0)
} else code = character(0)

structure(list(input = input, input.src = input.src, location = loc, code = code),
class = 'inline')
structure(
list(input = input, location = loc, code = code),
class = 'inline'
)
}

print.inline = function(x, ...) {
Expand Down

0 comments on commit 1545a7e

Please sign in to comment.