options(width = 40) knitr::opts_chunk[["set"]](tidy = FALSE) set.seed(13224) library("examiner") library("stringr") tpl_problem <- str_c("{{{text}}}", "\n", "{{{answers}}}", sep = "\n") tpl_answerlist <- str_c("{{#answers}}", "1. {{{text}}}", "{{/answers}}", sep = "\n") tpl_problemset <- str_c("{{{pretext}}}\n", "{{#problems}}", "{{{.}}}", "{{/problems}}", "\n{{{posttext}}}", sep = "\n") tpl_problemblock <- str_c("{{{pretext}}}\n", "{{#problems}}", "{{{.}}}", "{{/problems}}", "{{{posttext}}}\n", sep = "\n")
problems <- problemset_from_yaml(system.file("yaml/questions2.yaml", package = "examiner")) cat(format(problems, tpl_answerlist = tpl_answerlist, tpl_problemset = tpl_problemset, tpl_problemblock = tpl_problemblock, tpl_problem = tpl_problem))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.