html_e2m: html_e2m

View source: R/html_e2m.R

html_e2mR Documentation

html_e2m

Description

Creates an HTML page with all the contents of XML tags whose names match pattern.

The default is to show the contents of all XML tags. The HTML page is stored in the HTML file name.

The default name=NULL creates a temporary file. If the name does not end in code.html, then a .html is appended.

If browseURL=TRUE (default) then the HTML page will be displayed in the browser.

If necessary the contents of XML tags are concatenated with "\n". For single XML tags this can be changed, e.g. merge=list("questionlist"="<br>" leads to the fact that for the XML tag <questionlist>...</questionlist>) "<br>" is used instead of "\n".

Usage

html_e2m(
  exam,
  name = NULL,
  pattern = ".",
  mathjax = TRUE,
  browseURL = TRUE,
  overwrite = FALSE,
  header = 2,
  merge = list(questionlist = "<br>"),
  png = TRUE
)

Arguments

exam

list: return list from exam2moodle

name

character: name of HTML file (default: NULL)

pattern

character: string containing a regular expression to match list elements (default: .)

mathjax

logical: should MathJax be loaded (default: TRUE)

browseURL

logical: should the generated HTML shown (default: TRUE)

overwrite

logical: should the HTML file overwritten, if it exists (default: FALSE)

header

integer: at which level of the list a <h2>...</h2> element should be included (default: 2)

merge

list: should elements with .XXXXnn at the end merged (default: list('questionlist'="<br>"))

png

logical: if a entry ends with .png then the function will try to embed the PNG in the output

Value

invisibly the names of list elements in the HTML file

See Also

The aim is similar to exams:::exams:::browse_exercise, but html_e2m takes the information form the XML file generated by the exams2moodle.

Examples

if (interactive()) {
  resexams <- readRDS(system.file("xml", "klausur-test.rds", package="exams.moodle"))
  html_e2m(resexams) # opens HTML file into browser
}

sigbertklinke/exams2moodle documentation built on July 6, 2023, 3:26 p.m.