| @@ -1,6 +1,7 @@ | |||
| # Generated by roxygen2: do not edit by hand | |||
| export(regexplain_cheatsheet) | |||
| export(regexplain_file) | |||
| export(regexplain_gadget) | |||
| export(regexplain_web) | |||
| export(view_regex) | |||
| @@ -46,13 +46,11 @@ regexplain_addin <- function() { | |||
| } | |||
| #' Regexplain File Addin | |||
| #' | |||
| #' See [regexplain_addin]. Opens file chooser to pick file, reads lines, returns | |||
| #' first `regexplain.addin.max_lines` (default 100). | |||
| #' | |||
| #' @keywords internal | |||
| regexplain_file <- function() { | |||
| #' @describeIn regexplain_gadget Opens file chooser to pick file, reads lines, | |||
| #' returns first `regexplain.addin.max_lines` (default 100). Used in the | |||
| #' "Regexplain File" [regexplain_addin]. | |||
| #' @export | |||
| regexplain_file <- function(pattern = NULL, start_page = "RegEx") { | |||
| fname <- file.choose() | |||
| x <- readLines(fname) | |||
| max_lines <- getOption("rexeplain.addin.max_lines", 100) | |||
| @@ -63,5 +61,5 @@ regexplain_file <- function() { | |||
| "increase the number of lines.") | |||
| x <- x[1:max_lines] | |||
| } | |||
| regexplain_gadget(x, "RegEx") | |||
| regexplain_gadget(text = x, pattern = pattern, start_page = start_page) | |||
| } | |||
| @@ -4,6 +4,13 @@ | |||
| #' addins. Opens the RegExplain gadget interface in an RStudio viewer | |||
| #' pane. | |||
| #' | |||
| #' @examples | |||
| #' \dontrun{ | |||
| #' regexplain_gadget(text = month.name, pattern = "(Ma|Ju)|(er)") | |||
| #' regexplain_web(text = month.name, pattern = "(Ma|Ju)|(er)") | |||
| #' regexplain_file() | |||
| #' } | |||
| #' | |||
| #' @import miniUI | |||
| #' @import shiny | |||
| #' @param text Text to explore in gadget (editable using interface) | |||
| @@ -66,6 +66,7 @@ textAreaInputAlt <- function(inputId, label, value = "", width = NULL, height = | |||
| #' | |||
| #' @inheritParams shiny::textInput | |||
| #' @param width Width of `shiny-input-container` div. | |||
| #' @param ... Extra elements to be included in the `input-group` div. | |||
| #' @family modified shiny inputs | |||
| textInputCode <- function(inputId, label, value = "", width = NULL, | |||
| placeholder = NULL, ...) { | |||
| @@ -1,13 +0,0 @@ | |||
| % Generated by roxygen2: do not edit by hand | |||
| % Please edit documentation in R/addins.R | |||
| \name{regexplain_file} | |||
| \alias{regexplain_file} | |||
| \title{Regexplain File Addin} | |||
| \usage{ | |||
| regexplain_file() | |||
| } | |||
| \description{ | |||
| See \link{regexplain_addin}. Opens file chooser to pick file, reads lines, returns | |||
| first \code{regexplain.addin.max_lines} (default 100). | |||
| } | |||
| \keyword{internal} | |||
| @@ -1,23 +1,26 @@ | |||
| % Generated by roxygen2: do not edit by hand | |||
| % Please edit documentation in R/gadget.R | |||
| \name{regexplain_gadget} | |||
| % Please edit documentation in R/addins.R, R/gadget.R | |||
| \name{regexplain_file} | |||
| \alias{regexplain_file} | |||
| \alias{regexplain_gadget} | |||
| \alias{regexplain_web} | |||
| \title{RegExplain gadget} | |||
| \usage{ | |||
| regexplain_file(pattern = NULL, start_page = "RegEx") | |||
| regexplain_gadget(text = NULL, pattern = NULL, start_page = if | |||
| (is.null(text)) "Text" else "RegEx") | |||
| regexplain_web(text = NULL, pattern = NULL, start_page = "Text", ...) | |||
| } | |||
| \arguments{ | |||
| \item{text}{Text to explore in gadget (editable using interface)} | |||
| \item{pattern}{Regular Expression to edit or visualize using RegExplain} | |||
| \item{start_page}{Open gadget to this tab, one of \code{"Text"}, \code{"RegEx"}, | |||
| \code{"Output"}, or \code{"Help"}} | |||
| \item{text}{Text to explore in gadget (editable using interface)} | |||
| \item{...}{Arguments passed on to \code{shiny::shinyApp} | |||
| \describe{ | |||
| \item{ui}{The UI definition of the app (for example, a call to | |||
| @@ -50,7 +53,19 @@ pane. | |||
| } | |||
| \section{Functions}{ | |||
| \itemize{ | |||
| \item \code{regexplain_file}: Opens file chooser to pick file, reads lines, | |||
| returns first \code{regexplain.addin.max_lines} (default 100). Used in the | |||
| "Regexplain File" \link{regexplain_addin}. | |||
| \item \code{regexplain_web}: Launches the RegExplain gadget in a browser or an | |||
| RStduio viewer pane. | |||
| }} | |||
| \examples{ | |||
| \dontrun{ | |||
| regexplain_gadget(text = month.name, pattern = "(Ma|Ju)|(er)") | |||
| regexplain_web(text = month.name, pattern = "(Ma|Ju)|(er)") | |||
| regexplain_file() | |||
| } | |||
| } | |||
| @@ -5,7 +5,7 @@ | |||
| \title{Modified Text Input} | |||
| \usage{ | |||
| textInputCode(inputId, label, value = "", width = NULL, | |||
| placeholder = NULL) | |||
| placeholder = NULL, ...) | |||
| } | |||
| \arguments{ | |||
| \item{inputId}{The \code{input} slot that will be used to access the value.} | |||
| @@ -19,6 +19,8 @@ textInputCode(inputId, label, value = "", width = NULL, | |||
| \item{placeholder}{A character string giving the user a hint as to what can | |||
| be entered into the control. Internet Explorer 8 and 9 do not support this | |||
| option.} | |||
| \item{...}{Extra elements to be included in the \code{input-group} div.} | |||
| } | |||
| \description{ | |||
| Standard \code{\link[shiny:textInput]{shiny::textInput()}} with additional \code{width} parameter, added code | |||