diff options
author | Thanos Apollo <[email protected]> | 2024-02-22 13:47:49 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-02-22 13:47:49 +0200 |
commit | b12e5956b8c600d617ba3b817172c32149aa84ea (patch) | |
tree | 6a6333b64c2bfca7f2b507ad49397823699ceb5b | |
parent | 67afa56d09de10a7e3593088c28a97215d03b651 (diff) |
Add gnosis-prompt-mcq-choices
Return a list of mcq choices & the correct answer, make input easier
and simpler
-rw-r--r-- | gnosis.el | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -852,6 +852,16 @@ Returns a list of unique tags." (setf gnosis-previous-note-hint hint) hint)) +(defun gnosis-prompt-mcq-choices () + "Prompt user for mcq choices." + (let* ((input (split-string + (read-string-from-buffer "Options\nEach '-' corresponds to an option\n-Example Option 1\n-Example Option 2\nYou can add as many options as you want\nCorrect Option must be inside {}" "-\n-") + "-" t "[\s\n]")) + (correct-choice-index (or (cl-position-if (lambda (string) (string-match "{.*}" string)) input) + (error "Correct choice not found. Use {} to indicate the correct opiton"))) + (choices (mapcar (lambda (string) (replace-regexp-in-string "{\\|}" "" string)) input))) + (list choices (+ correct-choice-index 1)))) + ;; Review ;;;;;;;;;; (defun gnosis-review-is-due-p (note-id) |