Przeglądaj źródła

regexplain gadget now returns the built regexp as a character string

main
Garrick Aden-Buie 5 lat temu
rodzic
commit
e3630da787
6 zmienionych plików z 34 dodań i 6 usunięć
  1. +1
    -1
      DESCRIPTION
  2. +3
    -0
      R/gadget.R
  3. +3
    -2
      R/gadget_server.R
  4. +21
    -0
      man/regexplain-deprecated.Rd
  5. +4
    -0
      man/regexplain_gadget.Rd
  6. +2
    -3
      man/view_regex.Rd

+ 1
- 1
DESCRIPTION Wyświetl plik

Encoding: UTF-8 Encoding: UTF-8
LazyData: true LazyData: true
Roxygen: list(markdown = TRUE) Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.0
RoxygenNote: 7.1.1

+ 3
- 0
R/gadget.R Wyświetl plik

#' @param pattern Regular Expression to edit or visualize using RegExplain #' @param pattern Regular Expression to edit or visualize using RegExplain
#' @param start_page Open gadget to this tab, one of `"Text"`, `"RegEx"`, #' @param start_page Open gadget to this tab, one of `"Text"`, `"RegEx"`,
#' `"Output"`, or `"Help"` #' `"Output"`, or `"Help"`
#'
#' @return The regular expression built in the app is returned as a character
#' string.
#' @export #' @export
regexplain_gadget <- function( regexplain_gadget <- function(
text = NULL, text = NULL,

+ 3
- 2
R/gadget_server.R Wyświetl plik

# ---- Server - Tab - Exit ---- # ---- Server - Tab - Exit ----
observeEvent(input$done, { observeEvent(input$done, {
if (pattern() != "") { 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)) { 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 <- input$regex_options[!input$regex_options %in% c("text_break_lines", "global")]
options <- paste0(options, "=TRUE", collapse = ", ") options <- paste0(options, "=TRUE", collapse = ", ")
} }
rstudioapi::sendToConsole(pattern, FALSE) rstudioapi::sendToConsole(pattern, FALSE)
} }
stopApp()
stopApp(regexp)
}) })


observeEvent(input$cancel, { observeEvent(input$cancel, {

+ 21
- 0
man/regexplain-deprecated.Rd Wyświetl plik

% 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}

+ 4
- 0
man/regexplain_gadget.Rd Wyświetl plik

See \code{\link[shiny:enableBookmarking]{enableBookmarking()}} for more information.} See \code{\link[shiny:enableBookmarking]{enableBookmarking()}} for more information.}
}} }}
} }
\value{
The regular expression built in the app is returned as a character
string.
}
\description{ \description{
The function behind the RegExplain Selection and RegExplain File The function behind the RegExplain Selection and RegExplain File
addins. Opens the RegExplain gadget interface in an RStudio viewer addins. Opens the RegExplain gadget interface in an RStudio viewer

+ 2
- 3
man/view_regex.Rd Wyświetl plik

\item{pattern}{Regex pattern to look for} \item{pattern}{Regex pattern to look for}


\item{...}{ \item{...}{
Arguments passed on to \code{\link[base:regexec]{base::regexec}}
Arguments passed on to \code{\link[base:grep]{base::regexec}}
\describe{ \describe{
\item{\code{ignore.case}}{if \code{FALSE}, the pattern matching is \emph{case \item{\code{ignore.case}}{if \code{FALSE}, the pattern matching is \emph{case
sensitive} and if \code{TRUE}, case is ignored during matching.} sensitive} and if \code{TRUE}, case is ignored during matching.}
If the output is destined for a \link{knitr} document, set \code{knitr} to \code{TRUE}. If the output is destined for a \link{knitr} document, set \code{knitr} to \code{TRUE}.
} }
\examples{ \examples{
view_regex("example", "amp", render=FALSE)

view_regex("example", "amp", render = FALSE)
} }

Ładowanie…
Anuluj
Zapisz