From 9ec7dea464f0498fbe83f14158402f753495cd77 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 16 Jul 2024 14:05:17 +0300 Subject: cloze: Add gnosis-cloze-mark-false * Mark false answers. --- gnosis.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gnosis.el b/gnosis.el index 7d66ab5..a8dd390 100644 --- a/gnosis.el +++ b/gnosis.el @@ -489,6 +489,20 @@ Refer to =gnosis-db-schema-extras' for informations on images stored." (replace-match (propertize answer 'face face) nil t))) (buffer-string))) +(defun gnosis-cloze-mark-false (str answers) + "Mark contents of STR as false for ANSWERS. + +First item of answers will be marked as false, while the rest unanswered." + (let* ((false (car answers)) + (unanswered (cdr answers)) + (str-with-false (and answers (gnosis-cloze-mark-answers str (list false) 'gnosis-face-false))) + final) + (if unanswered + (setq final (gnosis-cloze-mark-answers str-with-false (if (listp unanswered) unanswered + (list unanswered)) + 'underline)) + (setq final (or str-with-false str))) + final)) (defun gnosis-display-basic-answer (answer success user-input) "Display ANSWER. -- cgit v1.2.3