Просмотр исходного кода

regexplain gadget now returns the built regexp as a character string

pull/21/head
Garrick Aden-Buie 5 лет назад
Родитель
Сommit
bf7c6a1b66
6 измененных файлов: 34 добавлений и 6 удалений
  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 Просмотреть файл

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 Просмотреть файл

#' @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 Просмотреть файл

# ---- 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 Просмотреть файл

% 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 Просмотреть файл

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 Просмотреть файл

\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)
} }

Загрузка…
Отмена
Сохранить