-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert w1 activities from webr-teachr to quarto-live + qlcheckr
- Loading branch information
1 parent
80153c2
commit dd08ed9
Showing
19 changed files
with
2,542 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
title: Quarto Live | ||
author: George Stagg | ||
version: 0.1.2-dev | ||
quarto-required: ">=1.4.0" | ||
contributes: | ||
filters: | ||
- live.lua | ||
formats: | ||
common: | ||
ojs-engine: true | ||
filters: | ||
- live.lua | ||
html: default | ||
revealjs: default | ||
dashboard: default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
```{webr} | ||
#| edit: false | ||
#| output: false | ||
webr::install("gradethis", quiet = TRUE) | ||
library(gradethis) | ||
options(webr.exercise.checker = function( | ||
label, user_code, solution_code, check_code, envir_result, evaluate_result, | ||
envir_prep, last_value, engine, stage, ... | ||
) { | ||
if (is.null(check_code)) { | ||
# No grading code, so just skip grading | ||
invisible(NULL) | ||
} else if (is.null(label)) { | ||
list( | ||
correct = FALSE, | ||
type = "warning", | ||
message = "All exercises must have a label." | ||
) | ||
} else if (is.null(solution_code)) { | ||
list( | ||
correct = FALSE, | ||
type = "warning", | ||
message = htmltools::tags$div( | ||
htmltools::tags$p("A problem occurred grading this exercise."), | ||
htmltools::tags$p( | ||
"No solution code was found. Note that grading exercises using the ", | ||
htmltools::tags$code("gradethis"), | ||
"package requires a model solution to be included in the document." | ||
) | ||
) | ||
) | ||
} else { | ||
gradethis::gradethis_exercise_checker( | ||
label = label, solution_code = solution_code, user_code = user_code, | ||
check_code = check_code, envir_result = envir_result, | ||
evaluate_result = evaluate_result, envir_prep = envir_prep, | ||
last_value = last_value, stage = stage, engine = engine) | ||
} | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
```{r echo=FALSE} | ||
# Setup knitr for handling {webr} and {pyodide} blocks | ||
# TODO: With quarto-dev/quarto-cli#10169, we can implement this in a filter | ||
# We'll handle `include: false` in Lua, always include cell in knitr output | ||
knitr::opts_hooks$set(include = function(options) { | ||
if (options$engine == "webr" || options$engine == "pyodide") { | ||
options$include <- TRUE | ||
} | ||
options | ||
}) | ||
# Passthrough engine for webr | ||
knitr::knit_engines$set(webr = function(options) { | ||
knitr:::one_string(c( | ||
"```{webr}", | ||
options$yaml.code, | ||
options$code, | ||
"```" | ||
)) | ||
}) | ||
# Passthrough engine for pyodide | ||
knitr::knit_engines$set(pyodide = function(options) { | ||
knitr:::one_string(c( | ||
"```{pyodide}", | ||
options$yaml.code, | ||
options$code, | ||
"```" | ||
)) | ||
}) | ||
``` |
Oops, something went wrong.