From 3b65091160ad20b617583f51ff893e6915d0b63b Mon Sep 17 00:00:00 2001 From: Elin Waring Date: Fri, 2 Sep 2016 12:14:53 -0400 Subject: [PATCH] Add video and figure handling. --- R/lesson_to_html.R | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/R/lesson_to_html.R b/R/lesson_to_html.R index 1c02a0c..e865311 100644 --- a/R/lesson_to_html.R +++ b/R/lesson_to_html.R @@ -8,6 +8,12 @@ makechunk_silent <- function(item) { paste0(out, collapse="\n") } +makelink <- function(item) { + out <- c("[link](", item, ")") + paste0(out, collapse="\n") +} + + #' @importFrom stringr str_split str_trim makemult <- function(item) { answers <- unlist(str_split(item, ";")) @@ -53,6 +59,16 @@ makemd.script <- function(unit) { sep = "\n\n") } +makemd.video <- function(unit) { + paste(unit[['Output']],makelink(unit[['VideoLink']]), + sep="\n\n") +} + +makemd.figure <- function(unit) { + paste(unit[['Output']], "Image not displayed", + sep="\n\n") +} + #' Turn a swirl lesson into a pretty webpage #' #' Create an easily shareable HTML version of your swirl lesson. This function