From 7230e3f8c720d986b97c8e090cd34019947b4426 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 16 Jul 2024 09:47:37 +0300 Subject: New function: Add gnosis-cloze-check Check if clozes are part of the sentence --- gnosis.el | 8 ++++++++ 1 file changed, 8 insertions(+) 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. -- cgit v1.2.3