Maximilian Scholz 2 месяцев назад
Родитель
Сommit
befefa2719
Аккаунт пользователя с таким Email не найден
4 измененных файлов: 6 добавлений и 6 удалений
  1. +3
    -3
      R/addins.R
  2. +1
    -1
      R/gadget_server.R
  3. +1
    -1
      R/regex.R
  4. +1
    -1
      R/shiny_modified_inputs.R

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

# Get context text # Get context text
ctx_text <- context$selection[[1]]$text ctx_text <- context$selection[[1]]$text


max_lines <- getOption("rexeplain.addin.max_lines", 100)
max_lines <- getOption("regexplain.addin.max_lines", 100)


# If it is one line and evaluates to something, use that # If it is one line and evaluates to something, use that
# Otherwise treat as text # Otherwise treat as text
} }
) )


regexplain_gadget(if (length(obj) && obj != "") obj)
regexplain_gadget(if (length(obj) && all(nzchar(obj))) obj)
} }


#' @describeIn regexplain_gadget Opens file chooser to pick file, reads lines, #' @describeIn regexplain_gadget Opens file chooser to pick file, reads lines,
regexplain_file <- function(pattern = NULL, start_page = "RegEx") { regexplain_file <- function(pattern = NULL, start_page = "RegEx") {
fname <- file.choose() fname <- file.choose()
x <- readLines(fname) x <- readLines(fname)
max_lines <- getOption("rexeplain.addin.max_lines", 100)
max_lines <- getOption("regexplain.addin.max_lines", 100)
if (length(x) > max_lines) { if (length(x) > max_lines) {
message("There were ", format(length(x), big.mark = ","), " lines in ", message("There were ", format(length(x), big.mark = ","), " lines in ",
fname, "\nUsing only first ", max_lines, ".\n", fname, "\nUsing only first ", max_lines, ".\n",

+ 1
- 1
R/gadget_server.R Просмотреть файл

} }
do.call( do.call(
eval(parse(text = "stringr::regex")), eval(parse(text = "stringr::regex")),
list(pattern = pattern, ignore_case, ignore_case, literal = literal)
list(pattern = pattern, ignore_case = ignore_case, literal = literal)
) )
} }



+ 1
- 1
R/regex.R Просмотреть файл

} else if (pattern_chars[i] == ")") { } else if (pattern_chars[i] == ")") {
closes_capture_group <- paren_stack[1] closes_capture_group <- paren_stack[1]
paren_stack <- paren_stack[-1] # pop paren_stack <- paren_stack[-1] # pop
if (closes_capture_group) {
if (isTRUE(closes_capture_group)) {
out <- c(out, ")</span>") out <- c(out, ")</span>")
} else { } else {
out <- c(out, ")") out <- c(out, ")")

+ 1
- 1
R/shiny_modified_inputs.R Просмотреть файл

shiny::div( shiny::div(
class = "form-group shiny-input-container", class = "form-group shiny-input-container",
tags$label(label, `for` = inputId), tags$label(label, `for` = inputId),
style = if (!parent_style %in% c(" ", "", " ")) parent_style,
style = if (length(parent_style) && !all(parent_style %in% c(" ", "", " "))) parent_style,
shiny::tags$textarea( shiny::tags$textarea(
id = inputId, id = inputId,
class = "form-control", class = "form-control",

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