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

Fix #14 Add pattern parameter to regex_gadget()

pull/21/head
Garrick Aden-Buie 7 лет назад
Родитель
Сommit
5e8522fcc3
2 измененных файлов: 7 добавлений и 2 удалений
  1. +3
    -0
      R/regex_gadget.R
  2. +4
    -2
      man/regex_gadget.Rd

+ 3
- 0
R/regex_gadget.R Просмотреть файл

#' @import miniUI #' @import miniUI
#' @import shiny #' @import shiny
#' @param text Text to explore in gadget (editable using interface) #' @param text Text to explore in gadget (editable using interface)
#' @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"`
#' @export #' @export
regex_gadget <- function( regex_gadget <- function(
text = NULL, text = NULL,
pattern = NULL,
start_page = if (is.null(text)) "Text" else "RegEx" start_page = if (is.null(text)) "Text" else "RegEx"
) { ) {
stopifnot(requireNamespace("miniUI"), requireNamespace("shiny")) stopifnot(requireNamespace("miniUI"), requireNamespace("shiny"))
fillRow( fillRow(
flex = c(6, 1), flex = c(6, 1),
textInputCode('pattern', 'RegEx', width = "100%", textInputCode('pattern', 'RegEx', width = "100%",
value = pattern,
placeholder = "Standard RegEx, e.g. \\w+_\\d{2,4}\\s+"), placeholder = "Standard RegEx, e.g. \\w+_\\d{2,4}\\s+"),
tags$div(style = "margin-top: 23px; margin-left:6px;", tags$div(style = "margin-top: 23px; margin-left:6px;",
actionButton("library_show", "Library", class = "btn-success")) actionButton("library_show", "Library", class = "btn-success"))

+ 4
- 2
man/regex_gadget.Rd Просмотреть файл

\alias{regex_gadget} \alias{regex_gadget}
\title{RegExplain gadget} \title{RegExplain gadget}
\usage{ \usage{
regex_gadget(text = NULL, start_page = if (is.null(text)) "Text" else
"RegEx")
regex_gadget(text = NULL, pattern = NULL, start_page = if
(is.null(text)) "Text" else "RegEx")
} }
\arguments{ \arguments{
\item{text}{Text to explore in gadget (editable using interface)} \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"}, \item{start_page}{Open gadget to this tab, one of \code{"Text"}, \code{"RegEx"},
\code{"Output"}, or \code{"Help"}} \code{"Output"}, or \code{"Help"}}
} }

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