-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change internal handling of JavaScript libraries. Organize example fi…
…les. Fix small bug (default CSS set to wrong default option). Rename functions.
- Loading branch information
Showing
42 changed files
with
926 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,11 +23,9 @@ Imports: | |
juicyjuice, | ||
knitr, | ||
markdown, | ||
readxl, | ||
rlang, | ||
rvest, | ||
sass, | ||
stringr, | ||
whisker, | ||
xfun, | ||
xml2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
const <- list() | ||
|
||
const$jquery <- "@npm/jquery@3.7.0/dist/jquery.min.js" | ||
|
||
const$jquery_modal <- "@npm/jquery-modal@0.9.2/jquery.modal.min.js" | ||
|
||
const$juicedown_modal <- | ||
"https://kenjisato.github.io/resources/juicedown/js/modal.js" | ||
|
||
const$juicedown_anki <- | ||
"https://kenjisato.github.io/resources/juicedown/js/anki.js" | ||
|
||
const$juicedown_css_footnote <- | ||
"https://kenjisato.github.io/resources/juicedown/css/highlightfootnote.css" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
|
||
jquery <- function(){ | ||
|
||
jq <- if (the$jquery %||% FALSE) { | ||
# the$jquery is TRUE if this function has been already called. | ||
# NULL means FALSE, so go to else block... | ||
NULL | ||
} else { | ||
the$jquery <- TRUE | ||
'<script | ||
src="https://code.jquery.com/jquery-3.7.0.slim.min.js" | ||
integrity="sha256-tG5mcZUtJsZvyKAxYLVXrmjKBVLd6VpVccqz/r4ypFE=" | ||
crossorigin="anonymous"></script>' | ||
the$js <- c(the$js, const$jquery) | ||
} | ||
jq | ||
invisible() | ||
} | ||
|
||
jquery_modal <- function() { | ||
jq <- jquery() | ||
jqm <- if (the$jquery_modal %||% FALSE) { | ||
# the$jquery_modal is TRUE if this function has been already called. | ||
# NULL means FALSE, so go to else block... | ||
NULL | ||
} else { | ||
the$jquery_modal <- TRUE | ||
c( | ||
jq, | ||
'<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.js"></script>', | ||
'<script src="https://kenjisato.github.io/omuecon/inst/js/modal.js"></script>' | ||
) | ||
the$js <- c(the$js, const$jquery_modal, const$juicedown_modal) | ||
} | ||
paste(jqm, collapse = "\n") | ||
invisible() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,42 @@ | ||
|
||
juicedown_example <- function(path = NULL) { | ||
if (is.null(path)) { | ||
#' List example files | ||
#' | ||
#' @description | ||
#' List example files for the package. Show the path when the exact name is given. | ||
#' | ||
#' @details | ||
#' The package sample files are organized under samples directory like so: | ||
#' | ||
#' samples/ | ||
#' ├── from-html/ | ||
#' │ └── sample.html | ||
#' └── include/ | ||
#' ├── pic/ | ||
#' └── sample.Rmd | ||
#' | ||
#' * `juicedown_example()` is equivalent to `ls samples`, | ||
#' * `juicedown_example("from-html")` is to `ls samples/from-html`, and | ||
#' * `juicedown_example("from-html", "sample.html")` shows the full path. | ||
#' | ||
#' @param name character. A single string for example name. | ||
#' @param file character. A single string for the main file. | ||
#' | ||
#' @return character. A list of example files or a path string to each example file. | ||
#' @export | ||
#' | ||
#' @examples | ||
#' juicedown_example() | ||
#' juicedown_example("from-html") | ||
#' juicedown_example("from-html", "sample.html") | ||
#' | ||
juicedown_example <- function(name = NULL, file = NULL) { | ||
if (is.null(name)) { | ||
list.files(pkg_file("samples")) | ||
} else { | ||
pkg_file("samples", path) | ||
if (is.null(file)) { | ||
list.files(pkg_file("samples", name)) | ||
} else { | ||
pkg_file("samples", name, file) | ||
} | ||
} | ||
} |
Oops, something went wrong.