-
Notifications
You must be signed in to change notification settings - Fork 770
quiztime:0.1.0 #3443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
quiztime:0.1.0 #3443
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e8ae3f3
quiztime in version 0.1.0
e38e695
Update import path for quiztime package in README
judgeNotFound 414bcb5
Add LICENSE file for quiztime package
judgeNotFound c79b76b
Update README with clearer quiz output description
judgeNotFound cf74276
Improve image alt text in README.md
judgeNotFound File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,35 @@ | ||
| # Quiztime | ||
|
|
||
| Typst package to create quizzes. | ||
|
|
||
| ```typst | ||
| #import "@preview/quiztime:0.1.0": question, quiz | ||
|
|
||
| #let q1 = question( | ||
| text: "What color is the sky?", | ||
| kind: "multiple-choice", | ||
| answers: ("Blue", "Red", "Yellow", "Gray"), | ||
| ) | ||
|
|
||
| #let q2 = question( | ||
| text: "Why do you think is the world where it is?", | ||
| kind: "text", | ||
| answers: ("Because no one took proper care of it.",), | ||
| show-solutions: true, | ||
| answer-space: 50pt, | ||
| ) | ||
|
|
||
| #let q3 = question( | ||
| text: "What color is the sea?", | ||
| kind: "multiple-choice", | ||
| answers: ("Blue", "Red", "Yellow", "Gray"), | ||
| true-answers: (1,), | ||
| show-solutions: true | ||
| ) | ||
|
|
||
| #quiz(questions: (q1,q2,q3), pre-numbering: "Question ") | ||
| ``` | ||
|
|
||
| Gives: | ||
|
|
||
|  | ||
judgeNotFound marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
judgeNotFound marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or 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,71 @@ | ||
| #let checkbox = text("◯", size: 8pt) | ||
| #let checkbox-true = text("⬤", size: 8pt) | ||
|
|
||
| #let question( | ||
| // Actual question to be asked | ||
| text: "", | ||
|
|
||
| // Possible values: multiple-choice, text | ||
| kind: "", | ||
|
|
||
| // Answers for a multiple choice question | ||
| // Only used if kind = "multiple-choice" | ||
| answers: (), | ||
|
|
||
| // The space that should be given for writing an answer | ||
| // Only used for kind = "text" | ||
| answer-space: 100pt, | ||
|
|
||
| // The index (1-based) of the answers that are true | ||
| true-answers: (), | ||
|
|
||
| // Whether or not to show solutions | ||
| show-solutions: false, | ||
| ) = { | ||
| text + "\n" | ||
| v(5pt) | ||
|
|
||
| if kind == "multiple-choice" { | ||
| let idx = 0 | ||
| while idx < answers.len() { | ||
| let a = answers.at(idx) | ||
|
|
||
| h(20pt) | ||
| if show-solutions and true-answers.contains(idx + 1) { | ||
| checkbox-true | ||
| } else { | ||
| checkbox | ||
| } | ||
| h(10pt) | ||
|
|
||
| a + "\n" | ||
| idx += 1 | ||
| } | ||
| } else { | ||
| if show-solutions and answers.len() > 0 { | ||
| h(20pt) | ||
| answers.at(0) | ||
| } else { | ||
| v(answer-space) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #let quiz( | ||
| // Questions | ||
| questions: (), | ||
|
|
||
| // The text before 1: <question> | ||
| pre-numbering: "", | ||
| ) = { | ||
| let idx = 0 | ||
| while idx < questions.len() { | ||
| let q = questions.at(idx) | ||
|
|
||
| text(pre-numbering + str(idx + 1) + ": ", weight: "bold") | ||
| q | ||
| v(20pt) | ||
|
|
||
| idx += 1 | ||
| } | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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,9 @@ | ||
| [package] | ||
| name = "quiztime" | ||
| version = "0.1.0" | ||
| entrypoint = "lib.typ" | ||
| authors = ["Robert Richter <https://github.com/judgeNotFound>"] | ||
| license = "MIT" | ||
| categories = ["utility"] | ||
| description = "Create little quizzes." | ||
| keywords = ["Quiz", "Teaching", "Grading"] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.