Skip to content

Commit

Permalink
Move htmlwidgets to suggests (closes qinwf#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemklevtsov committed Jul 12, 2019
1 parent d511fbf commit 5f8e8e3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
19 changes: 13 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ License: BSD_3_clause + file LICENSE
LazyData: TRUE
Depends: R (>= 3.3)
Imports:
Rcpp (>= 0.12.2), stringi, RcppParallel,
htmlwidgets (>= 0.6),
LinkingTo: Rcpp, RcppParallel
Rcpp (>= 0.12.2),
stringi,
RcppParallel
LinkingTo:
Rcpp,
RcppParallel
Suggests:
knitr (>= 1.12.3),testthat,
rmarkdown (>= 0.9.5),microbenchmark,
ggplot2, directlabels
htmlwidgets (>= 0.6),
knitr (>= 1.12.3),
testthat,
rmarkdown (>= 0.9.5),
microbenchmark,
ggplot2,
directlabels
URL: https://github.com/qinwf/re2r/
BugReports: https://github.com/qinwf/re2r/issues
VignetteBuilder: knitr
Expand Down
10 changes: 7 additions & 3 deletions R/widget.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ remove_named = function(string){
#' @export
show_regex <- function(pattern, width = NULL, height = NULL) {

if (is.character(pattern)){
if (!requireNamespace("htmlwidgets", quietly = TRUE)) {
stop("'htmlwidgets' package is not installed.")
}

if (is.character(pattern)) {
res = re2(pattern)
}else if (inherits(pattern,"re2c")) {
} else if (inherits(pattern,"re2c")) {
res = pattern
} else if (is.list(pattern)){
} else if (is.list(pattern)) {
return(show_regex(pattern[[1]], width, height))
} else {
stop("pattern is a string or a pre-compiled regular expression.")
Expand Down
1 change: 0 additions & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

##' @useDynLib re2r
##' @import Rcpp
##' @import htmlwidgets
##' @importFrom stringi stri_enc_toutf8
##' @importFrom RcppParallel RcppParallelLibs
NULL

0 comments on commit 5f8e8e3

Please sign in to comment.