| #' Posterdown HTML format (using pagedown::poster_relaxed) |
| #' |
| #' @inheritParams pagedown::poster_relaxed |
| #' @param ... Additional arguments to `rmarkdown::html_document` |
| #' |
| #' @return R Markdown output format to pass to |
| #' [rmarkdown::render()] |
| #' |
| #'@examples |
| #'\donttest{ |
| #'file <- file.path(tempdir(),"foo.rmd") |
| #'rmarkdown::draft(file, template="posterdown_html", package="posterdown") |
| #'} |
| #' |
| #' @export |
| posterdown_html <- function(..., |
| template = find_resource("posterdown_html", "template.html"), |
| css = NULL) { |
| pagedown::poster_relaxed(..., css = css, template = template) |
| } |
| |
| #' Posterdown IDS-CD based on HTML format (using pagedown::poster_relaxed) |
| #' |
| #' @inheritParams pagedown::poster_relaxed |
| #' @param ... Additional arguments to `rmarkdown::html_document` |
| #' |
| #' @return R Markdown output format to pass to |
| #' [rmarkdown::render()] |
| #' |
| #'@examples |
| #'\donttest{ |
| #'file <- file.path(tempdir(),"foo.rmd") |
| #'rmarkdown::draft(file, template="posterdown_ids", package="posterdown") |
| #'} |
| #' |
| #' @description The output format `poster_ids()` mimics the IDS Mannheim |
| #' corporate design posters. |
| #' @rdname posterdown_html |
| #' @export |
| posterdown_ids <- function(..., |
| template = find_resource("posterdown_ids", "template.html"), |
| css = NULL) { |
| pagedown::poster_relaxed(..., css = css, template = template) |
| } |
| |
| #' @description The output format `poster_betterland()` mimics the style of the |
| #' BetterPoster movement from twitter. |
| #' @rdname posterdown_html |
| #' @export |
| posterdown_betterland <- function(..., |
| template = find_resource("posterdown_betterland", "template.html"), |
| css = NULL) { |
| pagedown::poster_relaxed(..., css = css, template = template) |
| } |
| |
| #' @description The output format `poster_betterport()` mimics the style of the |
| #' BetterPoster movement from twitter. |
| #' @rdname posterdown_html |
| #' @export |
| posterdown_betterport <- function(..., |
| template = find_resource("posterdown_betterport", "template.html"), |
| css = NULL) { |
| pagedown::poster_relaxed(..., css = css, template = template) |
| } |
| |
| #' @description Print html code for a linked qr code to the given url |
| #' @importFrom qrcode add_logo qr_code generate_svg |
| #' @export |
| qrlink <- function(url, logo = NULL) { |
| tmp <- tempfile(fileext = ".svg") |
| qrcode <- qrcode::qr_code(url, ecl = if(is.null(logo)) "L" else "H") |
| if(!is.null(logo)) { |
| qrcode <- qrcode::add_logo(qrcode, logo, ecl = "L") |
| } |
| qrcode::generate_svg(qrcode, tmp, show = FALSE) |
| return(paste0( sprintf('<a class="qrcode" href="%s"><img class="qrcode">', url), |
| gsub("\r?\n|\r", "", readChar(tmp, 1e5)), |
| '</img></a>' |
| )) |
| } |
| |