Skip to content

Commit

Permalink
support widget lists ramnathv/htmlwidgets#110
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed May 18, 2015
1 parent 70e76e5 commit 7ba4253
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ S3method(wrap,character)
S3method(wrap,default)
S3method(wrap,error)
S3method(wrap,knit_asis)
S3method(wrap,knit_asis_list)
S3method(wrap,list)
S3method(wrap,message)
S3method(wrap,recordedplot)
Expand Down
2 changes: 1 addition & 1 deletion R/block.R
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ inline_exec = function(
v = withVisible(eval(parse_only(code[i]), envir = envir))
if (v$visible) knit_print(v$value, inline = TRUE, options = opts_chunk$get())
} else '??'
if (inherits(res, 'knit_asis')) res = wrap.knit_asis(res, inline = TRUE)
if (inherits(res, c('knit_asis', 'knit_asis_list'))) res = wrap(res, inline = TRUE)
d = nchar(input)
# replace with evaluated results
stringr::str_sub(input, loc[i, 1], loc[i, 2]) = if (length(res)) {
Expand Down
6 changes: 6 additions & 0 deletions R/output.R
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,12 @@ wrap.knit_asis = function(x, options, inline = FALSE) {
knit_hooks$get('output')(x, options)
}

#' @export
wrap.knit_asis_list = function(x, options, inline = FALSE) {
res = lapply(x, wrap, options = options, inline = inline)
paste(unlist(res), collapse = '\n')
}

#' @export
wrap.source = function(x, options) {
src = sub('\n$', '', x$src)
Expand Down

0 comments on commit 7ba4253

Please sign in to comment.