From 4cd3ce6993a9b97b698537c428addf7387b13a3f Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 17 Jul 2024 10:22:40 +0300 Subject: cloze: edit: Add assertion for string or nil. * Contents inside options/hints should be either nil or string. --- gnosis.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gnosis.el b/gnosis.el index f2b9bb9..8291a1b 100644 --- a/gnosis.el +++ b/gnosis.el @@ -1898,7 +1898,8 @@ SUSPEND: Suspend note, 0 for unsuspend, 1 for suspend" (not (stringp options))) (cl-assert (or (listp options) (stringp options)) nil "Options must be a list or a string.") (cl-assert (gnosis-cloze-check main answer) nil "Clozes are not part of the question (main).") - (cl-assert (>= (length answer) (length options)) nil "Hints (options) must be equal or less than clozes (answer).")) + (cl-assert (>= (length answer) (length options)) nil "Hints (options) must be equal or less than clozes (answer).") + (cl-assert (cl-every (lambda (item) (or (null item) (stringp item))) options) nil "Hints (options) must be either nil or a string.")) ;; Construct the update clause for the emacsql update statement. (cl-loop for (field . value) in `((main . ,main) (options . ,options) -- cgit v1.2.3