diff options
author | Thanos Apollo <[email protected]> | 2024-07-16 14:04:48 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-07-16 14:04:48 +0300 |
commit | 3f78225016e797770923cbf5559d10685c9e87b3 (patch) | |
tree | e732f3ec67e33d72b61715cf3ff54f01e1645933 | |
parent | e6f7b6f02e7f80c39b57da0fc4d8228a6e40f973 (diff) |
cloze: Add gnosis-cloze-mark-answers: Mark answers in cloze review
-rw-r--r-- | gnosis.el | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -477,6 +477,18 @@ Refer to =gnosis-db-schema-extras' for informations on images stored." (replace-match (propertize (format "[%s]" (nth count hints)) 'face 'gnosis-face-cloze))) (setq count (1+ count))) (buffer-string)))) + +(defun gnosis-cloze-mark-answers (str answers face) + "Mark ANSWERS in STR with FACE." + (cl-assert (listp answers) nil "Answers to mark must be a list.") + (with-temp-buffer + (insert str) + (goto-char (point-min)) + (dolist (answer answers) + (when (search-forward answer nil t) + (replace-match (propertize answer 'face face) nil t))) + (buffer-string))) + (defun gnosis-display-basic-answer (answer success user-input) "Display ANSWER. |