#' create teaching calendar in org-mode
#' @param outlinelist the course's outline line defined in R list
#' @param data teaching date created by gmdata::teach_date()
#' @param course the course name
#' @param teachdate the week name of teaching date,like 周三567
#' @param classtime the teaching time period, like 14:00-16:30
#' @param room the teaching classroom
#' @param class the class code, like AP4
#' @return org-mode calendar headlines
#' @export
#' @examples
#' outline <- list(学位论文写作指引="内容:学术论文的特征、如何选题、如何论证等。 阅读:《写作是一门艺术》",特征价格法="内容:特征价格法的原理、估价模型、软件实现等。 阅读:课件",层次分析法="内容:层次分析法的定义、应用与计算。 阅读:课件和相关论文。",模糊层次分析法="内容:模糊层次分析法定义、应用和计算 。 阅读:课件和相关论文",机器学习法1="内容:有监督学习算法 。 阅读:课件",机器学习法2="内容无监督学习算法: 。 阅读:课件")
#'data <- gmdata::teach_date("2017-03-02")
#'data2 <- data[1:6]
#'create_teaching_calendar(outline,data2,"valuation","Thurs89A","18:30-21:00","Y403","专硕")
create_teaching_calendar <- function(outlinelist, data, course, teachdate, classtime, room, class){
suppressWarnings(suppressPackageStartupMessages({
library(purrr)
library(dplyr)
}))
#name <- deparse(substitute(outlinelist))
name <- names(outlinelist)
data <- gsub("[年月]","-",data) %>% gsub("日","",.)
res <- 1:length(outlinelist) %>%
map2(data, ~paste0("*** NEXT week ",.x," ",name[.x],"@",course,"-",class,"-",teachdate,"@",room,"\n","\nSCHEDULED: <",.y," ",classtime,">\n",outlinelist[.x],"\n")) %>% unlist
return(cat(res,sep="\n"))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.