summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-07-16 09:47:37 +0300
committerThanos Apollo <[email protected]>2024-07-16 09:47:37 +0300
commit7230e3f8c720d986b97c8e090cd34019947b4426 (patch)
treec0e4d6c68016a9d18627e415d64a6b79763f90c6
parent176f892230a57dd567bb83300d48be4d8a79e867 (diff)
New function: Add gnosis-cloze-check
Check if clozes are part of the sentence
-rw-r--r--gnosis.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index 09d86d2..cbc053b 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1116,6 +1116,14 @@ TYPE: Type of gnosis note, must be one of `gnosis-note-types'"
(history-add-new-input nil)) ;; Disable history
(gnosis-completing-read "Answer: " choices)))
+(defun gnosis-cloze-check (sentence clozes)
+ "Check if CLOZES are found in SENTENCE."
+ (catch 'not-found
+ (dolist (cloze clozes)
+ (unless (string-match-p cloze sentence)
+ (throw 'not-found nil)))
+ t))
+
(defun gnosis-cloze-remove-tags (string)
"Replace cloze tags and hints in STRING.