From aa76b6e8f5889f751c5adac93819126122ca80ea Mon Sep 17 00:00:00 2001 From: Trevor Gunn Date: Sat, 20 Apr 2024 18:22:04 -0400 Subject: [PATCH] document scriptq --- README.md | 2 +- docs/src/index.md | 10 ++++++++++ examples/documenter.md | 7 +++++++ examples/quarto.qmd | 8 ++++++++ examples/weave.jmd | 5 +++++ 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f1ddb20..d028034 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![](https://img.shields.io/badge/docs-dev-blue.svg)](https://jverzani.github.io/QuizQuestions.jl/dev/) -A simple means to make basic web pages using Markdown with self-grading quiz questions. Question types are for numeric response, text response (graded with a regular expression), matching, a selection of one from many, or one or more from many. Can be used with Weave, Documenter, [quarto](https://quarto.org), or Pluto. +A simple means to make basic web pages using Markdown with self-grading quiz questions. Question types are for numeric response, text response (graded with a regular expression or by JavaScript function), matching, a selection of one from many, or one or more from many. Can be used with Weave, Documenter, [quarto](https://quarto.org), or Pluto. The package creates `show` methods for mime type `text/html` for a few objects that produce HTML showing an input widget with attached javascript code to grade the input once the widget loses focus. diff --git a/docs/src/index.md b/docs/src/index.md index 473f6d7..d918a29 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -189,6 +189,15 @@ fillblankq(question, r"^lazy$") ---- +(like `scriptq`) + +```@example quiz_question +funct = "(input) => input >= 42" +scriptq(funct, label="a large number", explanation="should be at least 6 * 7") +``` + +---- + (like `numericq`) ```@example quiz_question @@ -235,6 +244,7 @@ multibuttonq matchq numericq stringq +scriptq fillblankq hotspotq plotlylightq diff --git a/examples/documenter.md b/examples/documenter.md index 0e6aa03..b52c717 100644 --- a/examples/documenter.md +++ b/examples/documenter.md @@ -12,6 +12,13 @@ re = Regex("abc") # hide stringq(re) # hide ``` +Enter a large number + +```@example quiz +funct = "(input) => input >= 42" +scriptq(funct, explanation="should be at least 6 * 7") +``` + What is ``\sin(\frac{\pi}{2})``? ```@example quiz diff --git a/examples/quarto.qmd b/examples/quarto.qmd index 97ffbf3..d9e5d85 100644 --- a/examples/quarto.qmd +++ b/examples/quarto.qmd @@ -14,6 +14,14 @@ re = Regex("abc") stringq(re) ``` +Enter a large number + +```{julia} +#| echo: false +funct = "(input) => input >= 42" +scriptq(funct, explanation="should be at least 6 * 7") +``` + ```{julia} #| echo: false a = 1 diff --git a/examples/weave.jmd b/examples/weave.jmd index e0035b6..056fb62 100644 --- a/examples/weave.jmd +++ b/examples/weave.jmd @@ -11,7 +11,12 @@ re = Regex("abc") stringq(re) ``` +Enter a large number +```julia; echo=false +funct = "(input) => input >= 42" +scriptq(funct, explanation="should be at least 6 * 7") +``` ```julia; echo=false a = 1