| @@ -1,4 +1,4 @@ | |||
| #' regexplain gadget | |||
| #' RegExplain gadget | |||
| #' | |||
| #' @import miniUI | |||
| #' @import shiny | |||
| @@ -17,7 +17,7 @@ regex_gadget <- function(text = NULL, | |||
| shiny::includeCSS(system.file("styles", "style.css", package = "regexplain")), | |||
| shiny::includeCSS(system.file("styles", "gadget.css", package = "regexplain")), | |||
| gadgetTitleBar( | |||
| "regexplain", | |||
| "RegExplain", | |||
| right = miniTitleBarButton("done", "Send RegEx To Console", TRUE) | |||
| ), | |||
| miniTabstripPanel( | |||
| @@ -57,9 +57,9 @@ regex_gadget <- function(text = NULL, | |||
| label = HTML( | |||
| '<div style="font-size: 1.25rem;">', | |||
| 'Option Groups: ', | |||
| '<span style="color: #337ab7;">regexplain</span>,', | |||
| '<span style="color: #5cb85c;">all</span>, ', | |||
| '<span style="color: #f0ad4e;">base only</span>', | |||
| '<span style="color: #337ab7;">RegExplain</span>,', | |||
| '<span style="color: #5cb85c;">All</span>, ', | |||
| '<span style="color: #f0ad4e;">Base only</span>', | |||
| '</div>' | |||
| ), | |||
| inline = TRUE, | |||
| @@ -341,11 +341,9 @@ regex_gadget <- function(text = NULL, | |||
| # ---- Server - Tab - Help ---- | |||
| HELP_DEFAULT_TEXT <- c( | |||
| "<div id=\"welcome-to-regexplain\" class=\"section level3\">", | |||
| "<h3>Welcome to RegExplain</h3>", | |||
| "<p>If you’re new to regular expressions, one of the best places to start is <a href=\"http://stringr.tidyverse.org/articles/regular-expressions.html\">the regular expressions vignette</a> from <code>stringr</code>. The chapter on strings in <a href=\"http://r4ds.had.co.nz/strings.html\">R for Data Science</a> is also an excellent first resource.</p>", | |||
| "<p><strong>Exploring or looking for a challenge?</strong> Click on <i>Try These Examples</i> to see what you can do with this addin.</p>", | |||
| "<div id=\"getting-started\" class=\"section level4\">", | |||
| "<h4>Getting Started</h4>", | |||
| "<ul>", | |||
| "<li><p><i class=\"fa fa-file-text-o\"></i> Enter or edit the <strong>Text</strong> you want to search.</p></li>", | |||
| @@ -353,14 +351,12 @@ regex_gadget <- function(text = NULL, | |||
| "<li><p><i class=\"fa fa-table\"></i> Test the <strong>Output</strong> of your regular expression with common functions, including <i>search and replace</i> functions.</p></li>", | |||
| "<li><p><i class=\"fa fa-support\"></i> Get <strong>Help</strong> and look up the regular expression syntax.</p></li>", | |||
| "</ul>", | |||
| "</div>", | |||
| "<div id=\"escaping-characters\" class=\"section level4\">", | |||
| "<h4>Escaping characters</h4>", | |||
| "<p>In order to store a backslash (<code>\\</code>) as a character in R, backslashes need to be escaped…with another backslash! To write a literal <code>\\</code> in an R character string, you need to actually store <code>"\\\\"</code>.</p>", | |||
| "<p>In regular expressions, <code>\\w</code> stands for any alphabetical character, but to store it in a string in R you need <code>"\\w"</code>.</p>", | |||
| "<p>Inside <strong>RegExplain</strong>, however, standard regular expressions can be used so that you can easily copy patterns from other places. When you click on the <span class=\"btn btn-xs btn-primary\">Send RegEX to Console</span> button, the necessary extra <code>\\</code> will be included.</p>", | |||
| "<p>An extra backslash is still needed to match a literal <code>\\</code> in standard regular expressions. This means that you will need to enter <code>\\\\</code> in the <strong>RegEx</strong> tab, and the output to R will be <code>"\\\\\\\\"</code>.</p>", | |||
| "</div>") | |||
| "<p>An extra backslash is still needed to match a literal <code>\\</code> in standard regular expressions. This means that you will need to enter <code>\\\\</code> in the <strong>RegEx</strong> tab, and the output to R will be <code>"\\\\\\\\"</code>.</p>" | |||
| ) | |||
| source(system.file("shiny", "help_server.R", package = "regexplain"), local = TRUE) | |||
| @@ -1,4 +1,5 @@ | |||
| #' @importFrom dplyr "%>%" mutate filter group_by summarize select | |||
| #' @importFrom utils getFromNamespace installed.packages packageVersion | |||
| #' @importFrom rlang .data | |||
| #' @keywords internal | |||
| "_PACKAGE" | |||
| @@ -1,5 +1,5 @@ | |||
| --- | |||
| title: "regexplain" | |||
| title: "RegExplain" | |||
| output: github_document | |||
| --- | |||
| @@ -112,17 +112,17 @@ If you do find an issue, [please file an issue](https://github.com/gadenbuie/reg | |||
| #### Planned improvements | |||
| - Make better use of the opening view of **Help** tab to explain the gadget. | |||
| - **v0.1.6!** Make better use of the opening view of **Help** tab to explain the gadget. | |||
| Also add one or more additional tabs with an overview of regular expressions, | |||
| with links to R4DS and `vignette('regular-expressions', package = 'stringr')`. | |||
| Maybe also a **Try This** feature that sets the `text` and `pattern` with | |||
| regex challenges (possibly borrowed from R4DS). | |||
| - Add a global search option to the **Regex** tab. Groups would be lost, but I | |||
| can still highlight global matches. | |||
| - ~~Add a global search option to the **Regex** tab. Groups would be lost, but I | |||
| can still highlight global matches.~~ | |||
| - Add "flavors" menu to **Regex** tab. Automatically sets options to common flavors. | |||
| Mainly for clarity when switching between "base"" style and "tidyverse/stringr" defaults. | |||
| - ~~Add "flavors" menu to **Regex** tab. Automatically sets options to common flavors. | |||
| Mainly for clarity when switching between "base"" style and "tidyverse/stringr" defaults.~~ | |||
| - **Done in v0.1.5!** Add replacement functions somewhere. Maybe to **Output** tab with `g?sub` and | |||
| `str_replace(_all)?` as options with an additional "replacement" field that | |||
| @@ -1,4 +1,4 @@ | |||
| regexplain | |||
| RegExplain | |||
| ================ | |||
| <!-- [](commits/master) --> | |||
| @@ -8,7 +8,7 @@ regexplain | |||
| state and is being actively | |||
| developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) | |||
| [](https://cran.r-project.org/package=regexplain) | |||
| <!-- [](/commits/master) --> | |||
| <!-- [](/commits/master) --> | |||
| <!-- Links --> | |||
| @@ -122,19 +122,19 @@ with the fine packages this addin is built on. If you do find an issue, | |||
| #### Planned improvements | |||
| - Make better use of the opening view of **Help** tab to explain the | |||
| gadget. Also add one or more additional tabs with an overview of | |||
| regular expressions, with links to R4DS and | |||
| - **v0.1.6\!** Make better use of the opening view of **Help** tab to | |||
| explain the gadget. Also add one or more additional tabs with an | |||
| overview of regular expressions, with links to R4DS and | |||
| `vignette('regular-expressions', package = 'stringr')`. Maybe also a | |||
| **Try This** feature that sets the `text` and `pattern` with regex | |||
| challenges (possibly borrowed from R4DS). | |||
| - Add a global search option to the **Regex** tab. Groups would be | |||
| lost, but I can still highlight global matches. | |||
| - ~~Add a global search option to the **Regex** tab. Groups would be | |||
| lost, but I can still highlight global matches.~~ | |||
| - Add “flavors” menu to **Regex** tab. Automatically sets options to | |||
| - ~~Add “flavors” menu to **Regex** tab. Automatically sets options to | |||
| common flavors. Mainly for clarity when switching between “base”" | |||
| style and “tidyverse/stringr” defaults. | |||
| style and “tidyverse/stringr” defaults.~~ | |||
| - **Done in v0.1.5\!** Add replacement functions somewhere. Maybe to | |||
| **Output** tab with `g?sub` and `str_replace(_all)?` as options with | |||
| @@ -0,0 +1,16 @@ | |||
| % Generated by roxygen2: do not edit by hand | |||
| % Please edit documentation in R/help_ui.R | |||
| \name{generate_help_ui} | |||
| \alias{generate_help_ui} | |||
| \title{Generates Help Tab UI} | |||
| \usage{ | |||
| generate_help_ui(cheatsheet_only = TRUE) | |||
| } | |||
| \arguments{ | |||
| \item{cheatsheet_only}{If TRUE then returns just basic regex | |||
| explainer UI.} | |||
| } | |||
| \description{ | |||
| Generates Help Tab UI | |||
| } | |||
| \keyword{internal} | |||
| @@ -0,0 +1,15 @@ | |||
| % Generated by roxygen2: do not edit by hand | |||
| % Please edit documentation in R/regex_gadget.R | |||
| \name{get_templates} | |||
| \alias{get_templates} | |||
| \title{Loads Regex Pattern Templates} | |||
| \usage{ | |||
| get_templates() | |||
| } | |||
| \description{ | |||
| Sourced from \href{https://projects.lukehaas.me/regexhub}{Regex Hub} | |||
| and available at \url{https://github.com/lukehaas/RegexHub}. Copyright | |||
| Luke Haas licensed under the MIT license available at | |||
| \url{https://github.com/lukehaas/RegexHub/commit/3ab87b5a4fd2817b42e2e45dcf040d4f0164ea37}. | |||
| } | |||
| \keyword{internal} | |||
| @@ -2,7 +2,7 @@ | |||
| % Please edit documentation in R/regex_gadget.R | |||
| \name{regex_gadget} | |||
| \alias{regex_gadget} | |||
| \title{regexplain gadget} | |||
| \title{RegExplain gadget} | |||
| \usage{ | |||
| regex_gadget(text = NULL, start_page = if (is.null(text)) "Text" else | |||
| "RegEx") | |||
| @@ -14,5 +14,5 @@ regex_gadget(text = NULL, start_page = if (is.null(text)) "Text" else | |||
| \code{"Output"}, or \code{"Help"}} | |||
| } | |||
| \description{ | |||
| regexplain gadget | |||
| RegExplain gadget | |||
| } | |||