| @@ -48,4 +48,4 @@ Suggests: | |||
| Encoding: UTF-8 | |||
| LazyData: true | |||
| Roxygen: list(markdown = TRUE) | |||
| RoxygenNote: 7.1.0 | |||
| RoxygenNote: 7.1.1 | |||
| @@ -17,6 +17,9 @@ | |||
| #' @param pattern Regular Expression to edit or visualize using RegExplain | |||
| #' @param start_page Open gadget to this tab, one of `"Text"`, `"RegEx"`, | |||
| #' `"Output"`, or `"Help"` | |||
| #' | |||
| #' @return The regular expression built in the app is returned as a character | |||
| #' string. | |||
| #' @export | |||
| regexplain_gadget <- function( | |||
| text = NULL, | |||
| @@ -726,7 +726,8 @@ regexplain_gadget_server <- function(update_available = NULL) { | |||
| # ---- Server - Tab - Exit ---- | |||
| observeEvent(input$done, { | |||
| if (pattern() != "") { | |||
| pattern <- paste0('pattern <- "', escape_backslash(pattern()), '"') | |||
| regexp <- escape_backslash(pattern()) | |||
| pattern <- paste0('pattern <- "', regexp, '"') | |||
| if (any(c("perl", "fixed", "ignore.case", "useBytes") %in% input$regex_options)) { | |||
| options <- input$regex_options[!input$regex_options %in% c("text_break_lines", "global")] | |||
| options <- paste0(options, "=TRUE", collapse = ", ") | |||
| @@ -743,7 +744,7 @@ regexplain_gadget_server <- function(update_available = NULL) { | |||
| } | |||
| rstudioapi::sendToConsole(pattern, FALSE) | |||
| } | |||
| stopApp() | |||
| stopApp(regexp) | |||
| }) | |||
| observeEvent(input$cancel, { | |||
| @@ -0,0 +1,21 @@ | |||
| % Generated by roxygen2: do not edit by hand | |||
| % Please edit documentation in R/regexplain-deprecated.R | |||
| \name{regexplain-deprecated} | |||
| \alias{regexplain-deprecated} | |||
| \alias{regex_gadget} | |||
| \title{Deprecated or renamed functions} | |||
| \usage{ | |||
| regex_gadget(...) | |||
| } | |||
| \arguments{ | |||
| \item{...}{Arguments passed to the new or renamed functions.} | |||
| } | |||
| \value{ | |||
| The result of the new or renamed function. | |||
| } | |||
| \description{ | |||
| These functions in regexplain have been deprecated or renamed. | |||
| Use \code{\link[=regexplain_gadget]{regexplain_gadget()}} instead of \code{regex_gadget()}. | |||
| } | |||
| \keyword{internal} | |||
| @@ -52,6 +52,10 @@ respect the setting from any previous calls to \code{enableBookmarking()}. | |||
| See \code{\link[shiny:enableBookmarking]{enableBookmarking()}} for more information.} | |||
| }} | |||
| } | |||
| \value{ | |||
| The regular expression built in the app is returned as a character | |||
| string. | |||
| } | |||
| \description{ | |||
| The function behind the RegExplain Selection and RegExplain File | |||
| addins. Opens the RegExplain gadget interface in an RStudio viewer | |||
| @@ -20,7 +20,7 @@ view_regex( | |||
| \item{pattern}{Regex pattern to look for} | |||
| \item{...}{ | |||
| Arguments passed on to \code{\link[base:regexec]{base::regexec}} | |||
| Arguments passed on to \code{\link[base:grep]{base::regexec}} | |||
| \describe{ | |||
| \item{\code{ignore.case}}{if \code{FALSE}, the pattern matching is \emph{case | |||
| sensitive} and if \code{TRUE}, case is ignored during matching.} | |||
| @@ -52,6 +52,5 @@ the RStudio viewer pane. If \code{render} is \code{FALSE}, the HTML itself is re | |||
| If the output is destined for a \link{knitr} document, set \code{knitr} to \code{TRUE}. | |||
| } | |||
| \examples{ | |||
| view_regex("example", "amp", render=FALSE) | |||
| view_regex("example", "amp", render = FALSE) | |||
| } | |||