Skip to content

Commit 0d776f9

Browse files
committed
Recognize Shiny
1 parent c818540 commit 0d776f9

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

Diff for: DESCRIPTION

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: gm
22
Type: Package
33
Title: Generate Music Easily and Show Them Anywhere
4-
Version: 1.0.3
4+
Version: 1.0.4
55
Author: Renfei Mao
66
Maintainer: Renfei Mao <[email protected]>
77
Description: Provides a simple and intuitive high-level language, with which
@@ -30,6 +30,7 @@ Imports:
3030
MASS,
3131
rlang,
3232
rstudioapi,
33+
shiny,
3334
stringr,
3435
utils
3536
Roxygen: list(markdown = TRUE)

Diff for: NEWS.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# gm 1.0.4
2+
3+
* Recognize Shiny apps.
4+
5+
16
# gm 1.0.3
27

38
* Change default score margin to 0.

Diff for: R/external.R

+5-3
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ get_show_context <- function() {
293293
if (isTRUE(getOption('knitr.in.progress'))) {
294294
# check if knit to pdf or word
295295
ifelse(knitr::is_html_output(), "rmd", "rmd_other")
296+
} else if (shiny::isRunning()) {
297+
"shiny"
296298
} else if (rstudioapi::isAvailable()) {
297299
"rstudio"
298300
} else if (is_jupyter()) {
@@ -322,7 +324,7 @@ show_musicxml <- function(musicxml, to, musescore) {
322324
} else {
323325
content <- generate_show_content(name_path, to, context)
324326

325-
if (context %in% c("rmd", "jupyter")) {
327+
if (context %in% c("rmd", "jupyter", "shiny")) {
326328
content
327329

328330
} else {
@@ -401,8 +403,8 @@ generate_file_path <- function(name_path, format, context) {
401403
file_path %<>% basename()
402404
}
403405

404-
# use data URL in R Markdown documents and Jupyter Notebooks
405-
if (context %in% c("jupyter", "rmd")) {
406+
# use data URL in R Markdown documents, Jupyter Notebooks and Shiny apps
407+
if (context %in% c("jupyter", "rmd", "shiny")) {
406408
file_path %<>% {base64enc::dataURI(file = .)}
407409
}
408410

0 commit comments

Comments
 (0)