Skip to content

Commit

Permalink
do not print any info about text chunks by default
Browse files Browse the repository at this point in the history
print inline code in the verbose mode only
  • Loading branch information
yihui committed Nov 18, 2022
1 parent a220a49 commit 7ef7be0
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions R/parser.R
Expand Up @@ -379,17 +379,12 @@ parse_inline = function(input, patterns) {
}

print.inline = function(x, ...) {
if (nrow(x$location)) {
cat(' ')
if (opts_knit$get('verbose')) {
cat(stringr::str_pad(' inline R code fragments ',
getOption('width') - 10L, 'both', '-'), '\n')
cat(sprintf(' %s:%s %s', x$location[, 1], x$location[, 2], x$code),
sep = '\n')
cat(' ', rep_str('-', getOption('width') - 10L), '\n')
} else cat('inline R code fragments\n')
} else cat(' ordinary text without R code\n')
cat('\n')
if (opts_knit$get('verbose')) {
cat('\n')
if (nrow(x$location)) {
cat(sprintf(' | %s #%s:%s', x$code, x$location[, 1], x$location[, 2]), sep = '\n')
}
}
}

#' Read chunks from an external script
Expand Down

0 comments on commit 7ef7be0

Please sign in to comment.