From 7ec7bf2c17f4ed3fe43c781ea508b41549597bd5 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Tue, 20 Aug 2024 11:39:30 +0200 Subject: [PATCH] ShinyLive to Shinylive; spelling --- DESCRIPTION | 4 +- NAMESPACE | 6 +- R/examplesShinyLive.R | 46 ++++---- R/parse_url.R | 4 +- README.md | 8 +- inst/WORDLIST | 6 ++ man/create_shinylive_url.Rd | 6 +- man/tag-examplesShinyLive.Rd | 36 +++---- tests/testthat/_snaps/examplesShinyLive.md | 8 +- tests/testthat/test-examplesShinyLive.R | 116 ++++++++++----------- 10 files changed, 123 insertions(+), 117 deletions(-) create mode 100644 inst/WORDLIST diff --git a/DESCRIPTION b/DESCRIPTION index f8351df..9fae1e4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: roxy.shinylive Title: A roxygen2 Extension for Shinylive -Version: 0.0.0.9000 +Version: 0.0.0.9001 Authors@R: c( person("Pawel Rucki", , , "pawel.rucki@roche.com", role = c("aut", "cre")), person("F. Hoffmann-La Roche AG", role = c("cph", "fnd")) @@ -36,5 +36,5 @@ Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.2 Config/testthat/edition: 3 Collate: - 'examplesShinyLive.R' + 'examplesShinylive.R' 'parse_url.R' diff --git a/NAMESPACE b/NAMESPACE index c641397..dfd57ae 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,8 +1,8 @@ # Generated by roxygen2: do not edit by hand -S3method(format,rd_section_examplesShinyLive) -S3method(roxygen2::roxy_tag_parse,roxy_tag_examplesShinyLive) -S3method(roxygen2::roxy_tag_rd,roxy_tag_examplesShinyLive) +S3method(format,rd_section_examplesShinylive) +S3method(roxygen2::roxy_tag_parse,roxy_tag_examplesShinylive) +S3method(roxygen2::roxy_tag_rd,roxy_tag_examplesShinylive) importFrom(glue,glue_data) importFrom(jsonlite,toJSON) importFrom(jsonlite,unbox) diff --git a/R/examplesShinyLive.R b/R/examplesShinyLive.R index 02cc7db..25208e4 100644 --- a/R/examplesShinyLive.R +++ b/R/examplesShinyLive.R @@ -1,9 +1,9 @@ -#' Custom `examplesShinyLive` tag. +#' Custom `examplesShinylive` tag. #' -#' This function generates a new section with ShinyLive links to the applications from this tag content. +#' This function generates a new section with Shinylive links to the applications from this tag content. #' If no code is provided then the code from the following `@examples` tag is used. #' -#' The application code must be executable inside ShinyLive. If the application code includes functions from your +#' The application code must be executable inside Shinylive. If the application code includes functions from your #' package, you must add `library()` beforehand. For more information, refer to the Decoration section #' on how to use and decorate existing examples. #' @@ -12,8 +12,8 @@ #' #' @section Decoration: #' -#' To avoid repetition between the `@examplesShinyLive` and `@examples` sections, there are special string literals -#' that provide access to the `@examples` content from within `@examplesShinyLive`. +#' To avoid repetition between the `@examplesShinylive` and `@examples` sections, there are special string literals +#' that provide access to the `@examples` content from within `@examplesShinylive`. #' These literals should be used as expressions embraced with `{{ }}`, which are then interpolated using #' `glue::glue_data(..., .open = "{{", .close = "}}")`. #' @@ -23,26 +23,26 @@ #' * `"{{ next_example }}"` - "raw" element of the next example #' * `"{{ prev_example }}"` - "raw" element of the previous example #' -#' This allows you to access and decorate existing example code to create executable application code for ShinyLive. +#' This allows you to access and decorate existing example code to create executable application code for Shinylive. #' Refer to the examples section for possible use cases. #' -#' @name tag-examplesShinyLive +#' @name tag-examplesShinylive #' #' @usage -#' #' @examplesShinyLive${1:# example code (optional)} +#' #' @examplesShinylive${1:# example code (optional)} #' #' @examples #' # As a part of documentation: #' #' # basic example: #' #' (docs) -#' #' @examplesShinyLive +#' #' @examplesShinylive #' #' @examples #' #' (example code) #' #' # using keywords: #' #' (docs) -#' #' @examplesShinyLive +#' #' @examplesShinylive #' #' foo <- 1 #' #' {{ next_example }} #' #' bar <- 2 @@ -51,7 +51,7 @@ #' #' # A typical example would be: #' #' (docs) -#' #' @examplesShinyLive +#' #' @examplesShinylive #' #' library() #' #' interactive <- function() TRUE #' #' {{ next_example }} @@ -63,10 +63,10 @@ #' #' # multiple apps: #' #' (docs) -#' #' @examplesShinyLive +#' #' @examplesShinylive #' #' @examples #' #' (your example app 1) -#' #' @examplesShinyLive +#' #' @examplesShinylive #' #' @examples #' #' (your example app 2) #' @@ -74,18 +74,18 @@ #' #' (docs) #' #' @examples #' #' (your example code - skipped) -#' #' @examplesShinyLive +#' #' @examplesShinylive #' #' @examples #' #' (your example code - included) #' #' # multiple apps with keywords: #' #' (docs) -#' #' @examplesShinyLive +#' #' @examplesShinylive #' #' x <- 1 #' #' {{ next_example }} #' #' @examples #' #' (your example app 1) -#' #' @examplesShinyLive +#' #' @examplesShinylive #' #' y <- 1 #' #' {{ next_example }} #' #' @examples @@ -93,11 +93,11 @@ NULL #' @noRd -#' @exportS3Method roxygen2::roxy_tag_parse roxy_tag_examplesShinyLive +#' @exportS3Method roxygen2::roxy_tag_parse roxy_tag_examplesShinylive #' @importFrom glue glue_data #' @importFrom stringr str_trim #' @importFrom roxygen2 warn_roxy_tag -roxy_tag_parse.roxy_tag_examplesShinyLive <- function(x) { +roxy_tag_parse.roxy_tag_examplesShinylive <- function(x) { if (stringr::str_trim(x$raw) == "") { x$raw <- "{{ next_example }}" } @@ -150,15 +150,15 @@ roxy_tag_parse.roxy_tag_examplesShinyLive <- function(x) { } #' @noRd -#' @exportS3Method roxygen2::roxy_tag_rd roxy_tag_examplesShinyLive +#' @exportS3Method roxygen2::roxy_tag_rd roxy_tag_examplesShinylive #' @importFrom roxygen2 rd_section -roxy_tag_rd.roxy_tag_examplesShinyLive <- function(x, base_path, env) { - roxygen2::rd_section("examplesShinyLive", x$val) +roxy_tag_rd.roxy_tag_examplesShinylive <- function(x, base_path, env) { + roxygen2::rd_section("examplesShinylive", x$val) } #' @noRd -#' @exportS3Method format rd_section_examplesShinyLive -format.rd_section_examplesShinyLive <- function(x, ...) { +#' @exportS3Method format rd_section_examplesShinylive +format.rd_section_examplesShinylive <- function(x, ...) { paste0( "\\section{Run examples in Shinylive}{\n", "\\itemize{\n", diff --git a/R/parse_url.R b/R/parse_url.R index ee8a4e0..25c3b94 100644 --- a/R/parse_url.R +++ b/R/parse_url.R @@ -1,10 +1,10 @@ -#' Creates shinylive url for the app code. +#' Creates Shinylive url for the app code. #' #' @importFrom jsonlite unbox toJSON #' @importFrom lzstring compressToEncodedURIComponent #' #' @param code (`character(1)`) A string with app code. -#' @return (`character(1)`) ShinyLive app url. +#' @return (`character(1)`) Shinylive app url. create_shinylive_url <- function(code) { # implementation based on "Create ShinyLive Link" feature of Shiny VSCode extension # https://github.com/posit-dev/shiny-vscode/blob/80560bf36d516ff89dffe88bd9a28cee9edd4d43/src/shinylive.ts#L499 diff --git a/README.md b/README.md index a6e6dd9..212fb19 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This package provides a `roxygen2` extension that automatically takes the exampl ## Install ```r -devtools::install_github("insightsengineering/roxy.shinylive") +pak::pak("insightsengineering/roxy.shinylive") ``` ## Usage @@ -20,9 +20,9 @@ Roxygen: list(markdown = TRUE, packages = c("roxy.shinylive")) Then in your package documentation: ```r #' (docs) -#' @examplesShinyLive +#' @examplesShinylive #' @examples -#' (example code with shiny App) +#' (example code with a Shiny app) ``` Which would produce a following output in your documentation: @@ -37,4 +37,4 @@ Which would produce a following output in your documentation: } ``` -See the pacakge documentation for more details. +See the package documentation for more details. diff --git a/inst/WORDLIST b/inst/WORDLIST new file mode 100644 index 0000000..55883b0 --- /dev/null +++ b/inst/WORDLIST @@ -0,0 +1,6 @@ +Shinylive +WebR +installable +roxy +roxygen +shinylive diff --git a/man/create_shinylive_url.Rd b/man/create_shinylive_url.Rd index 8886a5d..6175fcd 100644 --- a/man/create_shinylive_url.Rd +++ b/man/create_shinylive_url.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/parse_url.R \name{create_shinylive_url} \alias{create_shinylive_url} -\title{Creates shinylive url for the app code.} +\title{Creates Shinylive url for the app code.} \usage{ create_shinylive_url(code) } @@ -10,8 +10,8 @@ create_shinylive_url(code) \item{code}{(\code{character(1)}) A string with app code.} } \value{ -(\code{character(1)}) ShinyLive app url. +(\code{character(1)}) Shinylive app url. } \description{ -Creates shinylive url for the app code. +Creates Shinylive url for the app code. } diff --git a/man/tag-examplesShinyLive.Rd b/man/tag-examplesShinyLive.Rd index 9ce7f45..e345dc1 100644 --- a/man/tag-examplesShinyLive.Rd +++ b/man/tag-examplesShinyLive.Rd @@ -1,17 +1,17 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/examplesShinyLive.R -\name{tag-examplesShinyLive} -\alias{tag-examplesShinyLive} -\title{Custom \code{examplesShinyLive} tag.} +% Please edit documentation in R/examplesShinylive.R +\name{tag-examplesShinylive} +\alias{tag-examplesShinylive} +\title{Custom \code{examplesShinylive} tag.} \usage{ -#' @examplesShinyLive${1:# example code (optional)} +#' @examplesShinylive${1:# example code (optional)} } \description{ -This function generates a new section with ShinyLive links to the applications from this tag content. +This function generates a new section with Shinylive links to the applications from this tag content. If no code is provided then the code from the following \verb{@examples} tag is used. } \details{ -The application code must be executable inside ShinyLive. If the application code includes functions from your +The application code must be executable inside Shinylive. If the application code includes functions from your package, you must add \verb{library()} beforehand. For more information, refer to the Decoration section on how to use and decorate existing examples. @@ -21,8 +21,8 @@ See \href{https://docs.r-wasm.org/webr/latest/packages.html}{this article} for m \section{Decoration}{ -To avoid repetition between the \verb{@examplesShinyLive} and \verb{@examples} sections, there are special string literals -that provide access to the \verb{@examples} content from within \verb{@examplesShinyLive}. +To avoid repetition between the \verb{@examplesShinylive} and \verb{@examples} sections, there are special string literals +that provide access to the \verb{@examples} content from within \verb{@examplesShinylive}. These literals should be used as expressions embraced with \code{{{ }}}, which are then interpolated using \code{glue::glue_data(..., .open = "{{", .close = "}}")}. @@ -34,7 +34,7 @@ The following keywords are available: \item \code{"{{ prev_example }}"} - "raw" element of the previous example } -This allows you to access and decorate existing example code to create executable application code for ShinyLive. +This allows you to access and decorate existing example code to create executable application code for Shinylive. Refer to the examples section for possible use cases. } @@ -43,13 +43,13 @@ Refer to the examples section for possible use cases. # basic example: #' (docs) -#' @examplesShinyLive +#' @examplesShinylive #' @examples #' (example code) # using keywords: #' (docs) -#' @examplesShinyLive +#' @examplesShinylive #' foo <- 1 #' {{ next_example }} #' bar <- 2 @@ -58,7 +58,7 @@ Refer to the examples section for possible use cases. # A typical example would be: #' (docs) -#' @examplesShinyLive +#' @examplesShinylive #' library() #' interactive <- function() TRUE #' {{ next_example }} @@ -70,10 +70,10 @@ Refer to the examples section for possible use cases. # multiple apps: #' (docs) -#' @examplesShinyLive +#' @examplesShinylive #' @examples #' (your example app 1) -#' @examplesShinyLive +#' @examplesShinylive #' @examples #' (your example app 2) @@ -81,18 +81,18 @@ Refer to the examples section for possible use cases. #' (docs) #' @examples #' (your example code - skipped) -#' @examplesShinyLive +#' @examplesShinylive #' @examples #' (your example code - included) # multiple apps with keywords: #' (docs) -#' @examplesShinyLive +#' @examplesShinylive #' x <- 1 #' {{ next_example }} #' @examples #' (your example app 1) -#' @examplesShinyLive +#' @examplesShinylive #' y <- 1 #' {{ next_example }} #' @examples diff --git a/tests/testthat/_snaps/examplesShinyLive.md b/tests/testthat/_snaps/examplesShinyLive.md index 3126614..21a9616 100644 --- a/tests/testthat/_snaps/examplesShinyLive.md +++ b/tests/testthat/_snaps/examplesShinyLive.md @@ -1,14 +1,14 @@ -# examplesShinyLive tag - errors - missing @examples +# examplesShinylive tag - errors - missing @examples Code block <- roxygen2::parse_text(text)[[1]] Message - x :8: @examplesShinyLive requires a value. + x :8: @examplesShinylive requires a value. -# examplesShinyLive tag - keywords - error when parsing with glue +# examplesShinylive tag - keywords - error when parsing with glue Code block <- roxygen2::parse_text(text)[[1]] Message - x :8: @examplesShinyLive failed to interpolate the content. + x :8: @examplesShinylive failed to interpolate the content. diff --git a/tests/testthat/test-examplesShinyLive.R b/tests/testthat/test-examplesShinyLive.R index edbebc1..85b3b93 100644 --- a/tests/testthat/test-examplesShinyLive.R +++ b/tests/testthat/test-examplesShinyLive.R @@ -1,4 +1,4 @@ -test_that("examplesShinyLive tag - errors - missing @examples", { +test_that("examplesShinylive tag - errors - missing @examples", { text <- " #' This is a title #' @@ -6,16 +6,16 @@ test_that("examplesShinyLive tag - errors - missing @examples", { #' #' @param x,y A number #' @export - #' @examplesShinyLive + #' @examplesShinylive f <- function(x, y) x + y " expect_snapshot( block <- roxygen2::parse_text(text)[[1]] ) - expect_false(roxygen2::block_has_tags(block, "examplesShinyLive")) + expect_false(roxygen2::block_has_tags(block, "examplesShinylive")) }) -test_that("examplesShinyLive tag - single occurrence", { +test_that("examplesShinylive tag - single occurrence", { text <- " #' This is a title #' @@ -23,67 +23,67 @@ test_that("examplesShinyLive tag - single occurrence", { #' #' @param x,y A number #' @export - #' @examplesShinyLive + #' @examplesShinylive #' @examples #' f(1, 2) f <- function(x, y) x + y " expect_silent(block <- roxygen2::parse_text(text)[[1]]) - expect_true(roxygen2::block_has_tags(block, "examplesShinyLive")) + expect_true(roxygen2::block_has_tags(block, "examplesShinylive")) expect_length( - roxygen2::block_get_tags(block, "examplesShinyLive"), + roxygen2::block_get_tags(block, "examplesShinylive"), 1 ) expect_identical( - roxygen2::block_get_tag(block, "examplesShinyLive")$raw, + roxygen2::block_get_tag(block, "examplesShinylive")$raw, "\nf(1, 2)" ) expect_identical( - roxygen2::block_get_tag_value(block, "examplesShinyLive"), + roxygen2::block_get_tag_value(block, "examplesShinylive"), "https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAHQgDMAKARlwAIAmASjAF8BdIA" ) }) -test_that("examplesShinyLive tag - multiple occurrences", { +test_that("examplesShinylive tag - multiple occurrences", { text <- " #' This is a title #' #' This is the description. #' #' @param x,y A number - #' @examplesShinyLive + #' @examplesShinylive #' @examples #' f(1, 2) - #' @examplesShinyLive + #' @examplesShinylive #' @examples #' f(1, 3) f <- function(x, y) x + y " expect_silent(block <- roxygen2::parse_text(text)[[1]]) - expect_true(roxygen2::block_has_tags(block, "examplesShinyLive")) + expect_true(roxygen2::block_has_tags(block, "examplesShinylive")) expect_length( - roxygen2::block_get_tags(block, "examplesShinyLive"), + roxygen2::block_get_tags(block, "examplesShinylive"), 2 ) expect_identical( - roxygen2::block_get_tags(block, "examplesShinyLive")[[1]]$raw, + roxygen2::block_get_tags(block, "examplesShinylive")[[1]]$raw, "\nf(1, 2)" ) expect_identical( - roxygen2::block_get_tags(block, "examplesShinyLive")[[2]]$raw, + roxygen2::block_get_tags(block, "examplesShinylive")[[2]]$raw, "\nf(1, 3)" ) expect_identical( - roxygen2::block_get_tags(block, "examplesShinyLive")[[1]]$val, + roxygen2::block_get_tags(block, "examplesShinylive")[[1]]$val, "https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAHQgDMAKARlwAIAmASjAF8BdIA" ) expect_identical( - roxygen2::block_get_tags(block, "examplesShinyLive")[[2]]$val, + roxygen2::block_get_tags(block, "examplesShinylive")[[2]]$val, "https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAHQgDMAKARlwAIBmASjAF8BdIA" ) }) -test_that("examplesShinyLive tag - don't use previous example code", { +test_that("examplesShinylive tag - don't use previous example code", { text <- " #' This is a title #' @@ -94,28 +94,28 @@ test_that("examplesShinyLive tag - don't use previous example code", { #' #' @examples #' x <- 'this is excluded' - #' @examplesShinyLive + #' @examplesShinylive #' @examples #' f(1, 2) f <- function(x, y) x + y " expect_silent(block <- roxygen2::parse_text(text)[[1]]) - expect_true(roxygen2::block_has_tags(block, "examplesShinyLive")) + expect_true(roxygen2::block_has_tags(block, "examplesShinylive")) expect_length( - roxygen2::block_get_tags(block, "examplesShinyLive"), + roxygen2::block_get_tags(block, "examplesShinylive"), 1 ) expect_identical( - roxygen2::block_get_tag(block, "examplesShinyLive")$raw, + roxygen2::block_get_tag(block, "examplesShinylive")$raw, "\nf(1, 2)" ) expect_identical( - roxygen2::block_get_tag_value(block, "examplesShinyLive"), + roxygen2::block_get_tag_value(block, "examplesShinylive"), "https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAHQgDMAKARlwAIAmASjAF8BdIA" ) }) -test_that("examplesShinyLive tag - keywords - {{next_example}}", { +test_that("examplesShinylive tag - keywords - {{next_example}}", { text <- " #' This is a title #' @@ -124,29 +124,29 @@ test_that("examplesShinyLive tag - keywords - {{next_example}}", { #' @param x,y A number #' @export #' - #' @examplesShinyLive + #' @examplesShinylive #' {{ next_example }} #' @examples #' f(1, 2) f <- function(x, y) x + y " expect_silent(block <- roxygen2::parse_text(text)[[1]]) - expect_true(roxygen2::block_has_tags(block, "examplesShinyLive")) + expect_true(roxygen2::block_has_tags(block, "examplesShinylive")) expect_length( - roxygen2::block_get_tags(block, "examplesShinyLive"), + roxygen2::block_get_tags(block, "examplesShinylive"), 1 ) expect_identical( - roxygen2::block_get_tag(block, "examplesShinyLive")$raw, + roxygen2::block_get_tag(block, "examplesShinylive")$raw, "\nf(1, 2)" ) expect_identical( - roxygen2::block_get_tag_value(block, "examplesShinyLive"), + roxygen2::block_get_tag_value(block, "examplesShinylive"), "https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAHQgDMAKARlwAIAmASjAF8BdIA" ) }) -test_that("examplesShinyLive tag - keywords - {{prev_example}}", { +test_that("examplesShinylive tag - keywords - {{prev_example}}", { text <- " #' This is a title #' @@ -157,27 +157,27 @@ test_that("examplesShinyLive tag - keywords - {{prev_example}}", { #' #' @examples #' f(1, 2) - #' @examplesShinyLive + #' @examplesShinylive #' {{ prev_example }} f <- function(x, y) x + y " expect_silent(block <- roxygen2::parse_text(text)[[1]]) - expect_true(roxygen2::block_has_tags(block, "examplesShinyLive")) + expect_true(roxygen2::block_has_tags(block, "examplesShinylive")) expect_length( - roxygen2::block_get_tags(block, "examplesShinyLive"), + roxygen2::block_get_tags(block, "examplesShinylive"), 1 ) expect_identical( - roxygen2::block_get_tag(block, "examplesShinyLive")$raw, + roxygen2::block_get_tag(block, "examplesShinylive")$raw, "\nf(1, 2)" ) expect_identical( - roxygen2::block_get_tag_value(block, "examplesShinyLive"), + roxygen2::block_get_tag_value(block, "examplesShinylive"), "https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAHQgDMAKARlwAIAmASjAF8BdIA" ) }) -test_that("examplesShinyLive tag - keywords - {{examples}}", { +test_that("examplesShinylive tag - keywords - {{examples}}", { text <- " #' This is a title #' @@ -188,27 +188,27 @@ test_that("examplesShinyLive tag - keywords - {{examples}}", { #' #' @examples #' f(1, 2) - #' @examplesShinyLive + #' @examplesShinylive #' {{ examples[[1]] }} f <- function(x, y) x + y " expect_silent(block <- roxygen2::parse_text(text)[[1]]) - expect_true(roxygen2::block_has_tags(block, "examplesShinyLive")) + expect_true(roxygen2::block_has_tags(block, "examplesShinylive")) expect_length( - roxygen2::block_get_tags(block, "examplesShinyLive"), + roxygen2::block_get_tags(block, "examplesShinylive"), 1 ) expect_identical( - roxygen2::block_get_tag(block, "examplesShinyLive")$raw, + roxygen2::block_get_tag(block, "examplesShinylive")$raw, "\nf(1, 2)" ) expect_identical( - roxygen2::block_get_tag_value(block, "examplesShinyLive"), + roxygen2::block_get_tag_value(block, "examplesShinylive"), "https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAHQgDMAKARlwAIAmASjAF8BdIA" ) }) -test_that("examplesShinyLive tag - keywords - {{tags_examples}}", { +test_that("examplesShinylive tag - keywords - {{tags_examples}}", { text <- " #' This is a title #' @@ -219,27 +219,27 @@ test_that("examplesShinyLive tag - keywords - {{tags_examples}}", { #' #' @examples #' f(1, 2) - #' @examplesShinyLive + #' @examplesShinylive #' {{ tags_examples[[1]]$raw }} f <- function(x, y) x + y " expect_silent(block <- roxygen2::parse_text(text)[[1]]) - expect_true(roxygen2::block_has_tags(block, "examplesShinyLive")) + expect_true(roxygen2::block_has_tags(block, "examplesShinylive")) expect_length( - roxygen2::block_get_tags(block, "examplesShinyLive"), + roxygen2::block_get_tags(block, "examplesShinylive"), 1 ) expect_identical( - roxygen2::block_get_tag(block, "examplesShinyLive")$raw, + roxygen2::block_get_tag(block, "examplesShinylive")$raw, "\nf(1, 2)" ) expect_identical( - roxygen2::block_get_tag_value(block, "examplesShinyLive"), + roxygen2::block_get_tag_value(block, "examplesShinylive"), "https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAHQgDMAKARlwAIAmASjAF8BdIA" ) }) -test_that("examplesShinyLive tag - keywords - error when parsing with glue", { +test_that("examplesShinylive tag - keywords - error when parsing with glue", { text <- " #' This is a title #' @@ -247,19 +247,19 @@ test_that("examplesShinyLive tag - keywords - error when parsing with glue", { #' #' @param x,y A number #' @export - #' @examplesShinyLive + #' @examplesShinylive #' {{ keyword_not_found }} f <- function(x, y) x + y " expect_snapshot( block <- roxygen2::parse_text(text)[[1]] ) - expect_false(roxygen2::block_has_tags(block, "examplesShinyLive")) + expect_false(roxygen2::block_has_tags(block, "examplesShinylive")) }) -test_that("examplesShinyLive tag - decorate using {{next_example}} keyword", { +test_that("examplesShinylive tag - decorate using {{next_example}} keyword", { text <- " #' This is a title #' @@ -270,7 +270,7 @@ test_that("examplesShinyLive tag - decorate using {{next_example}} keyword", { #' #' @example #' x <- 'this is excluded' - #' @examplesShinyLive + #' @examplesShinylive #' x1 <- 1 # this is included #' {{ next_example }} #' x2 <- 2 # this is included @@ -279,17 +279,17 @@ test_that("examplesShinyLive tag - decorate using {{next_example}} keyword", { f <- function(x, y) x + y " expect_silent(block <- roxygen2::parse_text(text)[[1]]) - expect_true(roxygen2::block_has_tags(block, "examplesShinyLive")) + expect_true(roxygen2::block_has_tags(block, "examplesShinylive")) expect_length( - roxygen2::block_get_tags(block, "examplesShinyLive"), + roxygen2::block_get_tags(block, "examplesShinylive"), 1 ) expect_identical( - roxygen2::block_get_tag(block, "examplesShinyLive")$raw, + roxygen2::block_get_tag(block, "examplesShinylive")$raw, "x1 <- 1 # this is included\n\nf(1, 2)\nx2 <- 2 # this is included" ) expect_identical( - roxygen2::block_get_tag_value(block, "examplesShinyLive"), - "https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMADwEYACAHgFp6GBie0gCwEsBnegKEQCAGwCuAEzhSAOhAUAzABS1c9AEwBKBdU1NWBzj2FnRkmVLABfALpA" + roxygen2::block_get_tag_value(block, "examplesShinylive"), + "https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMADwEYACAHgFp6GBie0gCwEsBnegKEQCAGwCuAEzhSAOhAUAzABS1c9AEwBKBdU1NWBzj2FnRkmVLABfALpA" # nolint: line_length_linter. ) })